C++ Joueur Client
 All Classes Namespaces Functions Variables
miner.hpp
1 #ifndef GAMES_COREMINER_MINER_H
2 #define GAMES_COREMINER_MINER_H
3 
4 // Miner
5 // A Miner in the game.
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/coreminer_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 coreminer
32 {
33 
37 class Miner : public Game_object
38 {
39 public:
40 
44  const int& bombs;
45 
49  const int& building_materials;
50 
55 
59  const int& dirt;
60 
64  const int& health;
65 
69  const int& mining_power;
70 
74  const int& moves;
75 
79  const int& ore;
80 
84  const Player& owner;
85 
89  const Tile& tile;
90 
94  const int& upgrade_level;
95 
96  // <<-- Creer-Merge: member variables -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
97  // You can add additional member variables here. None of them will be tracked or updated by the server.
98  // <<-- /Creer-Merge: member variables -->>
99 
100 
106  bool build(const Tile& tile, const std::string& type);
107 
113  bool buy(const std::string& resource, int amount);
114 
121  bool dump(const Tile& tile, const std::string& material, int amount);
122 
128  bool mine(const Tile& tile, int amount);
129 
134  bool move(const Tile& tile);
135 
142  bool transfer(const Miner& miner, const std::string& resource, int amount);
143 
147  bool upgrade();
148 
149 
150  // <<-- Creer-Merge: methods -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
151  // You can add additional methods here.
152  // <<-- /Creer-Merge: methods -->>
153 
154  ~Miner_();
155 
156  // ####################
157  // Don't edit these!
158  // ####################
160  Miner_(std::initializer_list<std::pair<std::string, Any&&>> init);
161  Miner_() : Miner_({}){}
162  virtual void resize(const std::string& name, std::size_t size) override;
163  virtual void change_vec_values(const std::string& name, std::vector<std::pair<std::size_t, Any>>& values) override;
164  virtual void remove_key(const std::string& name, Any& key) override;
165  virtual std::unique_ptr<Any> add_key_value(const std::string& name, Any& key, Any& value) override;
166  virtual bool is_map(const std::string& name) override;
167  virtual void rebind_by_name(Any* to_change, const std::string& member, std::shared_ptr<Base_object> ref) override;
169  // ####################
170  // Don't edit these!
171  // ####################
172 };
173 
174 } // coreminer
175 
176 } // cpp_client
177 
178 #endif // GAMES_COREMINER_MINER_H
const Player & owner
The Player that owns and can control this Miner.
Definition: miner.hpp:84
const int & upgrade_level
The upgrade level of this Miner. Starts at 0.
Definition: miner.hpp:94
bool dump(const Tile &tile, const std::string &material, int amount)
dumps materials from cargo to an adjacent _tile. _if the _tile is a base or a hopper _tile...
bool transfer(const Miner &miner, const std::string &resource, int amount)
transfers a resource from the one _miner to another.
const int & building_materials
The number of building materials carried by this Miner.
Definition: miner.hpp:49
bool mine(const Tile &tile, int amount)
mines the _tile the _miner is on or an adjacent _tile.
const Tile & tile
The Tile this Miner is on.
Definition: miner.hpp:89
bool upgrade()
upgrade this _miner by installing an upgrade module.
bool move(const Tile &tile)
moves this _miner from its current _tile to an adjacent _tile.
const Upgrade & current_upgrade
The Upgrade this Miner is on.
Definition: miner.hpp:54
const int & health
The remaining health of this Miner.
Definition: miner.hpp:64
bool buy(const std::string &resource, int amount)
purchase a resource from the _player's base or hopper.
Information about a Miner's Upgrade module.
Definition: upgrade.hpp:37
const int & moves
The number of moves this Miner has left this turn.
Definition: miner.hpp:74
A Miner in the game.
Definition: miner.hpp:37
An object in the game. The most basic class that all game classes should inherit from automatically...
Definition: game_object.hpp:37
A Tile in the game that makes up the 2D map grid.
Definition: tile.hpp:37
const int & ore
The amount of ore carried by this Miner.
Definition: miner.hpp:79
const int & bombs
The number of bombs being carried by this Miner.
Definition: miner.hpp:44
bool build(const Tile &tile, const std::string &type)
builds a support, shield, or ladder on _miner's _tile, or an adjacent _tile.
A player in this game. Every AI controls one player.
Definition: player.hpp:37
const int & dirt
The amount of dirt carried by this Miner.
Definition: miner.hpp:59
const int & mining_power
The remaining mining power this Miner has this turn.
Definition: miner.hpp:69