mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
Added new soldier flags: SOLDIER_BACK_ATTACK, SOLDIER_SNEAK_ATTACK (work for punch and stab attacks only).
ClosestKnownOpponent() now can return ID of closest opponent. CalcCoverValue: improved code to avoid friendly fire. EVENT_SoldierBeginPunchAttack: use supplied gridno as sTargetGridNo may not be set yet Boxing: - added possibility of counterattack after failed attack - added possibility of opportunity attack a passing enemy - bonus in CTH for boxers for attack from the back Boxing AI: - for boxers, always use high morale so that they attack - cautious boxer approach, reserve AP for two attacks (only if not attacking from the back) - try to avoid frontal attack - sometimes boxer may decide to restore breath instead of moving and attacking - boxer can step back to move away from opponent, if he is low on breath - improved main boxer AI git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8876 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+10
-1
@@ -1385,7 +1385,7 @@ INT32 ClosestReachableDisturbance(SOLDIERTYPE *pSoldier, BOOLEAN * pfChangeLevel
|
||||
}
|
||||
|
||||
|
||||
INT32 ClosestKnownOpponent(SOLDIERTYPE *pSoldier, INT32 * psGridNo, INT8 * pbLevel)
|
||||
INT32 ClosestKnownOpponent(SOLDIERTYPE *pSoldier, INT32 * psGridNo, INT8 * pbLevel, UINT8 *pubOpponentID)
|
||||
{
|
||||
INT32 *psLastLoc,sGridNo, sClosestOpponent = NOWHERE;
|
||||
UINT32 uiLoop;
|
||||
@@ -1397,6 +1397,11 @@ INT32 ClosestKnownOpponent(SOLDIERTYPE *pSoldier, INT32 * psGridNo, INT8 * pbLev
|
||||
|
||||
bClosestLevel = -1;
|
||||
|
||||
if (pubOpponentID)
|
||||
{
|
||||
*pubOpponentID = NOBODY;
|
||||
}
|
||||
|
||||
// NOTE: THIS FUNCTION ALLOWS RETURN OF UNCONSCIOUS AND UNREACHABLE OPPONENTS
|
||||
psLastLoc = &(gsLastKnownOppLoc[pSoldier->ubID][0]);
|
||||
|
||||
@@ -1500,6 +1505,10 @@ INT32 ClosestKnownOpponent(SOLDIERTYPE *pSoldier, INT32 * psGridNo, INT8 * pbLev
|
||||
{
|
||||
*pbLevel = bClosestLevel;
|
||||
}
|
||||
if (pubOpponentID && pClosestOpponent)
|
||||
{
|
||||
*pubOpponentID = pClosestOpponent->ubID;
|
||||
}
|
||||
return( sClosestOpponent );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user