Skip to content

Commit

Permalink
WC: A few more little fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Feb 20, 2021
1 parent 3efe297 commit 9e0914e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion data/campaigns/World_Conquest/lua/campaign/enemy.lua
Expand Up @@ -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 "")
Expand Down
5 changes: 4 additions & 1 deletion data/campaigns/World_Conquest/lua/era/era.lua
Expand Up @@ -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
Expand Down
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions data/campaigns/World_Conquest/lua/game_mechanics/effects.lua
Expand Up @@ -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")
Expand Down
Expand Up @@ -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])
Expand Down Expand Up @@ -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) ..")")
Expand Down

0 comments on commit 9e0914e

Please sign in to comment.