OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
BattleUnit.h
1 /*
2  * Copyright 2010-2014 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * OpenXcom is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef OPENXCOM_BATTLEUNIT_H
20 #define OPENXCOM_BATTLEUNIT_H
21 
22 #include <vector>
23 #include <string>
24 #include "../Battlescape/Position.h"
25 #include "../Battlescape/BattlescapeGame.h"
26 #include "../Ruleset/RuleItem.h"
27 #include "../Ruleset/Unit.h"
28 #include "../Ruleset/MapData.h"
29 #include "Soldier.h"
30 
31 namespace OpenXcom
32 {
33 
34 class Tile;
35 class BattleItem;
36 class Unit;
37 class BattleAIState;
38 class Node;
39 class Surface;
40 class RuleInventory;
41 class Soldier;
42 class Armor;
43 class SavedGame;
44 class Language;
45 class AlienBAIState;
46 class CivilianBAIState;
47 
48 enum UnitStatus {STATUS_STANDING, STATUS_WALKING, STATUS_FLYING, STATUS_TURNING, STATUS_AIMING, STATUS_COLLAPSING, STATUS_DEAD, STATUS_UNCONSCIOUS, STATUS_PANICKING, STATUS_BERSERK};
49 enum UnitFaction {FACTION_PLAYER, FACTION_HOSTILE, FACTION_NEUTRAL};
50 enum UnitSide {SIDE_FRONT, SIDE_LEFT, SIDE_RIGHT, SIDE_REAR, SIDE_UNDER};
51 enum UnitBodyPart {BODYPART_HEAD, BODYPART_TORSO, BODYPART_RIGHTARM, BODYPART_LEFTARM, BODYPART_RIGHTLEG, BODYPART_LEFTLEG};
52 
53 
59 {
60 private:
61  UnitFaction _faction, _originalFaction;
62  UnitFaction _killedBy;
63  int _id;
64  Position _pos;
65  Tile *_tile;
66  Position _lastPos;
67  int _direction, _toDirection;
68  int _directionTurret, _toDirectionTurret;
69  int _verticalDirection;
70  Position _destination;
71  UnitStatus _status;
72  int _walkPhase, _fallPhase;
73  std::vector<BattleUnit *> _visibleUnits, _unitsSpottedThisTurn;
74  std::vector<Tile *> _visibleTiles;
75  int _tu, _energy, _health, _morale, _stunlevel;
76  bool _kneeled, _floating, _dontReselect;
77  int _currentArmor[5];
78  int _fatalWounds[6];
79  int _fire;
80  std::vector<BattleItem*> _inventory;
81  BattleAIState *_currentAIState;
82  bool _visible;
83  Surface *_cache[5];
84  bool _cacheInvalid;
85  int _expBravery, _expReactions, _expFiring, _expThrowing, _expPsiSkill, _expMelee;
86  int improveStat(int exp);
87  int _motionPoints;
88  int _kills;
89  int _faceDirection; // used only during strafeing moves
90  bool _hitByFire;
91  int _moraleRestored;
92  int _coverReserve;
93  BattleUnit *_charging;
94  int _turnsSinceSpotted;
95  std::string _spawnUnit;
96  std::string _activeHand;
97 
98  // static data
99  std::string _type;
100  std::string _rank;
101  std::string _race;
102  std::wstring _name;
103  UnitStats _stats;
104  int _standHeight, _kneelHeight, _floatHeight;
105  int _value, _deathSound, _aggroSound, _moveSound;
106  int _intelligence, _aggression;
107  SpecialAbility _specab;
108  Armor *_armor;
109  SoldierGender _gender;
110  Soldier *_geoscapeSoldier;
111  std::vector<int> _loftempsSet;
112  Unit *_unitRules;
113  int _rankInt;
114  int _turretType;
115 public:
116  static const int MAX_SOLDIER_ID = 1000000;
118  BattleUnit(Soldier *soldier, UnitFaction faction);
119  BattleUnit(Unit *unit, UnitFaction faction, int id, Armor *armor, int diff);
121  ~BattleUnit();
123  void load(const YAML::Node& node);
125  YAML::Node save() const;
127  int getId() const;
129  void setPosition(const Position& pos, bool updateLastPos = true);
131  const Position& getPosition() const;
133  const Position& getLastPosition() const;
135  void setDirection(int direction);
137  void setFaceDirection(int direction);
139  int getDirection() const;
141  int getFaceDirection() const;
143  int getTurretDirection() const;
145  int getTurretToDirection() const;
147  int getVerticalDirection() const;
149  UnitStatus getStatus() const;
151  void startWalking(int direction, const Position &destination, Tile *tileBelowMe, bool cache);
153  void keepWalking(Tile *tileBelowMe, bool cache);
155  int getWalkingPhase() const;
157  int getDiagonalWalkingPhase() const;
159  const Position &getDestination() const;
161  void lookAt(const Position &point, bool turret = false);
163  void lookAt(int direction, bool force = false);
165  void turn(bool turret = false);
167  void abortTurn();
169  SoldierGender getGender() const;
171  UnitFaction getFaction() const;
173  void setCache(Surface *cache, int part = 0);
175  Surface *getCache(bool *invalid, int part = 0) const;
177  void kneel(bool kneeled);
179  bool isKneeled() const;
181  bool isFloating() const;
183  void aim(bool aiming);
185  int directionTo(const Position &point) const;
187  int getTimeUnits() const;
189  int getEnergy() const;
191  int getHealth() const;
193  int getMorale() const;
195  int damage(const Position &relative, int power, ItemDamageType type, bool ignoreArmor = false);
197  void healStun(int power);
199  int getStunlevel() const;
201  void knockOut(BattlescapeGame *battle);
203  void startFalling();
205  void keepFalling();
207  int getFallingPhase() const;
209  bool isOut() const;
211  int getActionTUs(BattleActionType actionType, BattleItem *item);
213  bool spendTimeUnits(int tu);
215  bool spendEnergy(int tu);
217  void setTimeUnits(int tu);
219  bool addToVisibleUnits(BattleUnit *unit);
221  std::vector<BattleUnit*> *getVisibleUnits();
223  void clearVisibleUnits();
225  bool addToVisibleTiles(Tile *tile);
227  std::vector<Tile*> *getVisibleTiles();
229  void clearVisibleTiles();
231  int getFiringAccuracy(BattleActionType actionType, BattleItem *item);
233  int getAccuracyModifier(BattleItem *item = 0);
235  double getThrowingAccuracy();
237  void setArmor(int armor, UnitSide side);
239  int getArmor(UnitSide side) const;
241  int getFatalWounds() const;
243  double getReactionScore();
245  void prepareNewTurn();
247  void moraleChange(int change);
249  void dontReselect();
251  void allowReselect();
253  bool reselectAllowed() const;
255  void setFire(int fire);
257  int getFire() const;
259  std::vector<BattleItem*> *getInventory();
261  void think(BattleAction *action);
265  void setAIState(BattleAIState *aiState);
267  void setVisible(bool flag);
269  bool getVisible() const;
271  void setTile(Tile *tile, Tile *tileBelow = 0);
273  Tile *getTile() const;
275  BattleItem *getItem(RuleInventory *slot, int x = 0, int y = 0) const;
277  BattleItem *getItem(const std::string &slot, int x = 0, int y = 0) const;
279  BattleItem *getMainHandWeapon(bool quickest = true) const;
283  bool checkAmmo();
285  bool isInExitArea(SpecialTileType stt = START_POINT) const;
287  int getHeight() const;
289  int getFloatHeight() const;
291  void addReactionExp();
293  void addFiringExp();
295  void addThrowingExp();
297  void addPsiExp();
299  void addMeleeExp();
301  void updateGeoscapeStats(Soldier *soldier);
303  bool postMissionProcedures(SavedGame *geoscape);
305  int getMiniMapSpriteIndex () const;
307  void setTurretType(int turretType);
309  int getTurretType() const;
311  int getFatalWound(int part) const;
313  void heal(int part, int woundAmount, int healthAmount);
315  void painKillers ();
317  void stimulant (int energy, int stun);
319  int getMotionPoints() const;
321  Armor *getArmor() const;
323  std::wstring getName(Language *lang, bool debugAppendId = false) const;
325  UnitStats *getStats();
327  int getStandHeight() const;
329  int getKneelHeight() const;
331  int getLoftemps(int entry = 0) const;
333  int getValue() const;
335  int getDeathSound() const;
337  int getMoveSound() const;
339  bool isWoundable() const;
341  bool isFearable() const;
343  int getIntelligence() const;
345  int getAggression() const;
347  int getSpecialAbility() const;
349  void setSpecialAbility(SpecialAbility specab);
351  std::string getRankString() const;
353  Soldier *getGeoscapeSoldier() const;
355  void addKillCount();
357  std::string getType() const;
359  void setActiveHand(const std::string &slot);
361  std::string getActiveHand() const;
363  void convertToFaction(UnitFaction f);
365  void instaKill();
367  std::string getSpawnUnit() const;
369  void setSpawnUnit(std::string spawnUnit);
371  int getAggroSound() const;
373  void setEnergy(int energy);
375  void halveArmor();
377  UnitFaction killedBy() const;
379  void killedBy(UnitFaction f);
381  void setCharging(BattleUnit *chargeTarget);
385  int getCarriedWeight(BattleItem *draggingItem = 0) const;
387  void setTurnsSinceSpotted (int turns);
389  int getTurnsSinceSpotted () const;
391  UnitFaction getOriginalFaction() const;
393  void invalidateCache();
394 
395  Unit *getUnitRules() const { return _unitRules; }
396 
398  bool _hidingForTurn; // don't zone out and start patrolling again
399  Position lastCover;
401  std::vector<BattleUnit *> &getUnitsSpottedThisTurn();
403  void setRankInt(int rank);
405  int getRankInt() const;
407  void deriveRank();
409  bool checkViewSector(Position pos) const;
411  void adjustStats(const int diff);
413  bool tookFireDamage() const;
415  void toggleFireDamage();
416  void setCoverReserve(int reserve);
417  int getCoverReserve() const;
419  bool isSelectable(UnitFaction faction, bool checkReselect, bool checkInventory) const;
421  bool hasInventory() const;
422 };
423 
424 }
425 
426 #endif
int getStunlevel() const
Gets the unit's stun level.
Definition: BattleUnit.cpp:1015
void allowReselect()
Reselect this unit.
Definition: BattleUnit.cpp:1525
std::string getRankString() const
Get the units's rank string.
Definition: BattleUnit.cpp:2293
void addReactionExp()
Adds one to the reaction exp counter.
Definition: BattleUnit.cpp:1853
BattleUnit * getCharging()
Get the units we are charging towards.
Definition: BattleUnit.cpp:2423
int getFallingPhase() const
Get falling sequence.
Definition: BattleUnit.cpp:1082
void setVisible(bool flag)
Set whether this unit is visible.
Definition: BattleUnit.cpp:1606
void lookAt(const Position &point, bool turret=false)
Look at a certain point.
Definition: BattleUnit.cpp:559
void setDirection(int direction)
Sets the unit's direction 0-7.
Definition: BattleUnit.cpp:341
Definition: BattlescapeGame.h:45
bool addToVisibleUnits(BattleUnit *unit)
Add unit to visible units.
Definition: BattleUnit.cpp:1204
int getValue() const
Get the unit's value.
Definition: BattleUnit.cpp:2192
bool postMissionProcedures(SavedGame *geoscape)
Check if unit eligible for squaddie promotion.
Definition: BattleUnit.cpp:1902
int getDeathSound() const
Get the unit's death sound.
Definition: BattleUnit.cpp:2201
SoldierGender getGender() const
Gets the soldier's gender.
Definition: BattleUnit.cpp:698
std::vector< BattleUnit * > * getVisibleUnits()
Get the list of visible units.
Definition: BattleUnit.cpp:1234
std::vector< Tile * > * getVisibleTiles()
Get the list of visible tiles.
Definition: BattleUnit.cpp:1262
int getMoveSound() const
Get the unit's move sound.
Definition: BattleUnit.cpp:2210
Soldier * getGeoscapeSoldier() const
Get the geoscape-soldier object.
Definition: BattleUnit.cpp:2302
int damage(const Position &relative, int power, ItemDamageType type, bool ignoreArmor=false)
Do damage to the unit.
Definition: BattleUnit.cpp:880
bool checkAmmo()
Reloads righthand weapon if needed.
Definition: BattleUnit.cpp:1794
Tile * getTile() const
Gets the unit's tile.
Definition: BattleUnit.cpp:1662
bool tookFireDamage() const
did this unit already take fire damage this turn? (used to avoid damaging large units multiple times...
Definition: BattleUnit.cpp:2603
void deriveRank()
derive a rank integer based on rank string (for xcom soldiers ONLY)
Definition: BattleUnit.cpp:2512
void turn(bool turret=false)
Turn to the destination direction.
Definition: BattleUnit.cpp:610
void aim(bool aiming)
Aim.
Definition: BattleUnit.cpp:776
int getAccuracyModifier(BattleItem *item=0)
Calculate accuracy modifier.
Definition: BattleUnit.cpp:1329
void setTile(Tile *tile, Tile *tileBelow=0)
Sets the unit's tile it's standing on.
Definition: BattleUnit.cpp:1633
void stimulant(int energy, int stun)
Give stimulant to this unit.
Definition: BattleUnit.cpp:2083
int getDirection() const
Gets the unit's direction.
Definition: BattleUnit.cpp:362
The game data that gets written to disk when the game is saved.
Definition: SavedGame.h:80
void setFaceDirection(int direction)
Sets the unit's face direction (only used by strafing moves)
Definition: BattleUnit.cpp:353
std::string getActiveHand() const
Get unit's active hand.
Definition: BattleUnit.cpp:2337
int getIntelligence() const
Get the unit's intelligence.
Definition: BattleUnit.cpp:2239
double getReactionScore()
Get the current reaction score.
Definition: BattleUnit.cpp:1404
int getDiagonalWalkingPhase() const
Gets the walking phase for diagonal walking.
Definition: BattleUnit.cpp:549
void convertToFaction(UnitFaction f)
Convert's unit to a faction.
Definition: BattleUnit.cpp:2348
void heal(int part, int woundAmount, int healthAmount)
Heal one fatal wound.
Definition: BattleUnit.cpp:2053
void clearVisibleUnits()
Clear visible units.
Definition: BattleUnit.cpp:1242
UnitFaction killedBy() const
Get the faction that killed this unit.
Definition: BattleUnit.cpp:2396
int getTurretToDirection() const
Gets the unit's turret To direction.
Definition: BattleUnit.cpp:390
int getEnergy() const
Gets the unit's stamina.
Definition: BattleUnit.cpp:849
void setSpawnUnit(std::string spawnUnit)
Sets the unit's spawn unit.
Definition: BattleUnit.cpp:2284
BattleItem * getGrenadeFromBelt() const
Gets a grenade from the belt, if any.
Definition: BattleUnit.cpp:1778
bool isInExitArea(SpecialTileType stt=START_POINT) const
Check if this unit is in the exit area.
Definition: BattleUnit.cpp:1836
void keepFalling()
Increment the falling sequence.
Definition: BattleUnit.cpp:1057
int getTurretDirection() const
Gets the unit's turret direction.
Definition: BattleUnit.cpp:381
void setTimeUnits(int tu)
Set time units.
Definition: BattleUnit.cpp:1194
void setEnergy(int energy)
Sets the unit's energy level.
Definition: BattleUnit.cpp:2375
bool isWoundable() const
Get whether the unit is affected by fatal wounds.
Definition: BattleUnit.cpp:2221
void setRankInt(int rank)
set the rank integer
Definition: BattleUnit.cpp:2494
bool isFloating() const
Is floating?
Definition: BattleUnit.cpp:767
void toggleFireDamage()
switch the state of the fire damage tracker.
Definition: BattleUnit.cpp:2611
int getLoftemps(int entry=0) const
Get the unit's loft ID.
Definition: BattleUnit.cpp:2183
bool reselectAllowed() const
Check whether reselecting this unit is allowed.
Definition: BattleUnit.cpp:1535
Armor * getArmor() const
Gets the unit's armor.
Definition: BattleUnit.cpp:2107
void setCoverReserve(int reserve)
Changes the amount of TUs reserved for cover.
Definition: BattleUnit.cpp:2620
int getTimeUnits() const
Gets the unit's time units.
Definition: BattleUnit.cpp:840
int getHealth() const
Gets the unit's health.
Definition: BattleUnit.cpp:858
void addPsiExp()
Adds one to the psi exp counter.
Definition: BattleUnit.cpp:1877
int getStandHeight() const
Get the unit's stand height.
Definition: BattleUnit.cpp:2154
void addThrowingExp()
Adds one to the throwing exp counter.
Definition: BattleUnit.cpp:1869
void kneel(bool kneeled)
Kneel down.
Definition: BattleUnit.cpp:748
void healStun(int power)
Heal stun level of the unit.
Definition: BattleUnit.cpp:1009
This class is used by the BattleUnit AI.
Definition: BattleAIState.h:35
int getWalkingPhase() const
Gets the walking phase for animation and sound.
Definition: BattleUnit.cpp:540
BattleUnit(Soldier *soldier, UnitFaction faction)
Creates a BattleUnit.
Definition: BattleUnit.cpp:50
int getAggression() const
Get the unit's aggression.
Definition: BattleUnit.cpp:2248
void painKillers()
Give pain killers to this unit.
Definition: BattleUnit.cpp:2068
void load(const YAML::Node &node)
Loads the unit from YAML.
Definition: BattleUnit.cpp:189
UnitFaction getFaction() const
Gets the unit's faction.
Definition: BattleUnit.cpp:707
int getKneelHeight() const
Get the unit's kneel height.
Definition: BattleUnit.cpp:2163
void setCharging(BattleUnit *chargeTarget)
Set the units we are charging towards.
Definition: BattleUnit.cpp:2414
int getFire() const
Get fire.
Definition: BattleUnit.cpp:1554
bool isSelectable(UnitFaction faction, bool checkReselect, bool checkInventory) const
Is this unit selectable?
Definition: BattleUnit.cpp:2642
Contains strings used throughout the game for localization.
Definition: Language.h:42
bool isKneeled() const
Is kneeled?
Definition: BattleUnit.cpp:758
bool checkViewSector(Position pos) const
this function checks if a tile is visible, using maths.
Definition: BattleUnit.cpp:2536
double getThrowingAccuracy()
Calculate throwing accuracy.
Definition: BattleUnit.cpp:1358
int getMotionPoints() const
Get motion points for the motion scanner.
Definition: BattleUnit.cpp:2097
int getFaceDirection() const
Gets the unit's face direction (only used by strafing moves)
Definition: BattleUnit.cpp:372
UnitStatus getStatus() const
Gets the unit's status.
Definition: BattleUnit.cpp:408
int getFloatHeight() const
Gets the unit floating elevation.
Definition: BattleUnit.cpp:2172
Represents a single item in the battlescape.
Definition: BattleItem.h:39
std::string getType() const
Get unit type.
Definition: BattleUnit.cpp:2319
void addMeleeExp()
Adds one to the melee exp counter.
Definition: BattleUnit.cpp:1885
int getTurnsSinceSpotted() const
Set how many turns this unit will be exposed for.
Definition: BattleUnit.cpp:2458
BattleItem * getItem(RuleInventory *slot, int x=0, int y=0) const
Gets the item in the specified slot.
Definition: BattleUnit.cpp:1675
std::vector< BattleItem * > * getInventory()
Get the list of items in the inventory.
Definition: BattleUnit.cpp:1563
void setTurretType(int turretType)
Set the turret type. -1 is no turret.
Definition: BattleUnit.cpp:2021
int getFatalWounds() const
Get total number of fatal wounds.
Definition: BattleUnit.cpp:1391
bool getVisible() const
Get whether this unit is visible.
Definition: BattleUnit.cpp:1616
YAML::Node save() const
Saves the unit to YAML.
Definition: BattleUnit.cpp:235
void setArmor(int armor, UnitSide side)
Set armor value.
Definition: BattleUnit.cpp:1368
std::wstring getName(Language *lang, bool debugAppendId=false) const
Gets the unit's name.
Definition: BattleUnit.cpp:2119
Represents a specific type of armor.
Definition: Armor.h:36
const Position & getPosition() const
Gets the unit's position.
Definition: BattleUnit.cpp:313
void setFire(int fire)
Set fire.
Definition: BattleUnit.cpp:1544
bool hasInventory() const
Does this unit have an inventory?
Definition: BattleUnit.cpp:2652
void setActiveHand(const std::string &slot)
Set the hand this unit is using;.
Definition: BattleUnit.cpp:2328
Represents a soldier hired by the player.
Definition: Soldier.h:49
int getActionTUs(BattleActionType actionType, BattleItem *item)
Get the number of time units a certain action takes.
Definition: BattleUnit.cpp:1103
void addFiringExp()
Adds one to the firing exp counter.
Definition: BattleUnit.cpp:1861
void addKillCount()
Add a kill to the counter.
Definition: BattleUnit.cpp:2310
BattleItem * getMainHandWeapon(bool quickest=true) const
Gets the item in the main hand.
Definition: BattleUnit.cpp:1742
int getCoverReserve() const
Returns the amount of TUs reserved for cover.
Definition: BattleUnit.cpp:2629
Basic element of which a battle map is build.
Definition: Tile.h:43
This struct holds some plain unit attribute data together.
Definition: Unit.h:32
Element that is blit (rendered) onto the screen.
Definition: Surface.h:39
bool addToVisibleTiles(Tile *tile)
Add unit to visible tiles.
Definition: BattleUnit.cpp:1252
void instaKill()
Set health to 0 and set status dead.
Definition: BattleUnit.cpp:2356
void clearVisibleTiles()
Clear visible tiles.
Definition: BattleUnit.cpp:1270
int getMorale() const
Gets the unit's bravery.
Definition: BattleUnit.cpp:867
int getCarriedWeight(BattleItem *draggingItem=0) const
Get the carried weight in strength units.
Definition: BattleUnit.cpp:2433
bool spendTimeUnits(int tu)
Spend time units if it can.
Definition: BattleUnit.cpp:1157
void setPosition(const Position &pos, bool updateLastPos=true)
Sets the unit's position.
Definition: BattleUnit.cpp:303
int getHeight() const
Gets the unit height taking into account kneeling/standing.
Definition: BattleUnit.cpp:1845
void invalidateCache()
call this after the default copy constructor deletes the cache?
Definition: BattleUnit.cpp:2475
int getFiringAccuracy(BattleActionType actionType, BattleItem *item)
Calculate firing accuracy.
Definition: BattleUnit.cpp:1287
const Position & getDestination() const
Gets the unit's destination when walking.
Definition: BattleUnit.cpp:331
void prepareNewTurn()
Prepare for a new turn.
Definition: BattleUnit.cpp:1415
Battlescape game - the core game engine of the battlescape game.
Definition: BattlescapeGame.h:70
int getTurretType() const
Get the turret type. -1 is no turret.
Definition: BattleUnit.cpp:2030
int directionTo(const Position &point) const
Get direction to a certain point.
Definition: BattleUnit.cpp:792
void keepWalking(Tile *tileBelowMe, bool cache)
Increase the walkingPhase.
Definition: BattleUnit.cpp:459
bool isFearable() const
Get whether the unit is affected by fear.
Definition: BattleUnit.cpp:2230
void adjustStats(const int diff)
adjust this unit's stats according to difficulty.
Definition: BattleUnit.cpp:2585
std::vector< BattleUnit * > & getUnitsSpottedThisTurn()
get the vector of units we've seen this turn.
Definition: BattleUnit.cpp:2485
void moraleChange(int change)
Morale change.
Definition: BattleUnit.cpp:1503
void startWalking(int direction, const Position &destination, Tile *tileBelowMe, bool cache)
Start the walkingPhase.
Definition: BattleUnit.cpp:420
void think(BattleAction *action)
Let AI do their thing.
Definition: BattleUnit.cpp:1572
int getVerticalDirection() const
Gets the unit's vertical direction.
Definition: BattleUnit.cpp:399
void setSpecialAbility(SpecialAbility specab)
Set the units's special ability.
Definition: BattleUnit.cpp:2266
BattleAIState * getCurrentAIState() const
Get current AI state.
Definition: BattleUnit.cpp:1597
int getAggroSound() const
Gets the unit's aggro sound.
Definition: BattleUnit.cpp:2366
int getMiniMapSpriteIndex() const
Get the sprite index for the minimap.
Definition: BattleUnit.cpp:1987
int getFatalWound(int part) const
Get fatal wound amount of a body part.
Definition: BattleUnit.cpp:2040
bool isOut() const
The unit is out - either dead or unconscious.
Definition: BattleUnit.cpp:1092
void updateGeoscapeStats(Soldier *soldier)
Updates the stats of a Geoscape soldier.
Definition: BattleUnit.cpp:1890
Easy handling of X-Y-Z coordinates.
Definition: Position.h:30
bool spendEnergy(int tu)
Spend energy if it can.
Definition: BattleUnit.cpp:1175
~BattleUnit()
Cleans up the BattleUnit.
Definition: BattleUnit.cpp:178
bool _hidingForTurn
scratch value for AI's left hand to tell its right hand what's up...
Definition: BattleUnit.h:398
UnitStats * getStats()
Gets the unit's stats.
Definition: BattleUnit.cpp:2145
void setTurnsSinceSpotted(int turns)
Set how many turns this unit will be exposed for.
Definition: BattleUnit.cpp:2449
Surface * getCache(bool *invalid, int part=0) const
If this unit is cached on the battlescape.
Definition: BattleUnit.cpp:737
void abortTurn()
Abort turning.
Definition: BattleUnit.cpp:689
void dontReselect()
Don't reselect this unit.
Definition: BattleUnit.cpp:1517
void halveArmor()
Halve the unit's armor values.
Definition: BattleUnit.cpp:2383
std::string getSpawnUnit() const
Gets the unit's spawn unit.
Definition: BattleUnit.cpp:2275
const Position & getLastPosition() const
Gets the unit's position.
Definition: BattleUnit.cpp:322
void knockOut(BattlescapeGame *battle)
Knocks the unit out instantly.
Definition: BattleUnit.cpp:1026
Represents a moving unit in the battlescape, player controlled or AI controlled it holds info about i...
Definition: BattleUnit.h:58
UnitFaction getOriginalFaction() const
Get this unit's original faction.
Definition: BattleUnit.cpp:2467
int getRankInt() const
get the rank integer
Definition: BattleUnit.cpp:2503
void setAIState(BattleAIState *aiState)
Set next AI State.
Definition: BattleUnit.cpp:1582
Represents the static data for a unit that is generated on the battlescape, this includes: HWPs...
Definition: Unit.h:50
int getId() const
Gets the BattleUnit's ID.
Definition: BattleUnit.cpp:293
Represents a specific section of the inventory, containing information like available slots and scree...
Definition: RuleInventory.h:44
void startFalling()
Start falling sequence.
Definition: BattleUnit.cpp:1047
void setCache(Surface *cache, int part=0)
Set the cached flag.
Definition: BattleUnit.cpp:717
int getSpecialAbility() const
Get the units's special ability.
Definition: BattleUnit.cpp:2257