Build1937

This build includes the "Professional Sniper" skill and changes made to aiming and scopes in the CTH calculation functions.
Modified Sniper skill and "per click" aim bonus functionality.
Added some adjustments to how Scopes effect the CTH calculations.  This should drastically reduce the effectiveness of sniper weapons and scopes, while still leaving them effective at closer ranges.
Adjusted the scope vision bonus so that it plays on range with a minimum attainable reduction equal to the scopes minrange value.


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1937 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
ChrisL
2008-03-29 20:40:40 +00:00
parent bdcc920c63
commit a7e6b96bbe
4 changed files with 52 additions and 12 deletions
+3 -3
View File
@@ -13,12 +13,12 @@
#ifdef JA2EDITOR
//MAP EDITOR BUILD VERSION
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.1936" };
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.1937" };
#elif defined JA2BETAVERSION
//BETA/TEST BUILD VERSION
CHAR16 zVersionLabel[256] = { L"Debug v1.13.1936" };
CHAR16 zVersionLabel[256] = { L"Debug v1.13.1937" };
#elif defined CRIPPLED_VERSION
@@ -28,7 +28,7 @@ CHAR16 zVersionLabel[256] = { L"Beta v. 0.98" };
#else
//RELEASE BUILD VERSION
CHAR16 zVersionLabel[256] = { L"Release v1.13.1936" };
CHAR16 zVersionLabel[256] = { L"Release v1.13.1937" };
#endif
+23 -2
View File
@@ -6887,7 +6887,25 @@ INT16 GetItemAimBonus( const INVTYPE* pItem, INT32 iRange, UINT8 ubAimTime )
if ( pItem->aimbonus < 0)
ubAimTime = 1;
return ( pItem->aimbonus * ubAimTime * ( iRange - pItem->minrangeforaimbonus ) ) / 100;
//CHRISL: The old system basically allowed scopes to reduce sight range by AimBonus%/click. So a scope with an
// AimBonus 20, and 8 clicks, would reduce sight range by 160%. In other words, it would effectively reduce sight
// range to 0 just for using 8 APs to aim.
//return ( pItem->aimbonus * ubAimTime * ( iRange - pItem->minrangeforaimbonus ) ) / 100;
// Instead, let's have the bonus reduce each click seperately and base the percentage on the new range.
INT16 bonus = 0, stepBonus = 0;
for( UINT8 step = 0; step < ubAimTime; step++)
{
stepBonus = (pItem->aimbonus * iRange)/100;
iRange -= stepBonus;
bonus += stepBonus;
if(iRange < pItem->minrangeforaimbonus)
{
stepBonus = pItem->minrangeforaimbonus - iRange;
bonus -= stepBonus;
break;
}
}
return(bonus);
}
INT16 GetAimBonus( OBJECTTYPE * pObj, INT32 iRange, UINT8 ubAimTime )
@@ -7449,13 +7467,16 @@ INT16 GetDayVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
}
// Snap: check only attachments on a raised weapon!
//CHRISL: Since this is a daytime calculation, I think we want the difference between NORMAL_LIGHTLEVEL_NIGHT and
// NORMAL_LIGHTLEVEL_DAY. To just use NORMAL_LIGHTLEVEL_NIGHT is the same as basing the calculation off of the
// difference between NORMAL_LIGHTLEVEL_NIGHT and 0, which represent bright light.
if ( usingGunScope == true )
{
pObj = &( pSoldier->inv[HANDPOS]);
if (pObj->exists() == true) {
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
bonus += BonusReduceMore( idiv( Item[iter->usItem].dayvisionrangebonus
* (NORMAL_LIGHTLEVEL_NIGHT - bLightLevel), NORMAL_LIGHTLEVEL_NIGHT ),
* (NORMAL_LIGHTLEVEL_NIGHT - __max(bLightLevel,NORMAL_LIGHTLEVEL_DAY)), (NORMAL_LIGHTLEVEL_NIGHT-NORMAL_LIGHTLEVEL_DAY) ),
(*iter)[0]->data.objectStatus );
}
}
+23 -4
View File
@@ -3754,15 +3754,32 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAimTime,
if ( iSightRange > (sDistVis * CELL_X_SIZE) )
{
//CHRISL: Because of the changes I've made to how scopes modify iSightRange, this penalty makes it basically impossible
// to shot at targets you can't see yourself. While this isn't an issue for most weapons, it overly restricts the
// effectiveness of sniper rifles. So pull this penalty but leave the one that comes later in the code.
// shooting beyond max normal vision... penalize such distance at double (also later we halve the remaining chance)
iSightRange += (iSightRange - sDistVis * CELL_X_SIZE);
//iSightRange += (iSightRange - sDistVis * CELL_X_SIZE);
}
// if shooter spent some extra time aiming and can see the target
if (iSightRange > 0 && ubAimTime && !pSoldier->bDoBurst )
{
INT32 aimTimeBonus = 0;
if(highPowerScope == true)
// CHRISL: Rather then a flat +10/click bonus, we're going to try a bonus that's based on MRK and Lvl which gets
// progressivly less the more we aim. Everything is based on the maxBonus that a merc can possibly get which
// uses the equation: 20+(MRK/20*LVL)+Accuracy+(Sniper trait * 10). This value is then split between the 8
// possible AimTime's using a max aimTime bonus of 10.
INT16 bonusProgression[8] = {500,500,600,600,750,750,750,1000};
FLOAT maxBonus = 20+((FLOAT)iMarksmanship/20*pSoldier->stats.bExpLevel)+(Weapon[Item[pInHand->usItem].ubClassIndex].bAccuracy*2)+(NUM_SKILL_TRAITS( pSoldier, PROF_SNIPER )*10);
INT8 maxClickBonus = 10;
FLOAT aimTimeBonus;
for(int i = 0; i < ubAimTime; i++)
{
aimTimeBonus = __min((maxBonus*bonusProgression[i]/1000),maxClickBonus);
maxBonus -= aimTimeBonus;
iChance += (INT32)floor(aimTimeBonus+.5);
}
/* if(highPowerScope == true)
{
{
if ( NUM_SKILL_TRAITS( pSoldier, PROF_SNIPER ) == 2 )
aimTimeBonus = -((__max(0,75-pSoldier->stats.bMarksmanship))/(pSoldier->stats.bExpLevel*2));
@@ -3776,7 +3793,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAimTime,
}
else
aimTimeBonus = AIM_BONUS_PER_AP;
iChance += (aimTimeBonus * ubAimTime); // bonus for every pt of aiming
iChance += (aimTimeBonus * ubAimTime); // bonus for every pt of aiming*/
}
if ( !(pSoldier->flags.uiStatusFlags & SOLDIER_PC ) ) // if this is a computer AI controlled enemy
@@ -5945,3 +5962,5 @@ INT8 GetAPsToReload( OBJECTTYPE *pObj )
+3 -3
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Version="8.00"
Name="ja2_2005Express"
ProjectGUID="{F44669E7-74AC-444B-B75F-F16F4B9F0265}"
RootNamespace="ja2_2005Express"
@@ -66,7 +66,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib"
OutputFile="$(OutDir)\ja2_deb_en_1936.exe"
OutputFile="$(OutDir)\ja2_deb_en_1937.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
@@ -145,7 +145,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib"
OutputFile="$(OutDir)\ja2_rel_en_1936.exe"
OutputFile="$(OutDir)\ja2_rel_en_1937.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
GenerateMapFile="true"