Bottleneck Micro AI: simplify a conditional
Use elseif and no need to check experience again, that is already done earlier.
This commit is contained in:
parent
bc956b3e7f
commit
30e1fd1742
1 changed files with 6 additions and 9 deletions
|
@ -399,15 +399,12 @@ function ca_bottleneck_move:evaluation(cfg, data)
|
|||
-- Weakest enemy is best (favors stronger weapon)
|
||||
level_up_rating = 15000 - def_stats.average_hp
|
||||
end
|
||||
else
|
||||
if (unit.max_experience - unit.experience <= wesnoth.game_config.kill_experience * eff_defender_level)
|
||||
and (att_stats.hp_chance[0] == 0)
|
||||
and (def_stats.hp_chance[0] >= 0.66)
|
||||
and (att_stats.average_hp >= 20)
|
||||
then
|
||||
-- Strongest attacker and weakest enemy is best
|
||||
level_up_rating = 14000 + att_stats.average_hp - def_stats.average_hp / 2.
|
||||
end
|
||||
elseif (att_stats.hp_chance[0] == 0)
|
||||
and (def_stats.hp_chance[0] >= 0.66)
|
||||
and (att_stats.average_hp >= 20)
|
||||
then
|
||||
-- Strongest attacker and weakest enemy is best
|
||||
level_up_rating = 14000 + att_stats.average_hp - def_stats.average_hp / 2.
|
||||
end
|
||||
|
||||
-- Small penalty if there's a unit in the way
|
||||
|
|
Loading…
Add table
Reference in a new issue