From 30cc0160cf906261bc64adbc14ece22cd62a85e6 Mon Sep 17 00:00:00 2001 From: Kriplo Date: Tue, 17 Sep 2013 11:33:47 +0000 Subject: [PATCH] Brief: //dnl ch70 - Some APs fixing for throwing knives and backpack, with doing some correction to my previous changes. Details: - Do some correction and missing parts to ch58 and ch69. - Throwing knives will add you bonus for throwing knives to same target as was suppose from v1.12 but never works. - Fix AI use gun calculation for throwing knives instead for throw. - Fix incorrect showing and deducting APs when try to shoot from prone with backpack or throw from prone and crouch positions with turning in general. - Fix cheating when sLastTarget is set just for raise gun in that direction, this was always done after you fire. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6409 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Handle UI.cpp | 2 +- Tactical/Points.cpp | 16 +++++----- Tactical/Soldier Control.cpp | 61 +++++++++++++++++++++++++++++++++--- Tactical/Weapons.cpp | 11 ++++--- TacticalAI/Attacks.cpp | 20 ++++++------ 5 files changed, 83 insertions(+), 27 deletions(-) diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index ef2f7e6b..dfa7a43b 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -5118,7 +5118,7 @@ BOOLEAN MakeSoldierTurn( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos ) // Setting "Last Target" - pSoldier->sLastTarget = sXPos + (MAXCOL * sYPos); + //pSoldier->sLastTarget = sXPos + (MAXCOL * sYPos);//dnl ch70 160913 when you turn you will lost target, it was always been like that! // SANDRO - get BP cost for weapon manipulating if ( gGameExternalOptions.ubEnergyCostForWeaponWeight) diff --git a/Tactical/Points.cpp b/Tactical/Points.cpp index c47310c4..e3092c46 100644 --- a/Tactical/Points.cpp +++ b/Tactical/Points.cpp @@ -37,6 +37,7 @@ #include "opplist.h" // added by SANDRO #include "lighting.h" // added by SANDRO #include "Food.h" // added by Flugente + #include "AIInternals.h"//dnl ch69 150913 #endif #include "connect.h" //rain @@ -3027,15 +3028,15 @@ INT16 GetAPsToChangeStance( SOLDIERTYPE *pSoldier, INT8 bDesiredHeight ) } if ( bCurrentHeight == ANIM_CROUCH && bDesiredHeight == ANIM_STAND ) { - sAPCost = GetAPsCrouch(pSoldier, TRUE); + sAPCost = GetAPsCrouch(pSoldier, TRUE*2);//dnl ch70 160913 } if ( bCurrentHeight == ANIM_PRONE && bDesiredHeight == ANIM_STAND ) { - sAPCost = GetAPsProne(pSoldier, TRUE) + GetAPsCrouch(pSoldier, TRUE); + sAPCost = GetAPsProne(pSoldier, TRUE*2) + GetAPsCrouch(pSoldier, TRUE*2);//dnl ch70 160913 } if ( bCurrentHeight == ANIM_PRONE && bDesiredHeight == ANIM_CROUCH ) { - sAPCost = GetAPsProne(pSoldier, TRUE); + sAPCost = GetAPsProne(pSoldier, TRUE*2);//dnl ch70 160913 } return( sAPCost ); @@ -3106,10 +3107,11 @@ INT16 GetAPsToLook( SOLDIERTYPE *pSoldier ) case ANIM_PRONE: // APBPConstants[AP_PRONE] is the AP cost to go to or from the prone stance. To turn while prone, your merc has to get up to // crouched, turn, and then go back down. Hence you go up (APBPConstants[AP_PRONE]), turn (APBPConstants[AP_LOOK_PRONE]) and down (APBPConstants[AP_PRONE]). + //dnl ch70 160913 because of backpack cost for going up is 2 if (HAS_SKILL_TRAIT( pSoldier, MARTIAL_ARTS_NT ) && gGameOptions.fNewTraitSystem ) - return( max( 1, (INT16)((APBPConstants[AP_LOOK_PRONE] * (100 - gSkillTraitValues.ubMAApsTurnAroundReduction * NUM_SKILL_TRAITS( pSoldier, MARTIAL_ARTS_NT )) / 100) + 0.5)) + GetAPsProne(pSoldier, TRUE) + GetAPsProne(pSoldier, TRUE) ); + return( max( 1, (INT16)((APBPConstants[AP_LOOK_PRONE] * (100 - gSkillTraitValues.ubMAApsTurnAroundReduction * NUM_SKILL_TRAITS( pSoldier, MARTIAL_ARTS_NT )) / 100) + 0.5)) + GetAPsProne(pSoldier, TRUE) + GetAPsProne(pSoldier, TRUE*2) ); else - return( APBPConstants[AP_LOOK_PRONE] + GetAPsProne(pSoldier, TRUE) + GetAPsProne(pSoldier, TRUE) ); + return( APBPConstants[AP_LOOK_PRONE] + GetAPsProne(pSoldier, TRUE) + GetAPsProne(pSoldier, TRUE*2) ); break; // no other values should be possible @@ -3922,7 +3924,7 @@ INT16 GetAPsCrouch( SOLDIERTYPE *pSoldier, BOOLEAN fBackpackCheck ) // if backpack and new inventory if ( fBackpackCheck && (UsingNewInventorySystem() == true) && pSoldier->inv[BPACKPOCKPOS].exists() == true && !pSoldier->flags.ZipperFlag) - iFinalAPsToCrouch += 1; + iFinalAPsToCrouch += fBackpackCheck;//dnl ch70 160913 was 1 // -x% APs needed to change stance for MA trait if ( HAS_SKILL_TRAIT( pSoldier, MARTIAL_ARTS_NT ) && ( gGameOptions.fNewTraitSystem )) @@ -3942,7 +3944,7 @@ INT16 GetAPsProne( SOLDIERTYPE *pSoldier, BOOLEAN fBackpackCheck ) // if backpack and new inventory if ( fBackpackCheck && (UsingNewInventorySystem() == true) && pSoldier->inv[BPACKPOCKPOS].exists() == true && !pSoldier->flags.ZipperFlag) - iFinalAPsToLieDown += 1; + iFinalAPsToLieDown += fBackpackCheck;//dnl ch70 160913 was 1 // -x% APs needed to change stance for MA trait if ( HAS_SKILL_TRAIT( pSoldier, MARTIAL_ARTS_NT ) && ( gGameOptions.fNewTraitSystem )) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 43ad7c8a..98db1761 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -114,6 +114,7 @@ class OBJECTTYPE; class SOLDIERTYPE; +UINT16 usForceAnimState = INVALID_ANIMATION;//dnl ch70 170913 //turnspeed //UINT8 gubPlayerTurnSpeedUpFactor = 1; @@ -3663,7 +3664,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart { // ATE: Also check for the transition anims to not reset this // this should have used a flag but we're out of them.... - if ( usNewState != READY_ALTERNATIVE_STAND && usNewState != READY_RIFLE_STAND && usNewState != READY_RIFLE_PRONE && usNewState != READY_RIFLE_CROUCH && usNewState != ROBOT_SHOOT && usNewState != TANK_SHOOT && usNewState != TANK_BURST )//dnl ch64 300813 + if ( usNewState != READY_ALTERNATIVE_STAND && usNewState != READY_RIFLE_STAND && usNewState != READY_RIFLE_PRONE && usNewState != READY_RIFLE_CROUCH && usNewState != ROBOT_SHOOT && usNewState != TANK_SHOOT && usNewState != TANK_BURST && usNewState != THROW_KNIFE && usNewState != THROW_KNIFE_SP_BM && this->usAnimState != THROW_KNIFE && this->usAnimState != THROW_KNIFE_SP_BM )//dnl ch64 300813 //dnl ch70 170913 { this->sLastTarget = NOWHERE; } @@ -3800,6 +3801,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart { // CHRISL // SANDRO - APBPConstants[AP_CROUCH] changed to GetAPsCrouch() +#if 0//dnl ch70 160913 this is wrong we cannot just add constants to sAPCost this must be done in GetAPsCrouch and GetAPsProne because all preactions calculation will show incorrect values under cursor if((UsingNewInventorySystem() == true) && FindBackpackOnSoldier( this ) != ITEM_NOT_FOUND && !this->flags.ZipperFlag) { if(usNewState == KNEEL_UP || usNewState == BIGMERC_CROUCH_TRANS_OUTOF) @@ -3823,6 +3825,26 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart sAPCost=GetAPsCrouch(this, FALSE); sBPCost=APBPConstants[BP_CROUCH]; } +#else + if(UsingNewInventorySystem()) + { + if(usNewState == KNEEL_UP || usNewState == BIGMERC_CROUCH_TRANS_OUTOF) + { + sAPCost=GetAPsCrouch(this, TRUE*2); + sBPCost=APBPConstants[BP_CROUCH]+2; + } + else + { + sAPCost=GetAPsCrouch(this, TRUE); + sBPCost=APBPConstants[BP_CROUCH]+1; + } + } + else + { + sAPCost=GetAPsCrouch(this, FALSE); + sBPCost=APBPConstants[BP_CROUCH]; + } +#endif DeductPoints( this, sAPCost, sBPCost ); } this->flags.fDontChargeAPsForStanceChange = FALSE; @@ -3839,6 +3861,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart if ( this->sGridNo == this->pathing.sFinalDestination || this->pathing.usPathIndex == 0 ) { // CHRISL +#if 0//dnl ch70 160913 this is wrong we cannot just add constants to sAPCost this must be done in GetAPsCrouch and GetAPsProne because all preactions calculation will show incorrect values under cursor if((UsingNewInventorySystem() == true) && FindBackpackOnSoldier( this ) != ITEM_NOT_FOUND && !this->flags.ZipperFlag) { if(usNewState == PRONE_UP) @@ -3857,6 +3880,26 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart sAPCost=GetAPsProne(this, FALSE); sBPCost=APBPConstants[BP_PRONE]; } +#else + if(UsingNewInventorySystem()) + { + if(usNewState == PRONE_UP) + { + sAPCost=GetAPsProne(this, TRUE*2); + sBPCost=APBPConstants[BP_PRONE]+2; + } + else + { + sAPCost=GetAPsProne(this, TRUE); + sBPCost=APBPConstants[BP_PRONE]+1; + } + } + else + { + sAPCost=GetAPsProne(this, FALSE); + sBPCost=APBPConstants[BP_PRONE]; + } +#endif DeductPoints( this, sAPCost, sBPCost ); } } @@ -7180,7 +7223,7 @@ void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT8 ubNe if ( pSoldier->pathing.bDesiredDirection != pSoldier->ubDirection ) { - if ( gAnimControl[ usAnimState ].uiFlags & ( ANIM_BREATH | ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_FIREREADY ) && !fInitalMove && !pSoldier->flags.fDontChargeTurningAPs ) + if ( (gAnimControl[ usAnimState ].uiFlags & ( ANIM_BREATH | ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_FIREREADY ) || usForceAnimState != INVALID_ANIMATION) && !fInitalMove && !pSoldier->flags.fDontChargeTurningAPs )//dnl ch70 160913 { // SANDRO: hey, we have a function for this around, why not to use it, hm? // silversurfer: we better don't do that. GetAPsToLook( ... ) will charge APs for getting to crouched/prone position @@ -7188,7 +7231,7 @@ void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT8 ubNe // SANDRO: I see. Thanks. // DeductPoints( pSoldier, GetAPsToLook( pSoldier ), 0 ); // Deduct points for initial turn! - switch( gAnimControl[ usAnimState ].ubEndHeight ) + switch( gAnimControl[ (usForceAnimState != INVALID_ANIMATION ? usForceAnimState : usAnimState) ].ubEndHeight )//dnl ch70 160913 { // Now change to appropriate animation case ANIM_STAND: @@ -7214,6 +7257,8 @@ void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT8 ubNe iBPCost = 0; DeductPoints( pSoldier, sAPCost, iBPCost ); + if(usForceAnimState != INVALID_ANIMATION)//dnl ch70 170913 + pSoldier->flags.fDontUnsetLastTargetFromTurn = FALSE; } pSoldier->flags.fDontChargeTurningAPs = FALSE; @@ -12149,10 +12194,18 @@ void SOLDIERTYPE::EVENT_SoldierBeginKnifeThrowAttack( INT32 sGridNo, UINT8 ubDir this->EVENT_InitNewSoldierAnim( THROW_KNIFE, 0 , FALSE ); } + //dnl ch70 160913 ugly but fast fix for not charging turning APs as there is no fire ready animation for throwing knives and I don't want to break SOLDIERTYPE just for that + if(this->usAnimState == THROW_KNIFE || this->usAnimState == THROW_KNIFE_SP_BM) + usForceAnimState = this->usAnimState; + else if(this->usPendingAnimation == THROW_KNIFE || this->usPendingAnimation == THROW_KNIFE_SP_BM) + usForceAnimState = this->usPendingAnimation; + else + usForceAnimState = INVALID_ANIMATION; + this->flags.fDontUnsetLastTargetFromTurn = TRUE; // CHANGE DIRECTION AND GOTO ANIMATION NOW this->EVENT_SetSoldierDesiredDirection( ubDirection ); this->EVENT_SetSoldierDirection( ubDirection ); - + usForceAnimState = INVALID_ANIMATION; // SET TARGET GRIDNO this->sTargetGridNo = sGridNo; diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 1df70ec9..530d9005 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -8791,18 +8791,21 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, UINT32 AICalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, UINT8 ubAimPos, INT8 bTargetLevel, UINT16 usAnimState)//dnl ch59 180813 { INT8 bTrueLevel;//dnl ch59 180813 if target is above ground CalcChanceToHitGun will return 0 because pSoldier->bTargetLevel contains some old values from previous target which was on ground level - UINT16 usTrueState; - UINT32 uiChance; + UINT16 usTrueState; + UINT32 uiChance; // same as CCTHG but fakes the attacker always standing usTrueState = pSoldier->usAnimState; bTrueLevel = pSoldier->bTargetLevel; pSoldier->bTargetLevel = bTargetLevel; pSoldier->usAnimState = usAnimState; - uiChance = CalcChanceToHitGun( pSoldier, sGridNo, ubAimTime, ubAimPos ); + if(Item[pSoldier->usAttackingWeapon].usItemClass & IC_THROWING_KNIFE)//dnl ch70 160913 + uiChance = CalcThrownChanceToHit(pSoldier, sGridNo, ubAimTime, ubAimPos); + else + uiChance = CalcChanceToHitGun(pSoldier, sGridNo, ubAimTime, ubAimPos); pSoldier->usAnimState = usTrueState; pSoldier->bTargetLevel = bTrueLevel; - if(UsingNewCTHSystem() == true) + if(UsingNewCTHSystem() == true && !(Item[pSoldier->usAttackingWeapon].usItemClass & IC_THROWING_KNIFE))//dnl ch70 160913 { //////////////////////////////////////////////////////////////////////////////////// // HEADROCK HAM 4: NCTH calculation diff --git a/TacticalAI/Attacks.cpp b/TacticalAI/Attacks.cpp index 18af1dd5..94ef38ab 100644 --- a/TacticalAI/Attacks.cpp +++ b/TacticalAI/Attacks.cpp @@ -449,6 +449,8 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns // consider alternate holding mode and different scopes for(pSoldier->bScopeMode=(gGameExternalOptions.ubAllowAlternativeWeaponHolding?USE_ALT_WEAPON_HOLD:USE_BEST_SCOPE); pSoldier->bScopeMode<=(gGameExternalOptions.fScopeModes?NUM_SCOPE_MODES-1:USE_BEST_SCOPE); pSoldier->bScopeMode++) { + if(pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD && (Item[pSoldier->usAttackingWeapon].usItemClass & IC_THROWING_KNIFE)) + continue; if(pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD || (pSoldier->bScopeMode >= USE_BEST_SCOPE && ObjList[pSoldier->bScopeMode] != NULL)) { usTrueState = pSoldier->usAnimState;// because is used in CalculateRaiseGunCost, CalcAimingLevelsAvailableWithAP, CalculateTurningCost @@ -467,18 +469,16 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns usRaiseGunCost = CalculateRaiseGunCost(pSoldier, fAddingRaiseGunCost, pOpponent->sGridNo, 0); ubRawAPCost = MinAPsToShootOrStab(pSoldier, pOpponent->sGridNo, 0, FALSE, 2); ubMinAPcost = ubRawAPCost + usTurningCost + sStanceAPcost + usRaiseGunCost; - //ubMinAPcost = MinAPsToAttack(pSoldier, pOpponent->sGridNo, ADDTURNCOST, 0) + sStanceAPcost; if(pSoldier->bActionPoints-ubMinAPcost >= 0) { // calc next attack's minimum shooting cost (excludes readying & turning & raise gun) - //ubRawAPCost = MinAPsToShootOrStab(pSoldier, pOpponent->sGridNo, 0, FALSE, 2); ubMaxPossibleAimTime = CalcAimingLevelsAvailableWithAP(pSoldier, pOpponent->sGridNo, pSoldier->bActionPoints-ubMinAPcost); for(ubAimTime=APBPConstants[AP_MIN_AIM_ATTACK]; ubAimTime<=ubMaxPossibleAimTime; ubAimTime++) { ubChanceToHit = AICalcChanceToHitGun(pSoldier, pOpponent->sGridNo, ubAimTime, AIM_SHOT_TORSO, pOpponent->pathing.bLevel, STANDING); iHitRate = ((pSoldier->bActionPoints - (ubMinAPcost - ubRawAPCost)) * ubChanceToHit) / (ubRawAPCost + ubAimTime * APBPConstants[AP_CLICK_AIM]); //SendFmtMsg("CalcBestShot_S=%d hr=%d at=%d sm=%d op=%d/%d aps=%d,%d,%d,%d,%d", ubChanceToHit, iHitRate, ubAimTime, pSoldier->bScopeMode, pOpponent->ubID, pOpponent->sGridNo, ubMinAPcost, ubRawAPCost, sStanceAPcost, usTurningCost, usRaiseGunCost); - if(iHitRate > iBestHitRate) + if(iHitRate > iBestHitRate || (Item[pSoldier->usAttackingWeapon].usItemClass & IC_THROWING_KNIFE) && ubChanceToHit > ubBestChanceToHit)// rather take best chance for throwing knives { iBestHitRate = iHitRate; ubBestAimTime = ubAimTime; @@ -492,8 +492,10 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns pSoldier->usAnimState = usTrueState; pSoldier->sLastTarget = iTrueLastTarget; } + if(pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD || TANK(pSoldier) || (Item[pSoldier->usAttackingWeapon].usItemClass & IC_THROWING_KNIFE)) + continue; ubStance = ANIM_CROUCH; - if(IsValidStance(pSoldier, ubStance) && pSoldier->bScopeMode != USE_ALT_WEAPON_HOLD) + if(IsValidStance(pSoldier, ubStance)) { usTurningCost = 32767; if(gAnimControl[pSoldier->usAnimState].ubEndHeight > ubStance)// Going down @@ -516,10 +518,8 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns usRaiseGunCost = CalculateRaiseGunCost(pSoldier, fAddingRaiseGunCost, pOpponent->sGridNo, 0); ubRawAPCost = MinAPsToShootOrStab(pSoldier, pOpponent->sGridNo, 0, FALSE, 2); ubMinAPcost = ubRawAPCost + usTurningCost + sStanceAPcost + usRaiseGunCost; - //ubMinAPcost = MinAPsToAttack(pSoldier, pOpponent->sGridNo, ADDTURNCOST, 0) + sStanceAPcost; if(pSoldier->bActionPoints-ubMinAPcost >= 0) { - //ubRawAPCost = MinAPsToShootOrStab(pSoldier, pOpponent->sGridNo, 0, FALSE, 2); ubMaxPossibleAimTime = CalcAimingLevelsAvailableWithAP(pSoldier, pOpponent->sGridNo, pSoldier->bActionPoints-ubMinAPcost); for(ubAimTime=APBPConstants[AP_MIN_AIM_ATTACK]; ubAimTime<=ubMaxPossibleAimTime; ubAimTime++) { @@ -541,7 +541,7 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns pSoldier->sLastTarget = iTrueLastTarget; } ubStance = ANIM_PRONE; - if(IsValidStance(pSoldier, ubStance) && pSoldier->bScopeMode != USE_ALT_WEAPON_HOLD) + if(IsValidStance(pSoldier, ubStance)) { GetAPChargeForShootOrStabWRTGunRaises(pSoldier, pOpponent->sGridNo, TRUE, &fAddingTurningCost, &fAddingRaiseGunCost, 0); usTurningCost = CalculateTurningCost(pSoldier, pSoldier->usAttackingWeapon, fAddingTurningCost); @@ -555,10 +555,8 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns usRaiseGunCost = CalculateRaiseGunCost(pSoldier, fAddingRaiseGunCost, pOpponent->sGridNo, 0); ubRawAPCost = MinAPsToShootOrStab(pSoldier, pOpponent->sGridNo, 0, FALSE, 2); ubMinAPcost = ubRawAPCost + usTurningCost + sStanceAPcost + usRaiseGunCost; - //ubMinAPcost = MinAPsToAttack(pSoldier, pOpponent->sGridNo, ADDTURNCOST, 0) + sStanceAPcost; if(pSoldier->bActionPoints-ubMinAPcost >= 0) { - //ubRawAPCost = MinAPsToShootOrStab(pSoldier, pOpponent->sGridNo, 0, FALSE, 2); ubMaxPossibleAimTime = CalcAimingLevelsAvailableWithAP(pSoldier, pOpponent->sGridNo, pSoldier->bActionPoints-ubMinAPcost); for(ubAimTime=APBPConstants[AP_MIN_AIM_ATTACK]; ubAimTime<=ubMaxPossibleAimTime; ubAimTime++) { @@ -594,7 +592,7 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns continue; // next opponent // really limit knife throwing so it doesn't look wrong - if ( Item[ pSoldier->usAttackingWeapon ].usItemClass == IC_THROWING_KNIFE && (ubChanceToReallyHit < 30 || ( PythSpacesAway( pSoldier->sGridNo, pOpponent->sGridNo ) > CalcMaxTossRange( pSoldier, pSoldier->usAttackingWeapon, FALSE ) )))// Madd / 2 ) ) ) + if ( Item[ pSoldier->usAttackingWeapon ].usItemClass == IC_THROWING_KNIFE && (ubChanceToReallyHit < 25 || ( PythSpacesAway( pSoldier->sGridNo, pOpponent->sGridNo ) > CalcMaxTossRange( pSoldier, pSoldier->usAttackingWeapon, FALSE ) )))// Madd / 2 ) ) ) //dnl ch69 160913 was ubChanceToReallyHit < 30 continue; // don't bother... next opponent // calculate this opponent's threat value (factor in my cover from him) @@ -1477,7 +1475,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) default: break; } - +//if(pBestThrow->ubPossible)SendFmtMsg("CalcBestThrow;\r\n ID=%d Loc=%d APs=%d Ac=%d AcData=%d Al=%d, SM=%d, LAc=%d, NAc=%d AT=%d\r\n AP?=%d,%d,%d/%d BS=%d", pSoldier->ubID, pSoldier->sGridNo, pSoldier->bActionPoints, pSoldier->aiData.bAction, pSoldier->aiData.usActionData, pSoldier->aiData.bAlertStatus, pBestThrow->bScopeMode, pSoldier->aiData.bLastAction, pSoldier->aiData.bNextAction, pBestThrow->ubAimTime, pBestThrow->ubAPCost, CalcAPCostForAiming(pSoldier, pBestThrow->sTarget, (INT8)pBestThrow->ubAimTime), CalcTotalAPsToAttack(pSoldier, pBestThrow->sTarget, TRUE, pBestThrow->ubAimTime), CalcTotalAPsToAttack(pSoldier, pBestThrow->sTarget, FALSE, pBestThrow->ubAimTime), pBestThrow->ubStance); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"calcbestthrow done"); }