mirror of
https://github.com/1dot13/source.git
synced 2026-08-26 14:30:26 +02:00
New weapon type modifiers for:
- damage - single shot AP - burst AP - auto fire AP Fixed some parts where the raw item property was used instead of the Get... function that should be used. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6470 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -6080,7 +6080,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject )
|
||||
// Get base damage value
|
||||
UINT8 iDamageValue = GetBasicDamage ( gpItemDescObject );
|
||||
|
||||
// Get Modified Accuracy value
|
||||
// Get Modified damage value
|
||||
UINT8 iFinalDamageValue = GetDamage ( gpItemDescObject );
|
||||
|
||||
// Get difference
|
||||
|
||||
@@ -3618,7 +3618,9 @@ UINT32 ItemFitness( OBJECTTYPE* pObj, UINT8 idx )
|
||||
}
|
||||
else if ( Item[ pObj->usItem ].usItemClass & (IC_BLADE|IC_PUNCH) )
|
||||
{
|
||||
value = (*pObj)[idx]->data.objectStatus * Weapon[ Item[ pObj->usItem ].ubClassIndex ].ubImpact;
|
||||
value = GetDamage(pObj);
|
||||
|
||||
value *= (*pObj)[idx]->data.objectStatus;
|
||||
}
|
||||
else if ( Item[ pObj->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) )
|
||||
{
|
||||
|
||||
+10
-8
@@ -8021,25 +8021,27 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
|
||||
pSoldier = MercPtrs[ubCausedAttacker];
|
||||
if ( Item[ pSoldier->inv[pSoldier->ubAttackingHand].usItem ].usItemClass == IC_GUN )
|
||||
{
|
||||
UINT8 ubDamage = GetBasicDamage(&pSoldier->inv[pSoldier->ubAttackingHand]);
|
||||
|
||||
// +1% per point above 20 impact
|
||||
if ( Weapon[ pSoldier->inv[pSoldier->ubAttackingHand].usItem ].ubImpact > 20 )
|
||||
if ( ubDamage > 20 )
|
||||
{
|
||||
sFinalSuppressionEffectiveness += (Weapon[pSoldier->inv[pSoldier->ubAttackingHand].usItem].ubImpact - 20);
|
||||
sFinalSuppressionEffectiveness += (ubDamage - 20);
|
||||
|
||||
// +2% per point above 30 impact
|
||||
if ( Weapon[ pSoldier->inv[pSoldier->ubAttackingHand].usItem ].ubImpact > 30 )
|
||||
if ( ubDamage > 30 )
|
||||
{
|
||||
sFinalSuppressionEffectiveness += (Weapon[pSoldier->inv[pSoldier->ubAttackingHand].usItem].ubImpact - 30);
|
||||
sFinalSuppressionEffectiveness += (ubDamage - 30);
|
||||
|
||||
// +3% per point above 40 impact
|
||||
if ( Weapon[ pSoldier->inv[pSoldier->ubAttackingHand].usItem ].ubImpact > 40 )
|
||||
if ( ubDamage > 40 )
|
||||
{
|
||||
sFinalSuppressionEffectiveness += (Weapon[pSoldier->inv[pSoldier->ubAttackingHand].usItem].ubImpact - 40);
|
||||
sFinalSuppressionEffectiveness += (ubDamage - 40);
|
||||
|
||||
// +4% per point above 50 impact, some crazy gun here
|
||||
if ( Weapon[ pSoldier->inv[pSoldier->ubAttackingHand].usItem ].ubImpact > 50 )
|
||||
if ( ubDamage > 50 )
|
||||
{
|
||||
sFinalSuppressionEffectiveness += (Weapon[pSoldier->inv[pSoldier->ubAttackingHand].usItem].ubImpact - 50);
|
||||
sFinalSuppressionEffectiveness += (ubDamage - 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+51
-9
@@ -1492,11 +1492,15 @@ INT16 GetBreathPerAP( SOLDIERTYPE *pSoldier, UINT16 usAnimState )
|
||||
//UINT8 CalcAPsToBurst( INT8 bBaseActionPoints, UINT16 usItem )
|
||||
INT16 CalcAPsToBurst( INT16 bBaseActionPoints, OBJECTTYPE * pObj, SOLDIERTYPE* pSoldier )
|
||||
{
|
||||
INT32 aps;
|
||||
INT32 aps, iModifiedAPs;
|
||||
|
||||
iModifiedAPs = Weapon[ pObj->usItem ].bBurstAP;
|
||||
// modify by ini values
|
||||
if ( Item[ pObj->usItem ].usItemClass == IC_GUN )
|
||||
iModifiedAPs *= gItemSettings.fBurstAPModifierGun[ Weapon[ pObj->usItem ].ubWeaponType ];
|
||||
// base APs is what you'd get from CalcActionPoints();
|
||||
// NB round UP, so 21-25 APs pay full
|
||||
aps = ( Weapon[ pObj->usItem ].bBurstAP * bBaseActionPoints + (APBPConstants[AP_MAXIMUM] - 1) ) / APBPConstants[AP_MAXIMUM];
|
||||
aps = ( iModifiedAPs * bBaseActionPoints + (APBPConstants[AP_MAXIMUM] - 1) ) / APBPConstants[AP_MAXIMUM];
|
||||
|
||||
/*if ( GetPercentBurstFireAPReduction(pObj)>0 )
|
||||
{
|
||||
@@ -1514,7 +1518,7 @@ INT16 CalcAPsToBurst( INT16 bBaseActionPoints, OBJECTTYPE * pObj, SOLDIERTYPE* p
|
||||
aps = ( aps * ( 100 - GetPercentAPReduction(pSoldier, pObj) ) ) / 100;
|
||||
|
||||
// Snap: moved this up to allow burst AP reduction up to 100%
|
||||
aps = __max( aps, ( Weapon[ pObj->usItem ].bBurstAP + 1 ) / 2 );
|
||||
aps = __max( aps, ( iModifiedAPs + 1 ) / 2 );
|
||||
|
||||
aps = ( aps * ( 100 - GetPercentBurstFireAPReduction(pObj) ) ) / 100;
|
||||
|
||||
@@ -1528,11 +1532,17 @@ INT16 CalcAPsToBurst( INT16 bBaseActionPoints, OBJECTTYPE * pObj, SOLDIERTYPE* p
|
||||
// HEADROCK HAM 4: Same as above, without percent modifiers.
|
||||
INT16 CalcAPsToBurstNoModifier( INT16 bBaseActionPoints, OBJECTTYPE * pObj )
|
||||
{
|
||||
INT32 aps;
|
||||
INT32 aps, iModifiedAPs;
|
||||
|
||||
aps = ( Weapon[ pObj->usItem ].bBurstAP * bBaseActionPoints + (APBPConstants[AP_MAXIMUM] - 1) ) / APBPConstants[AP_MAXIMUM];
|
||||
iModifiedAPs = Weapon[ pObj->usItem ].bBurstAP;
|
||||
// modify by ini values
|
||||
// although the function says "no modifier" the ini values represent our new base value
|
||||
if ( Item[ pObj->usItem ].usItemClass == IC_GUN )
|
||||
iModifiedAPs *= gItemSettings.fBurstAPModifierGun[ Weapon[ pObj->usItem ].ubWeaponType ];
|
||||
|
||||
aps = __max( aps, ( Weapon[ pObj->usItem ].bBurstAP + 1 ) / 2 );
|
||||
aps = ( iModifiedAPs * bBaseActionPoints + (APBPConstants[AP_MAXIMUM] - 1) ) / APBPConstants[AP_MAXIMUM];
|
||||
|
||||
aps = __max( aps, ( iModifiedAPs + 1 ) / 2 );
|
||||
|
||||
if ( aps < 0 ) aps = 0;
|
||||
else if ( aps > APBPConstants[AP_MAXIMUM] ) aps = APBPConstants[AP_MAXIMUM];
|
||||
@@ -1637,7 +1647,7 @@ INT16 CalcTotalAPsToAttack( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubAddTur
|
||||
usItemNum = pSoldier->inv[HANDPOS].usItem;
|
||||
uiItemClass = Item[ usUBItemNum ].usItemClass;
|
||||
|
||||
if ( uiItemClass == IC_GUN || uiItemClass == IC_LAUNCHER || uiItemClass == IC_TENTACLES || uiItemClass == IC_THROWING_KNIFE )
|
||||
if ( uiItemClass == IC_GUN || uiItemClass == IC_LAUNCHER || uiItemClass == IC_THROWING_KNIFE )
|
||||
{
|
||||
sAPCost = MinAPsToAttack( pSoldier, sGridNo, ubAddTurningCost, bAimTime );
|
||||
|
||||
@@ -1724,7 +1734,7 @@ INT16 CalcTotalAPsToAttack( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubAddTur
|
||||
//sAPCost = 5;
|
||||
}
|
||||
|
||||
if ( uiItemClass == IC_PUNCH || uiItemClass == IC_BLADE )//dnl ch73 031013
|
||||
if ( uiItemClass == IC_PUNCH || uiItemClass == IC_BLADE || uiItemClass == IC_TENTACLES )//dnl ch73 031013, silversurfer: tentacles are melee too
|
||||
{
|
||||
// IF we are at this gridno, calc min APs but if not, calc cost to goto this lication
|
||||
if ( pSoldier->sGridNo != sGridNo )
|
||||
@@ -1933,6 +1943,21 @@ INT16 BaseAPsToShootOrStab( INT16 bAPs, INT16 bAimSkill, OBJECTTYPE * pObj, SOLD
|
||||
// Their info is an array of item status, not weapon info, and they don't repeat
|
||||
// fire anyway.
|
||||
rof = Weapon[ pObj->usItem ].ubShotsPer4Turns;
|
||||
|
||||
// modify by ini values
|
||||
if ( Item[ pObj->usItem ].usItemClass == IC_GUN )
|
||||
rof *= gItemSettings.fShotsPer4TurnsModifierGun[ Weapon[ pObj->usItem ].ubWeaponType ];
|
||||
else if ( Item[ pObj->usItem ].usItemClass == IC_LAUNCHER )
|
||||
rof *= gItemSettings.fShotsPer4TurnsModifierLauncher;
|
||||
else if ( Item[ pObj->usItem ].usItemClass == IC_BLADE )
|
||||
rof *= gItemSettings.fShotsPer4TurnsModifierBlade;
|
||||
else if ( Item[ pObj->usItem ].usItemClass == IC_PUNCH )
|
||||
rof *= gItemSettings.fShotsPer4TurnsModifierPunch;
|
||||
else if ( Item[ pObj->usItem ].usItemClass == IC_TENTACLES )
|
||||
rof *= gItemSettings.fShotsPer4TurnsModifierTentacle;
|
||||
else if ( Item[ pObj->usItem ].usItemClass == IC_THROWING_KNIFE )
|
||||
rof *= gItemSettings.fShotsPer4TurnsModifierThrowKnife;
|
||||
|
||||
//CHRISL: Resolves a problem with stackable weapons not using attachments like Reflex sight. Found by Mugsy
|
||||
//if (ItemSlotLimit(pObj, STACK_SIZE_LIMIT) == 1)//NOT STACKABLE!
|
||||
{
|
||||
@@ -1979,6 +2004,21 @@ INT16 BaseAPsToShootOrStabNoModifier( INT16 bAPs, INT16 bAimSkill, OBJECTTYPE *
|
||||
|
||||
rof = Weapon[ pObj->usItem ].ubShotsPer4Turns;
|
||||
|
||||
// modify by ini values
|
||||
// although this function says "no modifiers" our ini values are supposed to provide new base values
|
||||
if ( Item[ pObj->usItem ].usItemClass == IC_GUN )
|
||||
rof *= gItemSettings.fShotsPer4TurnsModifierGun[ Weapon[ pObj->usItem ].ubWeaponType ];
|
||||
else if ( Item[ pObj->usItem ].usItemClass == IC_LAUNCHER )
|
||||
rof *= gItemSettings.fShotsPer4TurnsModifierLauncher;
|
||||
else if ( Item[ pObj->usItem ].usItemClass == IC_BLADE )
|
||||
rof *= gItemSettings.fShotsPer4TurnsModifierBlade;
|
||||
else if ( Item[ pObj->usItem ].usItemClass == IC_PUNCH )
|
||||
rof *= gItemSettings.fShotsPer4TurnsModifierPunch;
|
||||
else if ( Item[ pObj->usItem ].usItemClass == IC_TENTACLES )
|
||||
rof *= gItemSettings.fShotsPer4TurnsModifierTentacle;
|
||||
else if ( Item[ pObj->usItem ].usItemClass == IC_THROWING_KNIFE )
|
||||
rof *= gItemSettings.fShotsPer4TurnsModifierThrowKnife;
|
||||
|
||||
Top = 8 * bAPs * 100;
|
||||
|
||||
INT16 baseAPsToShootOrStab = -1;
|
||||
@@ -4244,7 +4284,9 @@ INT32 GetBPCostForRecoilkick( SOLDIERTYPE * pSoldier )
|
||||
|
||||
// Impact indirectly speaks of the size of the bullet, and thus strength of the backforce, theoretically.. so take it to the account.
|
||||
// (Other than that, we have nothing to base our calculation on by now, the solution would be to make a new tag in weapons.xml, but that's modder-unfriendly.)
|
||||
INT32 iKickPower = (INT32)(Weapon[pSoldier->inv[pSoldier->ubAttackingHand].usItem].ubImpact);
|
||||
// silversurfer: Let's use the function that is designed for that.
|
||||
//INT32 iKickPower = (INT32)(Weapon[pSoldier->inv[pSoldier->ubAttackingHand].usItem].ubImpact);
|
||||
INT32 iKickPower = (INT32)GetBasicDamage(&pSoldier->inv[pSoldier->ubAttackingHand]);
|
||||
|
||||
// get weapon total weight
|
||||
// Weapon weight here actually helps us, since it absorbs the power of the backforce.
|
||||
|
||||
+41
-1
@@ -11626,12 +11626,28 @@ UINT8 GetDamage ( OBJECTTYPE *pObj )
|
||||
if(UsingNewCTHSystem() == true)
|
||||
{
|
||||
ubDamage = Weapon[ pObj->usItem ].ubImpact;
|
||||
// modify by ini values
|
||||
if ( Item[pObj->usItem].usItemClass == IC_BLADE )
|
||||
ubDamage *= gItemSettings.fDamageModifierBlade;
|
||||
else if ( Item[pObj->usItem].usItemClass == IC_PUNCH )
|
||||
ubDamage *= gItemSettings.fDamageModifierPunch;
|
||||
else
|
||||
ubDamage *= gItemSettings.fDamageModifierTentacle;
|
||||
|
||||
ubDamage += GetMeleeDamageBonus(pObj);
|
||||
ubDamage = (UINT8)GetModifiedMeleeDamage( ubDamage );
|
||||
}
|
||||
else
|
||||
{
|
||||
ubDamage = (UINT8)GetModifiedMeleeDamage( Weapon[ pObj->usItem ].ubImpact );
|
||||
// modify by ini values
|
||||
if ( Item[pObj->usItem].usItemClass == IC_BLADE )
|
||||
ubDamage *= gItemSettings.fDamageModifierBlade;
|
||||
else if ( Item[pObj->usItem].usItemClass == IC_PUNCH )
|
||||
ubDamage *= gItemSettings.fDamageModifierPunch;
|
||||
else
|
||||
ubDamage *= gItemSettings.fDamageModifierTentacle;
|
||||
|
||||
ubDamage += GetMeleeDamageBonus(pObj);
|
||||
}
|
||||
//return min(255, (UINT8)( (ubDamage) + ( (double)ubDamage / 100) * gGameExternalOptions.iMeleeDamageModifier ) );
|
||||
@@ -11644,6 +11660,9 @@ UINT8 GetDamage ( OBJECTTYPE *pObj )
|
||||
if(UsingNewCTHSystem() == true)
|
||||
{
|
||||
ubDamage = Weapon[ pObj->usItem ].ubImpact;
|
||||
// modify by ini values
|
||||
if ( Item[pObj->usItem].usItemClass == IC_GUN )
|
||||
ubDamage *= gItemSettings.fDamageModifierGun[ Weapon[ pObj->usItem ].ubWeaponType ];
|
||||
// HEADROCK HAM 4: I've decided to remove this condition. It makes no friggin sense.
|
||||
//if (FitsInSmallPocket(pObj) == true)
|
||||
//{
|
||||
@@ -11654,6 +11673,9 @@ UINT8 GetDamage ( OBJECTTYPE *pObj )
|
||||
else
|
||||
{
|
||||
ubDamage = (UINT8)GetModifiedGunDamage( Weapon[ pObj->usItem ].ubImpact );
|
||||
// modify by ini values
|
||||
if ( Item[pObj->usItem].usItemClass == IC_GUN )
|
||||
ubDamage *= gItemSettings.fDamageModifierGun[ Weapon[ pObj->usItem ].ubWeaponType ];
|
||||
|
||||
// WTF? Why do only small weapons get their damage bonus?!
|
||||
if (FitsInSmallPocket(pObj) == true)
|
||||
@@ -11672,12 +11694,24 @@ UINT8 GetBasicDamage ( OBJECTTYPE *pObj )
|
||||
{
|
||||
// HEADROCK HAM 3.6: Can now take a negative modifier
|
||||
UINT8 ubDamage = (UINT8)GetModifiedMeleeDamage( Weapon[ pObj->usItem ].ubImpact );
|
||||
// modify by ini values
|
||||
if ( Item[pObj->usItem].usItemClass == IC_BLADE )
|
||||
ubDamage *= gItemSettings.fDamageModifierBlade;
|
||||
else if ( Item[pObj->usItem].usItemClass == IC_PUNCH )
|
||||
ubDamage *= gItemSettings.fDamageModifierPunch;
|
||||
else
|
||||
ubDamage *= gItemSettings.fDamageModifierTentacle;
|
||||
|
||||
return ubDamage;
|
||||
}
|
||||
else
|
||||
{
|
||||
// HEADROCK HAM 3.6: Can now take a negative modifier
|
||||
UINT8 ubDamage = (UINT8)GetModifiedGunDamage( Weapon[ pObj->usItem ].ubImpact );
|
||||
// modify by ini values
|
||||
if ( Item[pObj->usItem].usItemClass == IC_GUN )
|
||||
ubDamage *= gItemSettings.fDamageModifierGun[ Weapon[ pObj->usItem ].ubWeaponType ];
|
||||
|
||||
return ubDamage;
|
||||
}
|
||||
}
|
||||
@@ -11754,9 +11788,15 @@ UINT8 GetAutofireShotsPerFiveAPs( OBJECTTYPE *pObj )
|
||||
// HEADROCK HAM B2.6: Added overall modifier
|
||||
if (Weapon[ pObj->usItem ].bAutofireShotsPerFiveAP > 0)
|
||||
{
|
||||
UINT8 usAutoFireShots = Weapon[ pObj->usItem ].bAutofireShotsPerFiveAP;
|
||||
|
||||
// modify by ini values
|
||||
if ( Item[ pObj->usItem ].usItemClass == IC_GUN )
|
||||
usAutoFireShots *= gItemSettings.fAFShotsPer5APModifierGun[ Weapon[ pObj->usItem ].ubWeaponType ];
|
||||
|
||||
// WANNE: Fix by Headrock
|
||||
// Weapons shouldn't ever lose their Bp5AP due to this modifier.
|
||||
return __max((Weapon[ pObj->usItem ].bAutofireShotsPerFiveAP + gGameExternalOptions.bAutofireBulletsPer5APModifier), 1);
|
||||
return __max((usAutoFireShots + gGameExternalOptions.bAutofireBulletsPer5APModifier), 1);
|
||||
|
||||
//return __max((Weapon[ pObj->usItem ].bAutofireShotsPerFiveAP + gGameExternalOptions.bAutofireBulletsPer5APModifier), 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user