Support as_type=weapon in [variable]formula=

This commit is contained in:
Celtic Minstrel 2022-12-06 01:52:38 -05:00
parent bb8b710676
commit 6d3dd6a175

View file

@ -27,7 +27,8 @@ function wesnoth.wml_conditionals.variable(cfg)
local value = wml.variables[cfg.name]
if cfg.as_type == 'unit' then
value = wesnoth.units.create(value)
-- TODO: Consider supporting other types.
elseif cfg.as_type == 'weapon' then
value = wesnoth.units.create_weapon(value)
end
local result = wesnoth.eval_formula(cfg.formula, {value = value})
-- WFL considers 0 as false; Lua doesn't