From 4f8498e5efac5aba492af52fd88ff236f26d8cf9 Mon Sep 17 00:00:00 2001 From: silversurfer Date: Sun, 22 Jan 2017 14:09:26 +0000 Subject: [PATCH] slightly modified the damage formula from r8370 git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8371 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Weapons.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index baf046bb..a2688be1 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -1340,13 +1340,11 @@ BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier ) { if ( PreRandom( 100 ) < ( Item[(*pObj).usItem].usDamageChance + ( 100 - condition ) / 5 ) ) { - // damage depends on gun status. The better the status the less damage it takes. Leave a chance for 0 damage. - UINT32 uiJamDamage = __max( 0, PreRandom( 5 - UINT32(condition / 30.0f) ) ); - if ( uiJamDamage > 0 ) - { - (*pObj)[0]->data.objectStatus -= __min( uiJamDamage, (*pObj)[0]->data.objectStatus ); - (*pObj)[0]->data.sRepairThreshold -= __min( uiJamDamage, (*pObj)[0]->data.sRepairThreshold ); - } + // damage depends on gun status. The better the status the less damage it takes. + UINT32 uiJamDamage = 1 + PreRandom( 5 - UINT32(condition / 30.0f) ); + + (*pObj)[0]->data.objectStatus -= __min( uiJamDamage, (*pObj)[0]->data.objectStatus ); + (*pObj)[0]->data.sRepairThreshold -= __min( uiJamDamage, (*pObj)[0]->data.sRepairThreshold ); } }