ExpAI: Encourage forward advancement when capturing villages
This commit is contained in:
parent
9c86a71ef7
commit
948147550a
1 changed files with 6 additions and 0 deletions
|
@ -310,6 +310,8 @@ return {
|
|||
if wesnoth.is_enemy(owner, wesnoth.current.side) then village_rating = village_rating + 20000 end
|
||||
end
|
||||
|
||||
local enemy_distance_from_village = AH.get_closest_enemy(v)
|
||||
|
||||
-- Now we go on to the unit-dependent rating
|
||||
local best_unit_rating = 0
|
||||
local reachable = false
|
||||
|
@ -335,6 +337,10 @@ return {
|
|||
-- Finally, since these can be reached by the enemy, want the strongest unit to go first
|
||||
rating = rating + u.hitpoints / 100.
|
||||
|
||||
-- Prefer not backtracking and moving more distant units to capture villages
|
||||
local enemy_distance_from_unit = AH.get_closest_enemy({u.x, u.y})
|
||||
rating = rating - (enemy_distance_from_village + enemy_distance_from_unit)/5
|
||||
|
||||
if (rating > best_unit_rating) then
|
||||
best_unit_rating, best_unit = rating, u
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue