Open RedDoby opened 5 years ago
I volunteer to make a PR for this...
Just for consistency, you may want to use a Player Check instead of Team (since maybe multi-player will support this?) when checking for XCom here in GetAbsoluteKnowledgeUnitList: if (EnemyPlayerState.GetTeam() == ETeam_XCom)
Continuing a discussion from discord, this is a list of every usage of GetEnemyPlayer()
in the base game, in case a new usage of GetEnemyPlayers
to accommodate additional teams may also be wanted to improve on the eTeam_One/eTeam_Two functionality while we're making sure the game knows how to accomodate the additional teams for the AI:
In UIMissionSummary
, when checking multiplayer stats (so no need to alter it)
In X2AIBTDefaultConditions
:
In the function HasUnconcealedEnemies
. Concealment only works properly with XCOM IIRC and it's unused in the base game as far as I can tell.
In the function HasVisibleCivilianInMoveRange
, used for Chryssalid AI when determining when to attack a civilian while XCOM is visible. Candidate for being upgraded to use GetEnemyPlayers
instead if we feel like that wouldn't affect potentially balance too much (since this will make Chryssalids more likely to eat civilians if they can see resistance fighters or raiders).
In XComGameState_AIUnitData
, as already covered.
In XGAIBehavior
:
In the function PassesRestriction
, when evaluating the usage of movement types that requires checking for enemy line of sight to a tile.
In the function BT_SetPotentialTargetStack
, when evaluating all known enemies when the game requires a unit to check all enemy units that a team has deployed. However, this is currently only used by the Chosen Warlock when checking if he should end Spectral Army early to extract knowledge or kidnap a soldier.
In the function GetAllKnownEnemyStates
, when the game needs to grab the list of all enemy units if the unit that fired this function doesn't have a XComGameState_AIUnitData
. Judging from other dev comments this tends to happen when a XCOM unit is mind controlled.
In the function GetUnfilteredAoETargetList
, when the game evaluates enemy corpses for an AoE effect.
In the function GetNearestEnemy
, for evaluating the nearest enemy even if there's no Line of Sight. Used to get the Chosen to re-engage the enemy if they're out of sight from everybody else, or as a fallback to GetNearestKnownEnemy
.
In the function CollectUnflankedCoverLocations
, used when, well, getting cover locations that aren't flanked enemies for movement purposes. Specifically, it is used when determining if it can just teleport a pod or if it needs to play proper visualization, so we can ignore this.
In XGAIPlayer
:
In the function QueueScamperBehavior
, used when determining if the game needs to wait on the "Squad concealment broken!" visualization to play before playing the scamper movement.
In the function UpdateValidAndLastResortTargetList
, used for updating all valid and last resort targets an AI player has.
In XGBattle_SP
:
GetEnemySquad
, when...getting the enemy player's squad. This seems to be mainly used in UpdateEnemiesList
in XGAIPlayer
, so rewriting UpdateEnemiesList
directly may be a better idea. As a side note re: XGBattle
's GetEnemySquad
, XGPlayer
calls upon that function as well in a XGSquadNativeBase
event. However as this is an event that's from the native base class XGPlayerNativeBase
, this could be used in a wide variety of places in native code.
Just a note, in GetAbsoluteKnowledgeUnitList
the lost do need to be included as enemy players. Not only is this list used for movement positioning, it's all used for targeting in some cases (one example is melee targeting).
I am sure everyone has noticed this. When the aliens and third parties are in a battle, they get into flanked positions and stand out in the open. I dug into it and found the code that's causing this. With this fix they treat each other as respectable opponents and use cover and normal behavior positioning now. I am not able to send any pull requests so I will just add the pastebin.
Changes to AI Unit Data: https://pastebin.com/UVhKhiiU Changes to Behavior: https://pastebin.com/hUAwKKN7