mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-08 13:20:09 +00:00
Notice when a unit moving to attack should be a support target.
This commit is contained in:
parent
dbfa0f7652
commit
cf2cebd541
@ -1208,6 +1208,7 @@ bool ai::do_combat(std::map<map_location,paths>& possible_moves, const move_map&
|
|||||||
|
|
||||||
std::vector<attack_analysis>::iterator choice_it = analysis.end();
|
std::vector<attack_analysis>::iterator choice_it = analysis.end();
|
||||||
double choice_rating = -1000.0;
|
double choice_rating = -1000.0;
|
||||||
|
double vuln = 0.0;
|
||||||
for(std::vector<attack_analysis>::iterator it = analysis.begin();
|
for(std::vector<attack_analysis>::iterator it = analysis.begin();
|
||||||
it != analysis.end(); ++it) {
|
it != analysis.end(); ++it) {
|
||||||
|
|
||||||
@ -1231,6 +1232,7 @@ bool ai::do_combat(std::map<map_location,paths>& possible_moves, const move_map&
|
|||||||
if(rating > choice_rating) {
|
if(rating > choice_rating) {
|
||||||
choice_it = it;
|
choice_it = it;
|
||||||
choice_rating = rating;
|
choice_rating = rating;
|
||||||
|
vuln = it->vulnerability/it->support;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1253,6 +1255,9 @@ bool ai::do_combat(std::map<map_location,paths>& possible_moves, const move_map&
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vuln > 1.5)
|
||||||
|
add_target(target(to, vuln,target::SUPPORT));
|
||||||
|
|
||||||
// Recalc appropriate weapons here: AI uses approximations.
|
// Recalc appropriate weapons here: AI uses approximations.
|
||||||
game_events::fire("consider attack", to, target_loc);
|
game_events::fire("consider attack", to, target_loc);
|
||||||
battle_context bc(map_, teams_, units_, state_,
|
battle_context bc(map_, teams_, units_, state_,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user