From 7a537c3a2e4f499bc31ed94d8cfae2aefa32fadd Mon Sep 17 00:00:00 2001 From: Flugente Date: Sat, 24 Feb 2018 20:45:27 +0000 Subject: [PATCH] Fix: soldier automatically taunts us whenever we steal, making stealth impossible git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8526 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Weapons.cpp | 45 +++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 5703c95d..fabd2f62 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -3508,12 +3508,14 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo, BOOLEAN fStea // otherwise, if we are the player, we can steal multiple items if the other guy is collapsed, or we are succesful, and // if using fEnhancedCloseCombatSystem, only allow this if the other guy is not alerted if ( AllowedToStealFromTeamMate(pSoldier->ubID, pTargetSoldier->ubID) || - pSoldier->bTeam == gbPlayerNum && + ( pSoldier->bTeam == gbPlayerNum && ( fSoldierCollapsed || ( iDiceRoll < ( iHitChance * 2 / 3 ) && - !gGameExternalOptions.fEnhancedCloseCombatSystem || - pSoldier->aiData.bAlertStatus < STATUS_RED ) ) ) + ( !gGameExternalOptions.fEnhancedCloseCombatSystem || + pTargetSoldier->aiData.bAlertStatus < STATUS_RED ) ) ) ) ) { + fStealAttempt = TRUE; + // first, charge extra Aps, because it's difficlut to pickup from other soldier if (gGameExternalOptions.fEnhancedCloseCombatSystem) DeductPoints( pSoldier, (GetBasicAPsToPickupItem( pSoldier ) * 2), 0, AFTERACTION_INTERRUPT ); @@ -3778,8 +3780,11 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo, BOOLEAN fStea StatChange( pSoldier, AGILAMT, 3, FALSE ); } - // anv: enemy taunt on getting robbed - PossiblyStartEnemyTaunt( pTargetSoldier, TAUNT_GOT_ROBBED, pSoldier->ubID ); + if ( !fStealAttempt || pTargetSoldier->aiData.bAlertStatus >= STATUS_RED ) + { + // anv: enemy taunt on getting robbed + PossiblyStartEnemyTaunt( pTargetSoldier, TAUNT_GOT_ROBBED, pSoldier->ubID ); + } } else { @@ -3801,20 +3806,23 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo, BOOLEAN fStea } } - // SANDRO - Enhanced Close Combat System - Notice merc after stealing - // sevenfm: don't turn when lying prone - if (gGameExternalOptions.fEnhancedCloseCombatSystem && gAnimControl[ pTargetSoldier->usAnimState ].ubEndHeight != ANIM_PRONE) - pTargetSoldier->EVENT_SetSoldierDesiredDirection( GetDirectionFromGridNo( pSoldier->sGridNo, pTargetSoldier ) ); + // Flugente: no turning if the other guy doesn't notice us... + if ( fFailure || !fStealAttempt || pTargetSoldier->aiData.bAlertStatus >= STATUS_RED ) + { + // SANDRO - Enhanced Close Combat System - Notice merc after stealing + // sevenfm: don't turn when lying prone + if ( gGameExternalOptions.fEnhancedCloseCombatSystem && gAnimControl[pTargetSoldier->usAnimState].ubEndHeight != ANIM_PRONE ) + pTargetSoldier->EVENT_SetSoldierDesiredDirection( GetDirectionFromGridNo( pSoldier->sGridNo, pTargetSoldier ) ); - // 0verhaul: Also handled in the animation transition - // #ifdef JA2BETAVERSION - // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - steal") ); - // #endif - // FreeUpAttacker( (UINT8) pSoldier->ubID ); - - // anv: enemy taunt on steal - PossiblyStartEnemyTaunt( pSoldier, TAUNT_STEAL, pTargetSoldier->ubID ); + // 0verhaul: Also handled in the animation transition + // #ifdef JA2BETAVERSION + // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - steal") ); + // #endif + // FreeUpAttacker( (UINT8) pSoldier->ubID ); + // anv: enemy taunt on steal + PossiblyStartEnemyTaunt( pSoldier, TAUNT_STEAL, pTargetSoldier->ubID ); + } } // ----------------------------------- @@ -4047,8 +4055,7 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo, BOOLEAN fStea { pSoldier->aiData.bMonsterSmell--; } - - + return( TRUE ); }