44 AI_ACTION_SUCCESS = 0,
45 AI_ACTION_STARTED = 1,
46 AI_ACTION_FAILURE = -1
58 bool is_gamestate_changed()
const;
64 int get_status()
const;
67 virtual std::string do_describe()
const =0;
72 virtual void do_check_before() = 0;
75 virtual void do_check_after() = 0;
78 virtual void do_execute() = 0;
81 virtual void do_init_for_execution() = 0;
84 bool is_execution()
const;
92 team& get_my_team()
const;
95 void set_error(
int error_code,
bool log_as_error =
true);
98 bool is_success()
const;
101 void set_gamestate_changed();
108 void init_for_execution();
111 void set_ok_checked();
138 E_EMPTY_ATTACKER = 1001,
139 E_EMPTY_DEFENDER = 1002,
140 E_INCAPACITATED_ATTACKER = 1003,
141 E_INCAPACITATED_DEFENDER = 1004,
142 E_NOT_OWN_ATTACKER = 1005,
143 E_NOT_ENEMY_DEFENDER = 1006,
144 E_NO_ATTACKS_LEFT = 1007,
145 E_WRONG_ATTACKER_WEAPON = 1008,
146 E_UNABLE_TO_CHOOSE_ATTACKER_WEAPON = 1009,
147 E_ATTACKER_AND_DEFENDER_NOT_ADJACENT = 1010
150 virtual std::string do_describe()
const;
152 virtual void do_check_before();
153 virtual void do_check_after();
154 virtual void do_execute();
155 virtual void do_init_for_execution();
168 bool remove_movement,
174 E_NOT_OWN_UNIT = 2003,
175 E_INCAPACITATED_UNIT = 2004,
177 E_FAILED_TELEPORT = 2006,
182 virtual std::string do_describe()
const;
185 virtual void do_check_before();
186 virtual void do_check_after();
187 virtual void do_execute();
188 virtual void do_init_for_execution();
190 const unit *get_unit();
191 bool test_route(
const unit &un);
195 std::shared_ptr<pathfind::plain_route>
route_;
208 E_NOT_AVAILABLE_FOR_RECALLING = 6001,
211 E_LEADER_NOT_ON_KEEP = 6005,
212 E_BAD_RECALL_LOCATION = 6006
215 virtual std::string do_describe()
const;
217 virtual void do_check_before();
218 virtual void do_check_after();
219 virtual void do_execute();
220 virtual void do_init_for_execution();
223 const team& my_team);
224 bool test_enough_gold(
225 const team& my_team);
239 E_NOT_AVAILABLE_FOR_RECRUITING = 3001,
240 E_UNKNOWN_OR_DUMMY_UNIT_TYPE = 3002,
243 E_LEADER_NOT_ON_KEEP = 3005,
244 E_BAD_RECRUIT_LOCATION = 3006
247 virtual std::string do_describe()
const;
249 virtual void do_check_before();
250 virtual void do_check_after();
251 virtual void do_execute();
252 virtual void do_init_for_execution();
255 const std::string &recruit);
256 bool test_enough_gold(
271 bool remove_movement,
272 bool remove_attacks );
276 E_NOT_OWN_UNIT = 4003,
277 E_INCAPACITATED_UNIT = 4004
280 virtual std::string do_describe()
const;
282 virtual void do_check_before();
283 virtual void do_check_after();
284 virtual void do_execute();
285 virtual void do_init_for_execution();
287 const unit *get_unit();
296 const std::string& lua_code,
299 virtual std::string do_describe()
const;
301 virtual void do_check_before();
302 virtual void do_check_after();
303 virtual void do_execute();
304 virtual void do_init_for_execution();
351 bool remove_movement,
352 bool unreach_is_ok =
false);
367 const std::string& unit_id,
401 bool remove_movement,
402 bool remove_attacks );
415 const std::string& lua_code,
424 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.
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 const std::map< int, std::string > error_names_
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_