OpenXcom
1.0
Open-source clone of the original X-Com
|
Represents a single item in the battlescape. More...
#include <BattleItem.h>
Public Member Functions | |
BattleItem (RuleItem *rules, int *id) | |
Creates a item of the specified type. More... | |
~BattleItem () | |
Cleans up the item. | |
void | load (const YAML::Node &node) |
Loads the item from YAML. More... | |
YAML::Node | save () const |
Saves the item to YAML. More... | |
RuleItem * | getRules () const |
Gets the item's ruleset. More... | |
int | getAmmoQuantity () const |
Gets the item's ammo quantity. More... | |
void | setAmmoQuantity (int qty) |
Sets the item's ammo quantity. More... | |
int | getFuseTimer () const |
Gets the turn until explosion. More... | |
void | setFuseTimer (int turns) |
Sets the turns until explosion. More... | |
bool | spendBullet () |
Spend one bullet. More... | |
BattleUnit * | getOwner () const |
Gets the item's owner. More... | |
BattleUnit * | getPreviousOwner () const |
Gets the item's previous owner. More... | |
void | setOwner (BattleUnit *owner) |
Sets the owner. More... | |
void | moveToOwner (BattleUnit *owner) |
Removes the item from previous owner and moves to new owner. More... | |
RuleInventory * | getSlot () const |
Gets the item's inventory slot. More... | |
void | setSlot (RuleInventory *slot) |
Sets the item's inventory slot. More... | |
int | getSlotX () const |
Gets the item's inventory X position. More... | |
void | setSlotX (int x) |
Sets the item's inventory X position. More... | |
int | getSlotY () const |
Gets the item's inventory Y position. More... | |
void | setSlotY (int y) |
Sets the item's inventory Y position. More... | |
bool | occupiesSlot (int x, int y, BattleItem *item=0) const |
Checks if the item is occupying a slot. More... | |
BattleItem * | getAmmoItem () |
Gets the item's ammo item. More... | |
bool | needsAmmo () const |
Determines if this item uses ammo. More... | |
int | setAmmoItem (BattleItem *item) |
Sets the item's ammo item. More... | |
Tile * | getTile () const |
Gets the item's tile. More... | |
void | setTile (Tile *tile) |
Sets the tile. More... | |
int | getId () const |
Gets it's unique id. More... | |
BattleUnit * | getUnit () const |
Gets the corpse's unit. More... | |
void | setUnit (BattleUnit *unit) |
Sets the corpse's unit. More... | |
void | setHealQuantity (int heal) |
Set medikit Heal quantity. More... | |
int | getHealQuantity () const |
Get medikit heal quantity. More... | |
void | setPainKillerQuantity (int pk) |
Set medikit pain killers quantity. More... | |
int | getPainKillerQuantity () const |
Get medikit pain killers quantity. More... | |
void | setStimulantQuantity (int stimulant) |
Set medikit stimulant quantity. More... | |
int | getStimulantQuantity () const |
Get medikit stimulant quantity. More... | |
void | setXCOMProperty (bool flag) |
Set xcom property flag. More... | |
bool | getXCOMProperty () const |
Get xcom property flag. More... | |
bool | getTurnFlag () const |
get the flag representing "not dropped on player turn" More... | |
void | setTurnFlag (bool flag) |
set the flag representing "not dropped on player turn" More... | |
void | convertToCorpse (RuleItem *rules) |
Sets the item's ruleset. More... | |
Represents a single item in the battlescape.
Contains battle-related info about an item like the position, ammo quantity, ...
OpenXcom::BattleItem::BattleItem | ( | RuleItem * | rules, |
int * | id | ||
) |
Creates a item of the specified type.
Initializes a item of the specified type.
rules | Pointer to ruleset. |
id | The id of the item. |
void OpenXcom::BattleItem::convertToCorpse | ( | RuleItem * | rules | ) |
Sets the item's ruleset.
Converts an unconscious body into a dead one.
rules | the rules of the corpse item to convert this item into. |
BattleItem * OpenXcom::BattleItem::getAmmoItem | ( | ) |
Gets the item's ammo item.
int OpenXcom::BattleItem::getAmmoQuantity | ( | ) | const |
Gets the item's ammo quantity.
Gets the quantity of ammo in this item.
int OpenXcom::BattleItem::getFuseTimer | ( | ) | const |
Gets the turn until explosion.
Gets the turns until detonation.
-1 = unprimed grenade
int OpenXcom::BattleItem::getHealQuantity | ( | ) | const |
Get medikit heal quantity.
Gets the heal quantity of the item.
int OpenXcom::BattleItem::getId | ( | ) | const |
Gets it's unique id.
Gets the item's id.
BattleUnit * OpenXcom::BattleItem::getOwner | ( | ) | const |
Gets the item's owner.
int OpenXcom::BattleItem::getPainKillerQuantity | ( | ) | const |
Get medikit pain killers quantity.
Gets the pain killer quantity of the item.
BattleUnit * OpenXcom::BattleItem::getPreviousOwner | ( | ) | const |
Gets the item's previous owner.
RuleItem * OpenXcom::BattleItem::getRules | ( | ) | const |
Gets the item's ruleset.
Gets the ruleset for the item's type.
RuleInventory * OpenXcom::BattleItem::getSlot | ( | ) | const |
Gets the item's inventory slot.
int OpenXcom::BattleItem::getSlotX | ( | ) | const |
Gets the item's inventory X position.
int OpenXcom::BattleItem::getSlotY | ( | ) | const |
Gets the item's inventory Y position.
int OpenXcom::BattleItem::getStimulantQuantity | ( | ) | const |
Get medikit stimulant quantity.
Gets the stimulant quantity of the item.
Tile * OpenXcom::BattleItem::getTile | ( | ) | const |
Gets the item's tile.
bool OpenXcom::BattleItem::getTurnFlag | ( | ) | const |
get the flag representing "not dropped on player turn"
Gets the "dropped on non-player turn" flag.
This is to determine whether or not aliens should attempt to pick this item up, as items dropped by the player may be "honey traps".
BattleUnit * OpenXcom::BattleItem::getUnit | ( | ) | const |
Gets the corpse's unit.
bool OpenXcom::BattleItem::getXCOMProperty | ( | ) | const |
Get xcom property flag.
Gets the XCom property flag.
This is to determine at debriefing what goes into the base/craft.
void OpenXcom::BattleItem::load | ( | const YAML::Node & | node | ) |
Loads the item from YAML.
Loads the item from a YAML file.
node | YAML node. |
void OpenXcom::BattleItem::moveToOwner | ( | BattleUnit * | owner | ) |
Removes the item from previous owner and moves to new owner.
Removes the item from the previous owner and moves it to the new owner.
owner | Pointer to Battleunit. |
bool OpenXcom::BattleItem::needsAmmo | ( | ) | const |
Determines if this item uses ammo.
Determines if the item uses ammo.
bool OpenXcom::BattleItem::occupiesSlot | ( | int | x, |
int | y, | ||
BattleItem * | item = 0 |
||
) | const |
Checks if the item is occupying a slot.
Checks if the item is covering certain inventory slot(s).
x | Slot X position. |
y | Slot Y position. |
item | Item to check for overlap, or NULL if none. |
YAML::Node OpenXcom::BattleItem::save | ( | ) | const |
Saves the item to YAML.
Saves the item to a YAML file.
int OpenXcom::BattleItem::setAmmoItem | ( | BattleItem * | item | ) |
Sets the item's ammo item.
item | The ammo item. |
void OpenXcom::BattleItem::setAmmoQuantity | ( | int | qty | ) |
Sets the item's ammo quantity.
Changes the quantity of ammo in this item.
qty | Ammo quantity. |
void OpenXcom::BattleItem::setFuseTimer | ( | int | turns | ) |
Sets the turns until explosion.
Sets the turn to explode on.
turns | Turns until detonation (player/alien turns, not game turns). |
void OpenXcom::BattleItem::setHealQuantity | ( | int | heal | ) |
Set medikit Heal quantity.
Sets the heal quantity of the item.
heal | The new heal quantity. |
void OpenXcom::BattleItem::setOwner | ( | BattleUnit * | owner | ) |
Sets the owner.
Sets the item's owner.
owner | Pointer to Battleunit. |
void OpenXcom::BattleItem::setPainKillerQuantity | ( | int | pk | ) |
Set medikit pain killers quantity.
Sets the pain killer quantity of the item.
pk | The new pain killer quantity. |
void OpenXcom::BattleItem::setSlot | ( | RuleInventory * | slot | ) |
Sets the item's inventory slot.
slot | The slot id. |
void OpenXcom::BattleItem::setSlotX | ( | int | x | ) |
Sets the item's inventory X position.
x | X position. |
void OpenXcom::BattleItem::setSlotY | ( | int | y | ) |
Sets the item's inventory Y position.
y | Y position. |
void OpenXcom::BattleItem::setStimulantQuantity | ( | int | stimulant | ) |
Set medikit stimulant quantity.
Sets the stimulant quantity of the item.
stimulant | The new stimulant quantity. |
void OpenXcom::BattleItem::setTile | ( | Tile * | tile | ) |
Sets the tile.
Sets the item's tile.
tile | The tile. |
void OpenXcom::BattleItem::setTurnFlag | ( | bool | flag | ) |
set the flag representing "not dropped on player turn"
Sets the "dropped on non-player turn" flag.
This is set when the item is dropped in the battlescape or picked up in the inventory screen.
flag | True if the aliens dropped the item. |
void OpenXcom::BattleItem::setUnit | ( | BattleUnit * | unit | ) |
Sets the corpse's unit.
unit | Pointer to BattleUnit. |
void OpenXcom::BattleItem::setXCOMProperty | ( | bool | flag | ) |
Set xcom property flag.
Sets the XCom property flag.
This is to determine at debriefing what goes into the base/craft.
flag | True if it's XCom property. |
bool OpenXcom::BattleItem::spendBullet | ( | ) |
Spend one bullet.
Spends a bullet from the ammo in this item.