43 AI_ACTION_SUCCESS = 0,
44 AI_ACTION_STARTED = 1,
45 AI_ACTION_FAILURE = -1
57 bool is_gamestate_changed()
const;
63 int get_status()
const;
66 virtual std::string do_describe()
const =0;
71 virtual void do_check_before() = 0;
74 virtual void do_check_after() = 0;
77 virtual void do_execute() = 0;
80 virtual void do_init_for_execution() = 0;
83 bool is_execution()
const;
91 team& get_my_team()
const;
94 void set_error(
int error_code,
bool log_as_error =
true);
97 bool is_success()
const;
100 void set_gamestate_changed();
107 void init_for_execution();
110 void set_ok_checked();
137 E_EMPTY_ATTACKER = 1001,
138 E_EMPTY_DEFENDER = 1002,
139 E_INCAPACITATED_ATTACKER = 1003,
140 E_INCAPACITATED_DEFENDER = 1004,
141 E_NOT_OWN_ATTACKER = 1005,
142 E_NOT_ENEMY_DEFENDER = 1006,
143 E_NO_ATTACKS_LEFT = 1007,
144 E_WRONG_ATTACKER_WEAPON = 1008,
145 E_UNABLE_TO_CHOOSE_ATTACKER_WEAPON = 1009,
146 E_ATTACKER_AND_DEFENDER_NOT_ADJACENT = 1010
149 virtual std::string do_describe()
const;
151 virtual void do_check_before();
152 virtual void do_check_after();
153 virtual void do_execute();
154 virtual void do_init_for_execution();
167 bool remove_movement,
173 E_NOT_OWN_UNIT = 2003,
174 E_INCAPACITATED_UNIT = 2004,
176 E_FAILED_TELEPORT = 2006,
180 virtual std::string do_describe()
const;
183 virtual void do_check_before();
184 virtual void do_check_after();
185 virtual void do_execute();
186 virtual void do_init_for_execution();
188 const unit *get_unit();
189 bool test_route(
const unit &un);
193 std::shared_ptr<pathfind::plain_route>
route_;
206 E_NOT_AVAILABLE_FOR_RECALLING = 6001,
209 E_LEADER_NOT_ON_KEEP = 6005,
210 E_BAD_RECALL_LOCATION = 6006
213 virtual std::string do_describe()
const;
215 virtual void do_check_before();
216 virtual void do_check_after();
217 virtual void do_execute();
218 virtual void do_init_for_execution();
221 const team& my_team);
222 bool test_enough_gold(
223 const team& my_team);
237 E_NOT_AVAILABLE_FOR_RECRUITING = 3001,
238 E_UNKNOWN_OR_DUMMY_UNIT_TYPE = 3002,
241 E_LEADER_NOT_ON_KEEP = 3005,
242 E_BAD_RECRUIT_LOCATION = 3006
245 virtual std::string do_describe()
const;
247 virtual void do_check_before();
248 virtual void do_check_after();
249 virtual void do_execute();
250 virtual void do_init_for_execution();
253 const std::string &recruit);
254 bool test_enough_gold(
269 bool remove_movement,
270 bool remove_attacks );
274 E_NOT_OWN_UNIT = 4003,
275 E_INCAPACITATED_UNIT = 4004
278 virtual std::string do_describe()
const;
280 virtual void do_check_before();
281 virtual void do_check_after();
282 virtual void do_execute();
283 virtual void do_init_for_execution();
285 const unit *get_unit();
294 const std::string& lua_code,
297 virtual std::string do_describe()
const;
299 virtual void do_check_before();
300 virtual void do_check_after();
301 virtual void do_execute();
302 virtual void do_init_for_execution();
349 bool remove_movement,
350 bool unreach_is_ok =
false);
365 const std::string& unit_id,
399 bool remove_movement,
400 bool remove_attacks );
413 const std::string& lua_code,
422 const static std::string& get_error_name(
int error_code);
map_location recruit_location_
map_location recruit_from_
map_location recall_from_
std::shared_ptr< stopunit_result > stopunit_result_ptr
This class represents a single unit of a specific type.
static std::map< int, std::string > error_names_
map_location unit_location_
map_location recall_location_
const map_location & where_
const std::string & unit_id_
std::shared_ptr< move_result > move_result_ptr
std::shared_ptr< recruit_result > recruit_result_ptr
static config unit_name(const unit *u)
const std::string & lua_code_
std::shared_ptr< attack_result > attack_result_ptr
bool has_interrupted_teleport_
std::shared_ptr< pathfind::plain_route > route_
A single unit type that the player may recruit.
std::shared_ptr< const unit > unit_const_ptr
This class stores all the data for a single 'side' (in game nomenclature).
A small explanation about what's going on here: Each action has access to two game_info objects First...
std::shared_ptr< recall_result > recall_result_ptr
Structure which holds a single route between one location and another.
bool return_value_checked_
const bool remove_movement_
const std::string & unit_name_
void sim_gamestate_changed(action_result *result, bool gamestate_changed)
std::shared_ptr< synced_command_result > synced_command_result_ptr
Encapsulates the map of the game.
Various functions related to moving units.
const bool remove_attacks_
const map_location & defender_loc_
Game information for the AI.
static map_location::DIRECTION s
bool is_gamestate_changed_
const map_location & unit_location_
std::ostream & operator<<(std::ostream &s, const ai::attack_result &r)
const map_location where_
const map_location & attacker_loc_
const map_location & location_