WC: A few more little fixes

This commit is contained in:
Celtic Minstrel 2021-02-20 17:47:08 -05:00
parent 3efe2973e8
commit 9e0914ebfa
5 changed files with 11 additions and 8 deletions

View file

@ -161,7 +161,7 @@ function enemy.do_recall(cfg, group_id, loc)
local side_variables = wesnoth.sides[side_num].variables
local group = wml.variables[("wc2_enemy_army.group[%d]"):format(group_id)]
local to_recall = stringx.split(side_variables["wc2.to_recall"])
local to_recall = stringx.split(side_variables["wc2.to_recall"] or "")
local function recall_level(level)
local amount = wml.get_child(cfg, "recall")["level" .. level] or 0
local types = stringx.split(wml.get_child(group, "recall")["level" .. level] or "")

View file

@ -251,7 +251,10 @@ function wc2_era.expand_hero_types(types_str)
table.insert(types_res, v)
elseif wc2_era.hero_types[v] then
local group = wc2_era.hero_types[v]
stringx.split(group.types, types_new)
local these_types = stringx.split(group.types)
for j,type in ipairs(these_types) do
table.insert(types_new, type)
end
else
wesnoth.message("WCII ERROR", "unknown deserter group: '" .. v .. "'")
end

View file

@ -41,7 +41,7 @@ on_event("attack_end", function(cx)
if not u then
return
end
if not u:matches { wml.tag.has_attack { special_active = "wc2_disengage"} } then
if not u:matches { wml.tag.has_attack { special_id_active = "wc2_disengage"} } then
--IMPORTANT: using 'special_active' like this is only guaranteed to work if
-- the attack has a [filter_self] or a simlar filter tag, otherwise it might
-- also fire when another attack that is not the currently used attack has

View file

@ -108,9 +108,9 @@ end
-- Sets the auro accordingly if unit might have multiple of illumination, darkness or forcefield abilities.
function wesnoth.effects.wc2_update_aura(u, cfg)
local illuminates = wesnoth.match_unit(u, { ability = "illumination" } )
local darkens = wesnoth.match_unit(u, { ability = "darkness" } )
local forcefield = wesnoth.match_unit(u, { ability = "forcefield" } )
local illuminates = wesnoth.units.matches(u, { ability = "illumination" } )
local darkens = wesnoth.units.matches(u, { ability = "darkness" } )
local forcefield = wesnoth.units.matches(u, { ability = "forcefield" } )
local halo = ""
if illuminates and darkens then
wesnoth.message("WC2", "Warning illuminates and darkens discovered on a unit")

View file

@ -6,7 +6,7 @@ local wc2_invest = {}
function wc2_invest.add_items(side_num, num_items)
local side = wesnoth.sides[side_num]
local items_left = stringx.split(side.variables["wc2.items_left"])
local items_available = stringx.split(side.variables["wc2.items"])
local items_available = stringx.split(side.variables["wc2.items"] or "")
for j = 1, num_items do
local i = wesnoth.random(#items_left)
table.insert(items_available, items_left[i])
@ -117,7 +117,7 @@ function wc2_invest.do_item(t)
local leaders = wesnoth.units.find_on_map { side = side_num, canrecruit = true }
local x,y = leaders[1].x, leaders[1].y
local items_available = stringx.split(side.variables["wc2.items"], {}, tonumber)
local items_available = stringx.split(side.variables["wc2.items"])
local i = find_index(items_available, tostring(t))
if i == nil then
error("wc2 invest: invalid item pick '" .. t .. "' (" .. type(t) ..")")