C++ Joueur Client
 All Classes Namespaces Functions Variables
unit.hpp
1 #ifndef GAMES_STARDASH_UNIT_H
2 #define GAMES_STARDASH_UNIT_H
3 
4 // Unit
5 // A unit in the game. May be a corvette, missleboat, martyr, transport, miner.
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/stardash_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 stardash
32 {
33 
37 class Unit : public Game_object
38 {
39 public:
40 
44  const bool& acted;
45 
49  const double& dash_x;
50 
54  const double& dash_y;
55 
59  const int& energy;
60 
64  const int& genarium;
65 
69  const bool& is_busy;
70 
74  const Job& job;
75 
79  const int& legendarium;
80 
84  const double& moves;
85 
89  const int& mythicite;
90 
94  const Player& owner;
95 
99  const Unit& protector;
100 
104  const int& rarium;
105 
109  const int& shield;
110 
114  const double& x;
115 
119  const double& y;
120 
121  // <<-- Creer-Merge: member variables -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
122  // You can add additional member variables here. None of them will be tracked or updated by the server.
123  // <<-- /Creer-Merge: member variables -->>
124 
125 
130  bool attack(const Unit& enemy);
131 
137  bool dash(const double& x, const double& y);
138 
143  bool mine(const Body& body);
144 
150  bool move(const double& x, const double& y);
151 
157  bool safe(const double& x, const double& y);
158 
163  bool shootdown(const Projectile& missile);
164 
171  bool transfer(const Unit& unit, int amount, const std::string& material);
172 
173 
174  // <<-- Creer-Merge: methods -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
175  // You can add additional methods here.
176  // <<-- /Creer-Merge: methods -->>
177 
178  ~Unit_();
179 
180  // ####################
181  // Don't edit these!
182  // ####################
184  Unit_(std::initializer_list<std::pair<std::string, Any&&>> init);
185  Unit_() : Unit_({}){}
186  virtual void resize(const std::string& name, std::size_t size) override;
187  virtual void change_vec_values(const std::string& name, std::vector<std::pair<std::size_t, Any>>& values) override;
188  virtual void remove_key(const std::string& name, Any& key) override;
189  virtual std::unique_ptr<Any> add_key_value(const std::string& name, Any& key, Any& value) override;
190  virtual bool is_map(const std::string& name) override;
191  virtual void rebind_by_name(Any* to_change, const std::string& member, std::shared_ptr<Base_object> ref) override;
193  // ####################
194  // Don't edit these!
195  // ####################
196 };
197 
198 } // stardash
199 
200 } // cpp_client
201 
202 #endif // GAMES_STARDASH_UNIT_H
const int & mythicite
The amount of Mythicite carried by this unit. (0 to job carry capacity - other carried items)...
Definition: unit.hpp:89
const Player & owner
The Player that owns and can control this Unit.
Definition: unit.hpp:94
bool dash(const double &x, const double &y)
causes the unit to dash towards the designated destination.
Tracks any projectiles moving through space.
Definition: projectile.hpp:37
bool move(const double &x, const double &y)
moves this _unit from its current location to the new location specified.
const int & genarium
The amount of Genarium ore carried by this unit. (0 to job carry capacity - other carried items)...
Definition: unit.hpp:64
A player in this game. Every AI controls one player.
Definition: player.hpp:37
const int & legendarium
The amount of Legendarium ore carried by this unit. (0 to job carry capacity - other carried items)...
Definition: unit.hpp:79
Information about a unit's job.
Definition: job.hpp:37
bool transfer(const Unit &unit, int amount, const std::string &material)
grab materials from a friendly unit. _doesn't use a action.
const double & moves
The distance this unit can still move.
Definition: unit.hpp:84
const double & x
The x value this unit is on.
Definition: unit.hpp:114
A unit in the game. May be a corvette, missleboat, martyr, transport, miner.
Definition: unit.hpp:37
bool mine(const Body &body)
allows a miner to mine a asteroid.
bool attack(const Unit &enemy)
attacks the specified unit.
const double & y
The y value this unit is on.
Definition: unit.hpp:119
bool shootdown(const Projectile &missile)
attacks the specified projectile.
const double & dash_x
The x value this unit is dashing to.
Definition: unit.hpp:49
const int & shield
The shield that a martyr ship has.
Definition: unit.hpp:109
const bool & acted
Whether or not this Unit has performed its action this turn.
Definition: unit.hpp:44
const bool & is_busy
Tracks whether or not the ship is dashing or Mining. If true, it cannot do anything else...
Definition: unit.hpp:69
An object in the game. The most basic class that all game classes should inherit from automatically...
Definition: game_object.hpp:37
const Unit & protector
The martyr ship that is currently shielding this ship if any.
Definition: unit.hpp:99
const int & rarium
The amount of Rarium carried by this unit. (0 to job carry capacity - other carried items)...
Definition: unit.hpp:104
const Job & job
The Job this Unit has.
Definition: unit.hpp:74
A celestial body located within the game.
Definition: body.hpp:37
bool safe(const double &x, const double &y)
tells you if your ship can move to that location from were it is without clipping the sun...
const double & dash_y
The y value this unit is dashing to.
Definition: unit.hpp:54
const int & energy
The remaining health of the unit.
Definition: unit.hpp:59