20 #include "formula/callable_objects.hpp" 32 typedef std::multimap<map_location, map_location>
move_map;
34 : units_(units),
ai_(ai)
40 variant get_value(
const std::string& key)
const override;
45 void collect_possible_attacks(std::vector<variant>& vars,
map_location attacker_location,
map_location attack_position)
const;
51 variant get_value(
const std::string& key)
const override;
75 return variant(std::make_shared<location_callable>(src_));
76 }
else if(key ==
"dst") {
77 return variant(std::make_shared<location_callable>(dst_));
83 add_input(inputs,
"src");
84 add_input(inputs,
"dst");
104 return variant(std::make_shared<location_callable>(src_));
105 }
else if(key ==
"dst") {
106 return variant(std::make_shared<location_callable>(dst_));
112 add_input(inputs,
"src");
113 add_input(inputs,
"dst");
121 type_ = MOVE_PARTIAL_C;
133 variant get_value(
const std::string& key)
const override;
142 const std::string&
id()
const {
return id_; }
150 variant get_value(
const std::string& key)
const override;
155 : loc_(loc), type_(type)
159 const std::string&
type()
const {
return type_; }
167 variant get_value(
const std::string& key)
const override;
172 : key_(key), value_(value), loc_(loc)
175 const std::string&
key()
const {
return key_; }
190 typedef std::multimap<map_location, map_location>
move_map;
195 variant get_value(
const std::string& key)
const override;
199 : srcdst_(srcdst), dstsrc_(dstsrc), units_(units)
204 const move_map&
srcdst()
const {
return srcdst_; }
205 const move_map&
dstsrc()
const {
return dstsrc_; }
211 variant get_value(
const std::string& key)
const override;
240 std::vector<variant> hitLeft_, prob_,
status_;
241 variant get_value(
const std::string& key)
const override;
246 const std::vector<variant>& prob,
247 const std::vector<variant>& status)
248 : hitLeft_(hitLeft), prob_(prob), status_(status)
252 const std::vector<variant>&
hitLeft()
const {
return hitLeft_; }
253 const std::vector<variant>&
prob()
const {
return prob_; }
254 const std::vector<variant>&
status()
const {
return status_; }
recruit_callable(const map_location &loc, const std::string &type)
recall_callable(const map_location &loc, const std::string &id)
const battle_context_unit_stats & get_defender_stats() const
This method returns the statistics of the defender.
Various functions that implement attacks and attack calculations.
attack_map_callable(const ai::formula_ai &ai, const unit_map &units)
const map_location & src() const
std::vector< formula_input > formula_input_vector
const map_location & dst() const
const ai::formula_ai & ai_
void get_inputs(formula_input_vector &inputs) const override
const std::vector< variant > & hitLeft() const
std::multimap< map_location, map_location > move_map
std::multimap< map_location, map_location > move_map
The standard way in which a map of possible moves is recorded.
std::multimap< map_location, map_location > move_map
const std::vector< variant > & prob() const
A small explanation about what's going on here: Each action has access to two game_info objects First...
const move_map & srcdst() const
variant get_value(const std::string &key) const override
move_callable(const map_location &src, const map_location &dst)
Computes the statistics of a battle between an attacker and a defender unit.
const move_map & dstsrc() const
const std::string & type() const
int attack_num
Index into unit->attacks() or -1 for none.
int defender_weapon() const
Encapsulates the map of the game.
const map_location loc() const
variant get_value(const std::string &) const override
const std::vector< variant > & status() const
const map_location & dst() const
variant get_value(const std::string &key) const override
Game information for the AI.
outcome_callable(const std::vector< variant > &hitLeft, const std::vector< variant > &prob, const std::vector< variant > &status)
position_callable(int chance)
const std::string & id() const
move_map_callable(const move_map &srcdst, const move_map &dstsrc, const unit_map &units)
const map_location & move_from() const
move_partial_callable(const map_location &src, const map_location &dst)
void get_inputs(formula_input_vector &inputs) const override
const map_location & loc() const
Container associating units to locations.
const map_location & loc() const
const map_location & dst() const
const map_location & src() const
const map_location & src() const
const battle_context_unit_stats & get_attacker_stats() const
This method returns the statistics of the attacker.
set_unit_var_callable(const std::string &key, const variant &value, const map_location &loc)
const std::string & key() const
std::vector< variant > status_