43 wfl::action_callable(),
49 avg_damage_inflicted(0.0),
50 target_starting_damage(0),
51 avg_damage_taken(0.0),
54 alternative_terrain_quality(0.0),
66 const move_map& enemy_dstsrc,
double aggression);
69 wfl::variant get_value(
const std::string& key)
const override;
75 std::vector<std::pair<map_location,map_location>>
movements;
129 virtual int count_free_hexes_in_castle(
const map_location&
loc, std::set<map_location> &checked_hexes) = 0;
137 virtual const std::vector<target>& additional_targets()
const = 0;
139 virtual void add_target(
const target&
t)
const = 0;
141 virtual void clear_additional_targets()
const = 0;
145 virtual std::vector<target> find_targets(
const move_map& enemy_dstsrc) = 0;
149 virtual config to_default_ai_context_config()
const = 0;
158 return target_->count_free_hexes_in_castle(loc, checked_hexes);
170 return target_->additional_targets();
175 target_->add_target(t);
180 target_->clear_additional_targets();
190 return target_->find_targets(enemy_dstsrc);
197 return target_->rate_terrain(u,loc);
202 return target_->to_default_ai_context_config();
212 int count_free_hexes_in_castle(
const map_location&
loc, std::set<map_location> &checked_hexes);
215 : recursion_counter_(context.get_recursion_count()),additional_targets_()
217 init_readwrite_context_proxy(context);
224 virtual const std::vector<target>& additional_targets()
const;
226 virtual void add_target(
const target&
t)
const;
228 virtual void clear_additional_targets()
const;
232 return recursion_counter_.get_count();
235 virtual std::vector<target> find_targets(
const move_map& enemy_dstsrc);
239 virtual config to_default_ai_context_config()
const;
bool leader_threat
Is true if the unit is a threat to our leader.
virtual default_ai_context & get_default_ai_context()=0
double avg_damage_taken
The average hitpoints damage taken.
recursion_counter recursion_counter_
This class represents a single unit of a specific type.
default_ai_context_impl(readwrite_context &context, const config &)
double avg_damage_inflicted
The average hitpoints damage inflicted.
double vulnerability
The vulnerability is the power projection of enemy units onto the hex we're standing on...
std::vector< formula_input > formula_input_vector
int count_free_hexes_in_castle(const map_location &loc, std::set< map_location > &checked_hexes)
double resources_used
The sum of the values of units used in the attack.
double chance_to_kill
Estimated % chance to kill the unit.
virtual void add_target(const target &t) const
int target_starting_damage
double terrain_quality
The weighted average of the % chance to hit each attacking unit.
double target_value
The value of the unit being targeted.
std::multimap< map_location, map_location > move_map
The standard way in which a map of possible moves is recorded.
A small explanation about what's going on here: Each action has access to two game_info objects First...
virtual void clear_additional_targets() const
virtual std::vector< target > find_targets(const move_map &enemy_dstsrc)
double alternative_terrain_quality
The weighted average of the % defense of the best possible terrain that the attacking units could rea...
virtual config to_default_ai_context_config() const
int get_recursion_count() const
Get the value of the recursion counter.
virtual default_ai_context & get_default_ai_context()
Encapsulates the map of the game.
Encapsulates the map of the game.
bool uses_leader
Is true if this attack sequence makes use of the leader.
std::vector< std::pair< map_location, map_location > > movements
double avg_losses
The value on average, of units lost in the combat.
Helper functions for the object which operates in the context of AI for specific side this is part of...
virtual const std::vector< target > & additional_targets() const
default_ai_context * target_
Container associating units to locations.
bool is_surrounded
Is true if the units involved in this attack sequence are surrounded.
std::vector< target > additional_targets_
target(const map_location &pos, double val, ai_target::type target_type=ai_target::type::village)
A config object defines a single node in a WML file, with access to child nodes.
virtual int rate_terrain(const unit &u, const map_location &loc) const
default_ai_context_proxy()