exposed rest of the values of ai aspects to formula ai
This commit is contained in:
parent
91987cccbf
commit
a96dba85c6
2 changed files with 77 additions and 2 deletions
10
changelog
10
changelog
|
@ -3,6 +3,16 @@ Version 1.7.8+svn:
|
|||
* new [limit] subtag of [value] of ai_default::recruitment implementation of
|
||||
recruitment aspect - allow easy limiting of number of concurrent recruits
|
||||
of specific type in the field
|
||||
* new rate_action formula_ai function which returns a rating of
|
||||
attack analysis.
|
||||
* values of most ai aspects are now readable from formula ai (aggression, avoid,
|
||||
attacks, attack_depth, caution, grouping, leader_aggression, leader_value,
|
||||
number_of_possible_recruits_to_force_recruit, passive_leader,
|
||||
passive_leader_shares_keep, recruitment_ignore_bad_movement,
|
||||
recruitment_ignore_bad_combat, recruitment_pattern, scout_village_targeting,
|
||||
support_villages, village_value, villages_per_scout )
|
||||
* Fixed Bug #14768: made AI observe changes in allowed recruits, preventing
|
||||
situations where AI does not recruit because it thinks that it can not do so.
|
||||
* Language and i18n:
|
||||
* Updated translations: Czech, French, German, Latin, Polish,
|
||||
Portuguese (Brazil), Serbian.
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "../../formula_debugger.hpp"
|
||||
#include "../../log.hpp"
|
||||
#include "../../menu_events.hpp"
|
||||
#include "../../terrain_filter.hpp"
|
||||
|
||||
static lg::log_domain log_formula_ai("ai/formula_ai");
|
||||
#define DBG_AI LOG_STREAM(debug, log_formula_ai)
|
||||
|
@ -604,14 +605,78 @@ variant formula_ai::get_value(const std::string& key) const
|
|||
if(key == "aggression")
|
||||
{
|
||||
return variant(get_aggression()*1000,variant::DECIMAL_VARIANT);
|
||||
} else if(key == "leader_aggression")
|
||||
|
||||
} else if(key == "attack_depth")
|
||||
{
|
||||
return variant(get_leader_aggression()*1000,variant::DECIMAL_VARIANT);
|
||||
return variant(get_attack_depth());
|
||||
|
||||
} else if(key == "avoid")
|
||||
{
|
||||
std::set<map_location> av_locs;
|
||||
get_avoid().get_locations(av_locs);
|
||||
return villages_from_set(av_locs);
|
||||
|
||||
} else if(key == "caution")
|
||||
{
|
||||
return variant(get_caution()*1000,variant::DECIMAL_VARIANT);
|
||||
|
||||
} else if(key == "grouping")
|
||||
{
|
||||
return variant(get_grouping());
|
||||
|
||||
} else if(key == "leader_aggression")
|
||||
{
|
||||
return variant(get_leader_aggression()*1000,variant::DECIMAL_VARIANT);
|
||||
|
||||
} else if(key == "leader_value")
|
||||
{
|
||||
return variant(get_leader_value()*1000,variant::DECIMAL_VARIANT);
|
||||
|
||||
} else if(key == "number_of_possible_recruits_to_force_recruit")
|
||||
{
|
||||
return variant(get_number_of_possible_recruits_to_force_recruit()*1000,variant::DECIMAL_VARIANT);
|
||||
|
||||
} else if(key == "passive_leader")
|
||||
{
|
||||
return variant(get_passive_leader());
|
||||
|
||||
} else if(key == "passive_leader_shares_keep")
|
||||
{
|
||||
return variant(get_passive_leader_shares_keep());
|
||||
|
||||
} else if(key == "recruitment_ignore_bad_movement")
|
||||
{
|
||||
return variant(get_recruitment_ignore_bad_movement());
|
||||
|
||||
} else if(key == "recruitment_ignore_bad_combat")
|
||||
{
|
||||
return variant(get_recruitment_ignore_bad_combat());
|
||||
|
||||
} else if(key == "recruitment_pattern")
|
||||
{
|
||||
const std::vector<std::string> &rp = get_recruitment_pattern();
|
||||
std::vector<variant> vars;
|
||||
foreach (const std::string &i, rp) {
|
||||
vars.push_back(variant(i));
|
||||
}
|
||||
return variant(&vars);
|
||||
|
||||
} else if(key == "scout_village_targeting")
|
||||
{
|
||||
return variant(get_scout_village_targeting()*1000,variant::DECIMAL_VARIANT);
|
||||
|
||||
} else if(key == "support_villages")
|
||||
{
|
||||
return variant(get_support_villages());
|
||||
|
||||
} else if(key == "village_value")
|
||||
{
|
||||
return variant(get_village_value()*1000,variant::DECIMAL_VARIANT);
|
||||
|
||||
} else if(key == "villages_per_scout")
|
||||
{
|
||||
return variant(get_villages_per_scout());
|
||||
|
||||
} else if(key == "attacks")
|
||||
{
|
||||
return get_attacks_as_variant();
|
||||
|
|
Loading…
Add table
Reference in a new issue