![]() |
Deep RTS
|
#include <Player.h>
Public Member Functions | |
| void | spawnUnitNearSpawnPoint (Constants::Unit unitType) |
| Player (Game &game, int id) | |
| Constructor. More... | |
| void | setName (std::string name) |
| Set the name of the player. More... | |
| void | setTargetedUnitID (int targetedUnitID) |
| Select a unit. More... | |
| Game & | getGame () const |
| Get the game instance. More... | |
| int | getId () const |
| Get Player's ID. More... | |
| int | getFoodConsumption () const |
| Get the food consumption. More... | |
| int | getFood () const |
| Get Max Food. More... | |
| int | getGold () const |
| Get the gold resource. More... | |
| int | getStone () const |
| Get the oil resource. More... | |
| int | getLumber () const |
| Get the lumber resource. More... | |
| virtual int | getScore () const |
| Get the score. More... | |
| int | getUnitCount () const |
| Get the unit count for this player. More... | |
| Unit * | getTargetedUnit () |
| Get the targeted unit (Returns null if none) More... | |
| int | getTargetedUnitID () const |
| Get the targeted unit ID (-1 if none) More... | |
| virtual Constants::PlayerState | playerState () |
| Check if player is defeated. More... | |
| const std::string & | getName () const |
| Get the player name. More... | |
| Unit & | addUnit (Constants::Unit unitType) |
| Add a unit to the player. More... | |
| Unit & | spawnUnit (Unit &unit, Tile &tile, int select) |
| void | removeUnit (Unit &unit) |
| Removes a unit from the player. More... | |
| Unit & | spawn (Tile &spawnPoint) |
| Spawns a unit on a tile. More... | |
| void | reset () |
| Reset the player state. More... | |
| void | removeGold (int n) |
| Remove N gold from the player. More... | |
| void | removeLumber (int n) |
| Remove N lumber from the player. More... | |
| void | removeStone (int n) |
| Remove N oil from the player. More... | |
| void | addGold (int n) |
| Add N gold to the player. More... | |
| void | addLumber (int n) |
| Add N lumber to the player. More... | |
| void | addStone (int n) |
| Add N oil to the player. More... | |
| void | do_action (int actionID) |
| void | do_manual_action (int manual_action_id, int x, int y) |
| void | leftClick (int x, int y) |
| void | rightClick (int x, int y) |
| bool | canPlace (Unit &builder, Unit &unit, Tile &tile) |
| TODO move these to Unit.h? More... | |
| bool | canAfford (Unit &unit) const |
Public Attributes | |
| const Config & | config |
| std::vector< int > | unitIndexes |
| List of all unit Ids belonging to this player. The object itself is located in Game class units list. More... | |
| int | stone = 0 |
| int | gold = 0 |
| int | lumber = 0 |
| int | foodConsumption = 0 |
| int | food = 0 |
| int | num_archer = 0 |
| Counters for buildings. More... | |
| int | num_peasant = 0 |
| int | num_footman = 0 |
| int | num_town_hall = 0 |
| int | num_farm = 0 |
| int | num_barrack = 0 |
| int | sGatheredGold = 0 |
| int | sGatheredLumber = 0 |
| int | sGatheredStone = 0 |
| int | sDamageDone = 0 |
| int | sDamageTaken = 0 |
| int | sUnitsCreated = 0 |
| Player::Player | ( | Game & | game, |
| int | id | ||
| ) |
Constructor.
| void Player::addGold | ( | int | n | ) |
Add N gold to the player.
| void Player::addLumber | ( | int | n | ) |
Add N lumber to the player.
| void Player::addStone | ( | int | n | ) |
Add N oil to the player.
| Unit & Player::addUnit | ( | Constants::Unit | unitType | ) |
Add a unit to the player.
Functions
| bool Player::canAfford | ( | Unit & | unit | ) | const |
| void Player::do_action | ( | int | actionID | ) |
| void Player::do_manual_action | ( | int | manual_action_id, |
| int | x, | ||
| int | y | ||
| ) |
| int Player::getFood | ( | ) | const |
Get Max Food.
| int Player::getFoodConsumption | ( | ) | const |
Get the food consumption.
| Game & Player::getGame | ( | ) | const |
Get the game instance.
Getters
| int Player::getGold | ( | ) | const |
Get the gold resource.
| int Player::getId | ( | ) | const |
Get Player's ID.
| int Player::getLumber | ( | ) | const |
Get the lumber resource.
| const std::string & Player::getName | ( | ) | const |
Get the player name.
|
virtual |
Get the score.
| int Player::getStone | ( | ) | const |
Get the oil resource.
| Unit * Player::getTargetedUnit | ( | ) |
Get the targeted unit (Returns null if none)
| int Player::getTargetedUnitID | ( | ) | const |
Get the targeted unit ID (-1 if none)
| int Player::getUnitCount | ( | ) | const |
Get the unit count for this player.
| void Player::leftClick | ( | int | x, |
| int | y | ||
| ) |
|
virtual |
Check if player is defeated.
| void Player::removeGold | ( | int | n | ) |
Remove N gold from the player.
| void Player::removeLumber | ( | int | n | ) |
Remove N lumber from the player.
| void Player::removeStone | ( | int | n | ) |
Remove N oil from the player.
| void Player::removeUnit | ( | Unit & | unit | ) |
Removes a unit from the player.
| void Player::reset | ( | ) |
Reset the player state.
| void Player::rightClick | ( | int | x, |
| int | y | ||
| ) |
| void Player::setName | ( | std::string | name | ) |
Set the name of the player.
Setters
| void Player::setTargetedUnitID | ( | int | targetedUnitID | ) |
Select a unit.
| void Player::spawnUnitNearSpawnPoint | ( | Constants::Unit | unitType | ) |
| const Config& Player::config |
| int Player::food = 0 |
| int Player::foodConsumption = 0 |
| int Player::gold = 0 |
| int Player::lumber = 0 |
| int Player::num_archer = 0 |
Counters for buildings.
| int Player::num_barrack = 0 |
| int Player::num_farm = 0 |
| int Player::num_footman = 0 |
| int Player::num_peasant = 0 |
| int Player::num_town_hall = 0 |
| int Player::sDamageDone = 0 |
| int Player::sDamageTaken = 0 |
| int Player::sGatheredGold = 0 |
Player Statistics
| int Player::sGatheredLumber = 0 |
| int Player::sGatheredStone = 0 |
| int Player::stone = 0 |
Player Resources
| int Player::sUnitsCreated = 0 |
| std::vector<int> Player::unitIndexes |
List of all unit Ids belonging to this player. The object itself is located in Game class units list.