Skip to content

Commit

Permalink
High XP attack CA: don't attack hidden enemies
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsc committed Sep 23, 2016
1 parent 22fc02e commit d3a3825
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion data/ai/lua/ca_high_xp_attack.lua
Expand Up @@ -53,7 +53,9 @@ function ca_attack_highxp:evaluation(cfg, data)
-- but it is much faster than path finding, so it is done for preselection.
local target_infos = {}
for i_t,enemy in ipairs(all_units) do
if wesnoth.is_enemy(wesnoth.current.side, enemy.side) then
if wesnoth.is_enemy(wesnoth.current.side, enemy.side)
and enemy:matches({ { "filter_vision", { side = wesnoth.current.side, visible = 'yes' } } })
then
local XP_to_levelup = enemy.max_experience - enemy.experience
if (max_unit_level >= XP_to_levelup) then
local potential_target = false
Expand Down

0 comments on commit d3a3825

Please sign in to comment.