19 #ifndef OPENXCOM_ALIENBAISTATE_H
20 #define OPENXCOM_ALIENBAISTATE_H
22 #include "BattleAIState.h"
29 class SavedBattleGame;
31 class BattlescapeState;
41 int _knownEnemies, _visibleEnemies, _spottingEnemies;
42 int _escapeTUs, _ambushTUs, _reserveTUs;
43 BattleAction *_escapeAction, *_ambushAction, *_attackAction, *_patrolAction, *_psiAction;
44 bool _rifle, _melee, _blaster;
45 bool _traceAI, _wasHit, _didPsi;
46 int _AIMode, _intelligence, _closestDist;
47 Node *_fromNode, *_toNode;
48 std::vector<int> _reachable, _reachableWithAttack;
55 void load(
const YAML::Node& node);
57 YAML::Node
save()
const;
108 bool validTarget(
BattleUnit* unit,
bool assessDanger,
bool includeCivs)
const;
Definition: BattlescapeGame.h:45
YAML::Node save() const
Saves the AI state to YAML.
Definition: AlienBAIState.cpp:104
bool selectRandomTarget()
Selects a random known target.
Definition: AlienBAIState.cpp:1086
void meleeAction()
Attempts to take a melee attack/charge an enemy we can see.
Definition: AlienBAIState.cpp:1562
int countKnownTargets() const
count how many xcom/civilian units are known to this unit.
Definition: AlienBAIState.cpp:956
void setupPatrol()
setup a patrol objective.
Definition: AlienBAIState.cpp:413
void setupAttack()
setup a combat objective.
Definition: AlienBAIState.cpp:682
void wayPointAction()
Attempts to fire a waypoint projectile at an enemy we, or one of our teammates sees.
Definition: AlienBAIState.cpp:1611
int getSpottingUnits(Position pos) const
count how many known XCom units are able to see this unit.
Definition: AlienBAIState.cpp:974
This class is used by the BattleUnit AI.
Definition: BattleAIState.h:35
bool psiAction()
Performs a psionic attack.
Definition: AlienBAIState.cpp:1803
void setWasHit()
Sets the "unit was hit" flag true.
Definition: AlienBAIState.cpp:395
bool getWasHit() const
Gets whether the unit was hit.
Definition: AlienBAIState.cpp:404
void grenadeAction()
Attempts to throw a grenade at an enemy (or group of enemies) we can see.
Definition: AlienBAIState.cpp:1762
void think(BattleAction *action)
Runs state functionality every AI cycle.
Definition: AlienBAIState.cpp:142
bool selectPointNearTarget(BattleUnit *target, int maxTUs) const
Selects the nearest reachable point relative to a target.
Definition: AlienBAIState.cpp:1112
void selectFireMethod()
Selects a fire method.
Definition: AlienBAIState.cpp:1698
void meleeAttack()
Performs a melee attack action.
Definition: AlienBAIState.cpp:1906
bool explosiveEfficacy(Position targetPos, BattleUnit *attackingUnit, int radius, int diff, bool grenade=false) const
Decides if we should throw a grenade/launch a missile to this position.
Definition: AlienBAIState.cpp:1473
void evaluateAIMode()
re-evaluate our situation, and make a decision from our available options.
Definition: AlienBAIState.cpp:1154
~AlienBAIState()
Cleans up the AlienBAIState.
Definition: AlienBAIState.cpp:70
AlienBAIState(SavedBattleGame *save, BattleUnit *unit, Node *node)
Creates a new AlienBAIState linked to the game and a certain unit.
Definition: AlienBAIState.cpp:53
bool findFirePoint()
Selects a suitable position from which to attack.
Definition: AlienBAIState.cpp:1397
This class is used by the BattleUnit AI.
Definition: AlienBAIState.h:37
void setupAmbush()
setup an ambush objective.
Definition: AlienBAIState.cpp:567
The battlescape data that gets written to disk when the game is saved.
Definition: SavedBattleGame.h:50
Represents a node/spawnpoint in the battlescape, loaded from RMP files.
Definition: Node.h:34
void enter()
Enters the state.
Definition: AlienBAIState.cpp:123
void projectileAction()
Attempts to fire at an enemy we can see.
Definition: AlienBAIState.cpp:1685
Easy handling of X-Y-Z coordinates.
Definition: Position.h:30
void load(const YAML::Node &node)
Loads the AI state from YAML.
Definition: AlienBAIState.cpp:83
void setupEscape()
setup an escape objective.
Definition: AlienBAIState.cpp:757
Represents a moving unit in the battlescape, player controlled or AI controlled it holds info about i...
Definition: BattleUnit.h:58
void exit()
Exits the state.
Definition: AlienBAIState.cpp:133
int selectNearestTarget()
Selects the nearest target we can see, and return the number of viable targets.
Definition: AlienBAIState.cpp:1012
bool selectClosestKnownEnemy()
Selects the closest known xcom unit for ambushing.
Definition: AlienBAIState.cpp:1063