diff --git a/data/ai/lua/generic_rush_engine.lua b/data/ai/lua/generic_rush_engine.lua index 70aecbc3150..2ac89365171 100644 --- a/data/ai/lua/generic_rush_engine.lua +++ b/data/ai/lua/generic_rush_engine.lua @@ -93,7 +93,7 @@ return { local leader = wesnoth.get_units { side = wesnoth.current.side, canrecruit = 'yes', - formula = '($this_unit.moves = $this_unit.max_moves) and ($this_unit.hitpoints = $this_unit.max_hitpoints)' + formula = '(movement_left = total_movement) and (hitpoints = max_hitpoints)' }[1] if not leader then -- CA is irrelevant if no leader or the leader may have moved from another CA @@ -266,7 +266,7 @@ return { -- Check if there are units with moves left local units = wesnoth.get_units { side = wesnoth.current.side, canrecruit = 'no', - formula = '$this_unit.moves > 0' + formula = 'movement_left > 0' } if (not units[1]) then if AH.print_eval() then AH.done_eval_messages(start_time, ca_name) end @@ -408,7 +408,7 @@ return { -- If a unit with a poisoned weapon can make an attack, we'll do that preferentially -- (with some exceptions) local poisoners = AH.get_live_units { side = wesnoth.current.side, - formula = '$this_unit.attacks_left > 0', + formula = 'attacks_left > 0', { "filter_wml", { { "attack", { { "specials", { @@ -523,7 +523,7 @@ return { function generic_rush:retreat_injured_units_eval() local units = wesnoth.get_units { side = wesnoth.current.side, - formula = '$this_unit.moves > 0' + formula = 'movement_left > 0' } local unit, loc = R.retreat_injured_units(units) if unit then @@ -574,7 +574,7 @@ return { local units = wesnoth.get_units { side = wesnoth.current.side, canrecruit = false, - formula = '$this_unit.moves > 0' + formula = 'movement_left > 0' } if not units[1] then @@ -588,7 +588,7 @@ return { local unit = wesnoth.get_units({ side = wesnoth.current.side, canrecruit = false, - formula = '$this_unit.moves > 0' + formula = 'movement_left > 0' })[1] local villages = wesnoth.get_villages() diff --git a/data/ai/lua/move_to_any_target.lua b/data/ai/lua/move_to_any_target.lua index ef732b7ff9e..b5ef77b2583 100644 --- a/data/ai/lua/move_to_any_target.lua +++ b/data/ai/lua/move_to_any_target.lua @@ -8,7 +8,7 @@ return { local units = wesnoth.get_units { side = wesnoth.current.side, canrecruit = 'no', - formula = '$this_unit.moves > 0' + formula = 'movement_left > 0' } if (not units[1]) then diff --git a/data/campaigns/Eastern_Invasion/ai/ca_ogres_flee.lua b/data/campaigns/Eastern_Invasion/ai/ca_ogres_flee.lua index 59b69632365..d4dac33cdd3 100644 --- a/data/campaigns/Eastern_Invasion/ai/ca_ogres_flee.lua +++ b/data/campaigns/Eastern_Invasion/ai/ca_ogres_flee.lua @@ -7,7 +7,7 @@ local ca_ogres_flee = {} function ca_ogres_flee:evaluation(ai, cfg, self) local units = wesnoth.get_units { side = wesnoth.current.side, - formula = '$this_unit.moves > 0' + formula = 'movement_left > 0' } if (not units[1]) then return 0 end @@ -16,11 +16,11 @@ end function ca_ogres_flee:execution(ai, cfg, self) local units = wesnoth.get_units { side = wesnoth.current.side, - formula = '$this_unit.moves > 0' + formula = 'movement_left > 0' } local units_noMP = wesnoth.get_units { side = wesnoth.current.side, - formula = '$this_unit.moves = 0' + formula = 'movement_left = 0' } local width, height = wesnoth.get_map_size() diff --git a/data/campaigns/Son_Of_The_Black_Eye/ai/ca_transport_S6.lua b/data/campaigns/Son_Of_The_Black_Eye/ai/ca_transport_S6.lua index c6192e710ef..616174fd44e 100644 --- a/data/campaigns/Son_Of_The_Black_Eye/ai/ca_transport_S6.lua +++ b/data/campaigns/Son_Of_The_Black_Eye/ai/ca_transport_S6.lua @@ -11,7 +11,7 @@ local ca_transport = {} -- Also unload units onto best hexes adjacent to landing site function ca_transport:evaluation(ai) - local units = wesnoth.get_units { side = wesnoth.current.side, formula = '$this_unit.moves > 0' } + local units = wesnoth.get_units { side = wesnoth.current.side, formula = 'movement_left > 0' } for i,u in ipairs(units) do local vars = H.get_child(u.__cfg, "variables") diff --git a/data/campaigns/The_Rise_Of_Wesnoth/ai/ca_aggressive_attack_no_suicide.lua b/data/campaigns/The_Rise_Of_Wesnoth/ai/ca_aggressive_attack_no_suicide.lua index 919118c47d4..3cfdd72683e 100644 --- a/data/campaigns/The_Rise_Of_Wesnoth/ai/ca_aggressive_attack_no_suicide.lua +++ b/data/campaigns/The_Rise_Of_Wesnoth/ai/ca_aggressive_attack_no_suicide.lua @@ -6,7 +6,7 @@ function ca_aggressive_attack_no_suicide:evaluation(ai, cfg, self) local units = wesnoth.get_units { side = wesnoth.current.side, - formula = "attacks_left > 0" + formula = 'attacks_left > 0' } --print('#units', #units) if (not units[1]) then return 0 end diff --git a/data/campaigns/The_Rise_Of_Wesnoth/ai/ca_retreat.lua b/data/campaigns/The_Rise_Of_Wesnoth/ai/ca_retreat.lua index ac065926104..241e7a5cdc0 100644 --- a/data/campaigns/The_Rise_Of_Wesnoth/ai/ca_retreat.lua +++ b/data/campaigns/The_Rise_Of_Wesnoth/ai/ca_retreat.lua @@ -7,7 +7,7 @@ function retreat:evaluation(ai, cfg, self) local units = wesnoth.get_units { side = wesnoth.current.side, - formula = 'moves > 0' + formula = 'movement_left > 0' } --print('#units', #units) if (not units[1]) then return 0 end