Fix: when firing from several barrels with two guns, AP cost is deducted twice

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9145 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2021-07-24 11:00:59 +00:00
parent e6ea95eb8b
commit 102ee32232
+22 -16
View File
@@ -2502,17 +2502,20 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo )
PlayWeaponSound(pSoldier, pObjHand, pObjAttHand, usUBItem);
// ONLY DEDUCT FOR THE FIRST HAND when doing two-pistol attacks
if (pSoldier->IsValidSecondHandShot() && (*pObjHand)[0]->data.gun.bGunStatus >= USABLE && (*pObjHand)[0]->data.gun.bGunAmmoStatus > 0)
if ( !pSoldier->usBarrelCounter )
{
// only deduct APs when the main gun fires
if (pSoldier->ubAttackingHand == HANDPOS)
if ( pSoldier->IsValidSecondHandShot() && ( *pObjHand )[0]->data.gun.bGunStatus >= USABLE && ( *pObjHand )[0]->data.gun.bGunAmmoStatus > 0 )
{
DeductPoints(pSoldier, sAPCost, iBPCost, AFTERSHOT_INTERRUPT);
// only deduct APs when the main gun fires
if ( pSoldier->ubAttackingHand == HANDPOS )
{
DeductPoints( pSoldier, sAPCost, iBPCost, AFTERSHOT_INTERRUPT );
}
}
else
{
DeductPoints( pSoldier, sAPCost, iBPCost, AFTERSHOT_INTERRUPT );
}
}
else
{
DeductPoints(pSoldier, sAPCost, iBPCost, AFTERSHOT_INTERRUPT);
}
}
@@ -3220,17 +3223,20 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo )
PlayWeaponSound(pSoldier, pObjHand, pObjAttHand, usUBItem);
// ONLY DEDUCT FOR THE FIRST HAND when doing two-pistol attacks
if (pSoldier->IsValidSecondHandShot() && (*pObjUsed)[0]->data.gun.bGunStatus >= USABLE && (*pObjUsed)[0]->data.gun.bGunAmmoStatus > 0)
if ( !pSoldier->usBarrelCounter )
{
// only deduct APs when the main gun fires
if (pSoldier->ubAttackingHand == HANDPOS)
if ( pSoldier->IsValidSecondHandShot() && ( *pObjUsed )[0]->data.gun.bGunStatus >= USABLE && ( *pObjUsed )[0]->data.gun.bGunAmmoStatus > 0 )
{
DeductPoints(pSoldier, sAPCost, iBPCost, AFTERSHOT_INTERRUPT);
// only deduct APs when the main gun fires
if ( pSoldier->ubAttackingHand == HANDPOS )
{
DeductPoints( pSoldier, sAPCost, iBPCost, AFTERSHOT_INTERRUPT );
}
}
else
{
DeductPoints( pSoldier, sAPCost, iBPCost, AFTERSHOT_INTERRUPT );
}
}
else
{
DeductPoints(pSoldier, sAPCost, iBPCost, AFTERSHOT_INTERRUPT);
}
}