1 #ifndef GAMES_NECROWAR_UNIT_H
2 #define GAMES_NECROWAR_UNIT_H
14 #include <unordered_map>
16 #include <initializer_list>
18 #include "../../joueur/src/any.hpp"
20 #include "game_object.hpp"
22 #include "impl/necrowar_fwd.hpp"
86 bool build(
const std::string& title);
117 Unit_(std::initializer_list<std::pair<std::string, Any&&>> init);
118 Unit_() : Unit_({}){}
119 virtual void resize(
const std::string& name, std::size_t size)
override;
120 virtual void change_vec_values(
const std::string& name, std::vector<std::pair<std::size_t, Any>>& values)
override;
121 virtual void remove_key(
const std::string& name, Any& key)
override;
122 virtual std::unique_ptr<Any> add_key_value(
const std::string& name, Any& key, Any& value)
override;
123 virtual bool is_map(
const std::string& name)
override;
124 virtual void rebind_by_name(Any* to_change,
const std::string& member, std::shared_ptr<Base_object> ref)
override;
135 #endif // GAMES_NECROWAR_UNIT_H
bool build(const std::string &title)
unit, if it is a worker, builds a tower on the tile it is on, only workers can do this...
A Tile in the game that makes up the 2D map grid.
Definition: tile.hpp:37
const int & moves
The number of moves this unit has left this turn.
Definition: unit.hpp:59
An object in the game. The most basic class that all game classes should inherit from automatically...
Definition: game_object.hpp:37
bool attack(const Tile &tile)
attacks an enemy tower on an adjacent tile.
const int & health
The remaining health of a unit.
Definition: unit.hpp:49
bool move(const Tile &tile)
moves this _unit from its current _tile to an adjacent _tile.
A player in this game. Every AI controls one player.
Definition: player.hpp:37
const Player & owner
The Player that owns and can control this Unit.
Definition: unit.hpp:64
bool fish(const Tile &tile)
stops adjacent to a river tile and begins fishing for mana.
bool mine(const Tile &tile)
enters a mine and is put to work gathering resources.
A unit in the game. May be a worker, zombie, ghoul, hound, abomination, wraith or horseman...
Definition: unit.hpp:37
const Tile & tile
The Tile this Unit is on.
Definition: unit.hpp:69
Information about a unit's job/type.
Definition: unit_job.hpp:37
const bool & acted
Whether or not this Unit has performed its action this turn (attack or build).
Definition: unit.hpp:44
const Unit_job & job
The type of unit this is.
Definition: unit.hpp:54