From 49989da8b10d32f992b548b4ab54056654cc305b Mon Sep 17 00:00:00 2001 From: Sevenfm Date: Thu, 27 Jan 2022 01:24:11 +0000 Subject: [PATCH] Dropping items from hand when being hit: - civilians with profile should not drop items from hand as it may break quests - fixed possible incorrect type conversion which could result in dropping too often if weapon in hand marked as undroppable git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9280 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Soldier Control.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 4122037f..be7e1800 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -10741,22 +10741,22 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr } // OK, if here, let's see if we should drop our weapon.... - if ( !dropiteminmainhand && ubReason != TAKE_DAMAGE_BLOODLOSS && !(AM_A_ROBOT( this )) ) + if (!dropiteminmainhand && ubReason != TAKE_DAMAGE_BLOODLOSS && !(AM_A_ROBOT(this)) && !(this->bTeam == CIV_TEAM && this->ubProfile != NO_PROFILE)) { INT16 sTestOne, sTestTwo, sChanceToDrop; INT8 bVisible = -1; sTestOne = EffectiveStrength( this, FALSE ); - sTestTwo = (2 * (__max( sLifeDeduct, (sBreathLoss / 100) ))); + sTestTwo = 2 * max(sLifeDeduct, (sBreathLoss / 100)); - if ( this->ubAttackerID != NOBODY && MercPtrs[this->ubAttackerID]->ubBodyType == BLOODCAT ) + if (this->ubAttackerID != NOBODY && MercPtrs[this->ubAttackerID]->ubBodyType == BLOODCAT) { // bloodcat boost, let them make people drop items more sTestTwo += 20; } // If damage > effective strength.... - sChanceToDrop = (__max( 0, (sTestTwo - sTestOne) )); + sChanceToDrop = sTestTwo - sTestOne; // ATE: Increase odds of NOT dropping an UNDROPPABLE OBJECT if ( (this->inv[HANDPOS].fFlags & OBJECT_UNDROPPABLE) ) @@ -10768,7 +10768,7 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Chance To Drop Weapon: str: %d Dam: %d Chance: %d", sTestOne, sTestTwo, sChanceToDrop ); #endif - if ( Random( 100 ) < (UINT16)sChanceToDrop ) + if ((INT16)Random(100) < sChanceToDrop) { dropiteminmainhand = true; }