C++ Joueur Client
 All Classes Namespaces Functions Variables
unit.hpp
1 #ifndef GAMES_NEWTONIAN_UNIT_H
2 #define GAMES_NEWTONIAN_UNIT_H
3 
4 // Unit
5 // A unit in the game. May be a manager, intern, or physicist.
6 
7 // DO NOT MODIFY THIS FILE
8 // Never try to directly create an instance of this class, or modify its member variables.
9 // Instead, you should only be reading its variables and calling its functions.
10 
11 #include <vector>
12 #include <queue>
13 #include <deque>
14 #include <unordered_map>
15 #include <string>
16 #include <initializer_list>
17 
18 #include "../../joueur/src/any.hpp"
19 
20 #include "game_object.hpp"
21 
22 #include "impl/newtonian_fwd.hpp"
23 
24 // <<-- Creer-Merge: includes -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
25 // you can add additional #includes here
26 // <<-- /Creer-Merge: includes -->>
27 
28 namespace cpp_client
29 {
30 
31 namespace newtonian
32 {
33 
37 class Unit : public Game_object
38 {
39 public:
40 
44  const bool& acted;
45 
49  const int& blueium;
50 
54  const int& blueium_ore;
55 
59  const int& health;
60 
64  const Job& job;
65 
69  const int& moves;
70 
74  const Player& owner;
75 
79  const int& redium;
80 
84  const int& redium_ore;
85 
89  const int& stun_immune;
90 
94  const int& stun_time;
95 
99  const Tile& tile;
100 
101  // <<-- Creer-Merge: member variables -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
102  // You can add additional member variables here. None of them will be tracked or updated by the server.
103  // <<-- /Creer-Merge: member variables -->>
104 
105 
110  bool act(const Tile& tile);
111 
116  bool attack(const Tile& tile);
117 
124  bool drop(const Tile& tile, int amount, const std::string& material);
125 
130  bool move(const Tile& tile);
131 
138  bool pickup(const Tile& tile, int amount, const std::string& material);
139 
140 
141  // <<-- Creer-Merge: methods -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
142  // You can add additional methods here.
143  // <<-- /Creer-Merge: methods -->>
144 
145  ~Unit_();
146 
147  // ####################
148  // Don't edit these!
149  // ####################
151  Unit_(std::initializer_list<std::pair<std::string, Any&&>> init);
152  Unit_() : Unit_({}){}
153  virtual void resize(const std::string& name, std::size_t size) override;
154  virtual void change_vec_values(const std::string& name, std::vector<std::pair<std::size_t, Any>>& values) override;
155  virtual void remove_key(const std::string& name, Any& key) override;
156  virtual std::unique_ptr<Any> add_key_value(const std::string& name, Any& key, Any& value) override;
157  virtual bool is_map(const std::string& name) override;
158  virtual void rebind_by_name(Any* to_change, const std::string& member, std::shared_ptr<Base_object> ref) override;
160  // ####################
161  // Don't edit these!
162  // ####################
163 };
164 
165 } // newtonian
166 
167 } // cpp_client
168 
169 #endif // GAMES_NEWTONIAN_UNIT_H
const int & moves
The number of moves this unit has left this turn.
Definition: unit.hpp:69
bool act(const Tile &tile)
makes the unit do something to a machine or unit adjacent to its tile. _interns sabotage, physicists work. _interns stun physicist, physicist stuns manager, manager stuns intern.
const Tile & tile
The Tile this Unit is on.
Definition: unit.hpp:99
bool drop(const Tile &tile, int amount, const std::string &material)
drops materials at the units feet or adjacent tile.
const bool & acted
Whether or not this Unit has performed its action this turn.
Definition: unit.hpp:44
const int & health
The remaining health of a unit.
Definition: unit.hpp:59
bool attack(const Tile &tile)
attacks a unit on an adjacent tile.
const int & stun_time
Duration the unit is stunned. (0 to the game constant stunTime).
Definition: unit.hpp:94
const Job & job
The Job this Unit has.
Definition: unit.hpp:64
bool move(const Tile &tile)
moves this _unit from its current _tile to an adjacent _tile.
const int & redium
The amount of redium carried by this unit. (0 to job carry capacity - other carried items)...
Definition: unit.hpp:79
const int & redium_ore
The amount of redium ore carried by this unit. (0 to job carry capacity - other carried items)...
Definition: unit.hpp:84
A unit in the game. May be a manager, intern, or physicist.
Definition: unit.hpp:37
const Player & owner
The Player that owns and can control this Unit.
Definition: unit.hpp:74
const int & stun_immune
Duration of stun immunity. (0 to timeImmune).
Definition: unit.hpp:89
const int & blueium_ore
The amount of blueium ore carried by this unit. (0 to job carry capacity - other carried items)...
Definition: unit.hpp:54
const int & blueium
The amount of blueium carried by this unit. (0 to job carry capacity - other carried items)...
Definition: unit.hpp:49
An object in the game. The most basic class that all game classes should inherit from automatically...
Definition: game_object.hpp:37
bool pickup(const Tile &tile, int amount, const std::string &material)
picks up material at the units feet or adjacent tile.
A Tile in the game that makes up the 2D map grid.
Definition: tile.hpp:37
A player in this game. Every AI controls one player.
Definition: player.hpp:37
Information about a unit's job.
Definition: job.hpp:37