#include <contexts.hpp>
Public Types | |
typedef std::map< std::pair< map_location, const unit_type * >, std::pair< battle_context_unit_stats, battle_context_unit_stats > > | unit_stats_cache_t |
Public Member Functions | |
readonly_context () | |
virtual | ~readonly_context () |
virtual readonly_context & | get_readonly_context ()=0 |
virtual void | on_readonly_context_create ()=0 |
virtual const team & | current_team () const =0 |
virtual void | diagnostic (const std::string &msg)=0 |
virtual void | log_message (const std::string &msg)=0 |
virtual attack_result_ptr | check_attack_action (const map_location &attacker_loc, const map_location &defender_loc, int attacker_weapon)=0 |
virtual move_result_ptr | check_move_action (const map_location &from, const map_location &to, bool remove_movement=true, bool unreach_is_ok=false)=0 |
virtual recall_result_ptr | check_recall_action (const std::string &id, const map_location &where=map_location::null_location(), const map_location &from=map_location::null_location())=0 |
virtual recruit_result_ptr | check_recruit_action (const std::string &unit_name, const map_location &where=map_location::null_location(), const map_location &from=map_location::null_location())=0 |
virtual stopunit_result_ptr | check_stopunit_action (const map_location &unit_location, bool remove_movement=true, bool remove_attacks=false)=0 |
virtual synced_command_result_ptr | check_synced_command_action (const std::string &lua_code, const map_location &location=map_location::null_location())=0 |
virtual void | calculate_possible_moves (std::map< map_location, pathfind::paths > &possible_moves, move_map &srcdst, move_map &dstsrc, bool enemy, bool assume_full_movement=false, const terrain_filter *remove_destinations=nullptr) const =0 |
virtual void | calculate_moves (const unit_map &units, std::map< map_location, pathfind::paths > &possible_moves, move_map &srcdst, move_map &dstsrc, bool enemy, bool assume_full_movement=false, const terrain_filter *remove_destinations=nullptr, bool see_all=false) const =0 |
virtual const game_info & | get_info () const =0 |
virtual const defensive_position & | best_defensive_position (const map_location &unit, const move_map &dstsrc, const move_map &srcdst, const move_map &enemy_dstsrc) const =0 |
virtual std::map< map_location, defensive_position > & | defensive_position_cache () const =0 |
virtual const unit_advancements_aspect & | get_advancements () const =0 |
virtual double | get_aggression () const =0 |
virtual bool | get_allow_ally_villages () const =0 |
virtual const aspect_map & | get_aspects () const =0 |
virtual aspect_map & | get_aspects ()=0 |
virtual void | add_facet (const std::string &id, const config &cfg) const =0 |
virtual void | add_aspects (std::vector< aspect_ptr > &aspects)=0 |
virtual const attacks_vector & | get_attacks () const =0 |
virtual const wfl::variant & | get_attacks_as_variant () const =0 |
virtual const terrain_filter & | get_avoid () const =0 |
virtual double | get_caution () const =0 |
virtual const move_map & | get_dstsrc () const =0 |
virtual const move_map & | get_enemy_dstsrc () const =0 |
virtual const moves_map & | get_enemy_possible_moves () const =0 |
virtual const move_map & | get_enemy_srcdst () const =0 |
virtual engine_ptr | get_engine_by_cfg (const config &cfg)=0 |
get engine by cfg, creating it if it is not created yet but known More... | |
virtual const std::vector< engine_ptr > & | get_engines () const =0 |
virtual std::vector< engine_ptr > & | get_engines ()=0 |
virtual std::string | get_grouping () const =0 |
virtual const std::vector< goal_ptr > & | get_goals () const =0 |
virtual std::vector< goal_ptr > & | get_goals ()=0 |
virtual double | get_leader_aggression () const =0 |
virtual config | get_leader_goal () const =0 |
virtual utils::variant< bool, std::vector< std::string > > | get_leader_ignores_keep () const =0 |
virtual double | get_leader_value () const =0 |
virtual utils::variant< bool, std::vector< std::string > > | get_passive_leader () const =0 |
virtual utils::variant< bool, std::vector< std::string > > | get_passive_leader_shares_keep () const =0 |
virtual const moves_map & | get_possible_moves () const =0 |
virtual double | get_recruitment_diversity () const =0 |
virtual const config | get_recruitment_instructions () const =0 |
virtual const std::vector< std::string > | get_recruitment_more () const =0 |
virtual const std::vector< std::string > | get_recruitment_pattern () const =0 |
virtual int | get_recruitment_randomness () const =0 |
virtual const config | get_recruitment_save_gold () const =0 |
virtual double | get_retreat_enemy_weight () const =0 |
virtual double | get_retreat_factor () const =0 |
virtual double | get_scout_village_targeting () const =0 |
virtual bool | get_simple_targeting () const =0 |
virtual const move_map & | get_srcdst () const =0 |
virtual bool | get_support_villages () const =0 |
virtual double | get_village_value () const =0 |
virtual int | get_villages_per_scout () const =0 |
virtual bool | is_active (const std::string &time_of_day, const std::string &turns) const =0 |
virtual bool | is_keep_ignoring_leader (const std::string &id) const =0 |
virtual bool | is_passive_leader (const std::string &id) const =0 |
virtual bool | is_passive_keep_sharing_leader (const std::string &id) const =0 |
virtual bool | is_dst_src_valid_lua () const =0 |
virtual bool | is_dst_src_enemy_valid_lua () const =0 |
virtual bool | is_src_dst_valid_lua () const =0 |
virtual bool | is_src_dst_enemy_valid_lua () const =0 |
virtual void | invalidate_defensive_position_cache () const =0 |
virtual void | invalidate_move_maps () const =0 |
virtual void | invalidate_keeps_cache () const =0 |
virtual const std::set< map_location > & | keeps () const =0 |
virtual bool | leader_can_reach_keep () const =0 |
virtual const map_location & | nearest_keep (const map_location &loc) const =0 |
virtual double | power_projection (const map_location &loc, const move_map &dstsrc) const =0 |
Function which finds how much 'power' a side can attack a certain location with. More... | |
virtual void | raise_user_interact () const =0 |
virtual void | recalculate_move_maps () const =0 |
virtual void | recalculate_move_maps_enemy () const =0 |
virtual void | set_src_dst_valid_lua ()=0 |
virtual void | set_src_dst_enemy_valid_lua ()=0 |
virtual void | set_dst_src_valid_lua ()=0 |
virtual void | set_dst_src_enemy_valid_lua ()=0 |
virtual const map_location & | suitable_keep (const map_location &leader_location, const pathfind::paths &leader_paths) const =0 |
get most suitable keep for leader - nearest free that can be reached in 1 turn, if none - return nearest occupied that can be reached in 1 turn, if none - return nearest keep, if none - return null_location More... | |
virtual config | to_readonly_context_config () const =0 |
serialize to config More... | |
virtual unit_stats_cache_t & | unit_stats_cache () const =0 |
Public Member Functions inherited from ai::side_context | |
virtual side_number | get_side () const =0 |
Get the side number. More... | |
virtual void | set_side (side_number side)=0 |
Set the side number. More... | |
virtual | ~side_context () |
empty destructor More... | |
side_context () | |
empty constructor More... | |
virtual side_context & | get_side_context ()=0 |
unwrap More... | |
virtual config | to_side_context_config () const =0 |
serialize this context to config More... | |
virtual int | get_recursion_count () const =0 |
Get the value of the recursion counter. More... | |
Definition at line 160 of file contexts.hpp.
typedef std::map<std::pair<map_location,const unit_type *>, std::pair<battle_context_unit_stats,battle_context_unit_stats> > ai::readonly_context::unit_stats_cache_t |
Definition at line 342 of file contexts.hpp.
|
inline |
Definition at line 162 of file contexts.hpp.
|
inlinevirtual |
Definition at line 163 of file contexts.hpp.
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::add_aspects().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::add_facet().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::attack_analysis::analyze(), and ai::readonly_context_proxy::best_defensive_position().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::calculate_moves().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::calculate_possible_moves().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::check_attack_action().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::check_move_action().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::check_recall_action().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::check_recruit_action().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::check_stopunit_action().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::check_synced_command_action().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::attack_analysis::analyze(), ai::cfun_ai_get_suitable_keep(), and ai::readonly_context_proxy::current_team().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::defensive_position_cache().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::diagnostic().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::get_advancements().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::ai_attack(), ai::cfun_ai_get_aggression(), ai::cfun_attack_rating(), and ai::readonly_context_proxy::get_aggression().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::get_allow_ally_villages().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::get_aspects(), ai::impl_ai_aspect_get(), and ai::impl_ai_aspect_list().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_get_attacks(), and ai::readonly_context_proxy::get_attacks().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::get_attacks_as_variant().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_get_avoid(), and ai::readonly_context_proxy::get_avoid().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_get_caution(), ai::readonly_context_proxy::get_caution(), and ai::attack_analysis::rating().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_get_dstsrc(), and ai::readonly_context_proxy::get_dstsrc().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_get_enemy_dstsrc(), ai::cfun_ai_get_targets(), and ai::readonly_context_proxy::get_enemy_dstsrc().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::get_enemy_possible_moves().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_get_enemy_srcdst(), and ai::readonly_context_proxy::get_enemy_srcdst().
|
pure virtual |
get engine by cfg, creating it if it is not created yet but known
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::get_engine_by_cfg(), ai::engine::parse_aspect_from_config(), ai::engine::parse_candidate_action_from_config(), ai::engine::parse_engine_from_config(), ai::engine::parse_goal_from_config(), and ai::engine::parse_stage_from_config().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::get_engines().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::get_goals().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_get_grouping(), and ai::readonly_context_proxy::get_grouping().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::get_info().
|
pure virtual |
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_get_leader_goal(), and ai::readonly_context_proxy::get_leader_goal().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::get_leader_ignores_keep().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_get_leader_value(), and ai::readonly_context_proxy::get_leader_value().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::get_passive_leader().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::get_passive_leader_shares_keep().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::get_possible_moves().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::get_readonly_context().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::get_recruitment_diversity().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::get_recruitment_instructions().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::get_recruitment_more().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_get_recruitment_pattern(), and ai::readonly_context_proxy::get_recruitment_pattern().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::get_recruitment_randomness().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::get_recruitment_save_gold().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::get_retreat_enemy_weight().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::get_retreat_factor().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_get_scout_village_targeting(), and ai::readonly_context_proxy::get_scout_village_targeting().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_get_simple_targeting(), and ai::readonly_context_proxy::get_simple_targeting().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_get_srcdst(), and ai::readonly_context_proxy::get_srcdst().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_get_support_villages(), and ai::readonly_context_proxy::get_support_villages().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_get_village_value(), and ai::readonly_context_proxy::get_village_value().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_get_villages_per_scout(), and ai::readonly_context_proxy::get_villages_per_scout().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::invalidate_defensive_position_cache().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::invalidate_keeps_cache().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::invalidate_move_maps().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::is_active().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_is_dst_src_enemy_valid(), and ai::readonly_context_proxy::is_dst_src_enemy_valid_lua().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_is_dst_src_valid(), and ai::readonly_context_proxy::is_dst_src_valid_lua().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::is_keep_ignoring_leader().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::is_passive_keep_sharing_leader().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::is_passive_leader().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_is_src_dst_enemy_valid(), and ai::readonly_context_proxy::is_src_dst_enemy_valid_lua().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_is_src_dst_valid(), and ai::readonly_context_proxy::is_src_dst_valid_lua().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::keeps().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::leader_can_reach_keep().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::log_message().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::nearest_keep().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::on_readonly_context_create().
|
pure virtual |
Function which finds how much 'power' a side can attack a certain location with.
This is basically the maximum hp of damage that can be inflicted upon a unit on loc by full-health units, multiplied by the defense these units will have. (if 'use_terrain' is false, then it will be multiplied by 0.5)
Example: 'loc' can be reached by two units, one of whom has a 10-3 attack and has 48/48 hp, and can defend at 40% on the adjacent grassland. The other has a 8-2 attack, and has 30/40 hp, and can defend at 60% on the adjacent mountain. The rating will be 10*3*1.0*0.4 + 8*2*0.75*0.6 = 19.2
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::power_projection().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::raise_user_interact().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_recalculate_move_maps(), and ai::readonly_context_proxy::recalculate_move_maps().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_recalculate_move_maps_enemy(), and ai::readonly_context_proxy::recalculate_move_maps_enemy().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_get_enemy_dstsrc(), and ai::readonly_context_proxy::set_dst_src_enemy_valid_lua().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_get_dstsrc(), and ai::readonly_context_proxy::set_dst_src_valid_lua().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_get_enemy_srcdst(), and ai::readonly_context_proxy::set_src_dst_enemy_valid_lua().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_get_srcdst(), and ai::readonly_context_proxy::set_src_dst_valid_lua().
|
pure virtual |
get most suitable keep for leader - nearest free that can be reached in 1 turn, if none - return nearest occupied that can be reached in 1 turn, if none - return nearest keep, if none - return null_location
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::cfun_ai_get_suitable_keep(), and ai::readonly_context_proxy::suitable_keep().
|
pure virtual |
serialize to config
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::readonly_context_proxy::to_readonly_context_config().
|
pure virtual |
Implemented in ai::readonly_context_impl, and ai::readonly_context_proxy.
Referenced by ai::attack_analysis::analyze(), and ai::readonly_context_proxy::unit_stats_cache().