From 47e7c114c100e3b0ffe5d6fb5afbbc7da987970d Mon Sep 17 00:00:00 2001 From: white-haired-uncle Date: Sat, 25 May 2024 15:47:15 -0400 Subject: [PATCH] remove a lot from items stored on unit --- lua/items.lua | 17 +++++++---------- lua/unitdata.lua | 4 +++- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/lua/items.lua b/lua/items.lua index 016898ef..573cc9c0 100644 --- a/lua/items.lua +++ b/lua/items.lua @@ -926,16 +926,13 @@ loti.item.describe_item = function(number, sort, set_items) elseif effect.set == "lawful" then line = "" .. _"Sets alignment to lawful" .. "" elseif effect.set == "neutral" then line = "" .. _"Sets alignment to neutral" .. "" end elseif effect.apply_to == "status" then - for part in string.gmatch(effect.add, '([^,]+)') do - if line then table.insert(desc, line) end - if part == "unpoisonable" then line = "" .. _"Immune to Poison" .. "" - elseif part == "unslowable" then line = "" .. _"Immune to Slow" .. "" - elseif part == "undrainable" then line = "" .. _"Immune to Drain" .. "" - elseif part == "unplaguable" then line = "" .. _"Immune to Plague" .. "" - elseif part == "unpretrifiable" then line = "" .. _"Immune to Petrify" .. "" - elseif part == "unhealable" then line = "" .. _"Unhealable" .. "" - elseif part == "invulnerable" then line = "" .. _"Invulnerable" .. "" end - end + if effect.add == "unpoisonable" then line = "" .. _"Immune to Poison" .. "" + elseif effect.add == "unslowable" then line = "" .. _"Immune to Slow" .. "" + elseif effect.add == "undrainable" then line = "" .. _"Immune to Drain" .. "" + elseif effect.add == "unplaguable" then line = "" .. _"Immune to Plague" .. "" + elseif effect.add == "unpretrifiable" then line = "" .. _"Immune to Petrify" .. "" + elseif effect.add == "unhealable" then line = "" .. _"Unhealable" .. "" + elseif effect.add == "invulnerable" then line = "" .. _"Invulnerable" .. "" end elseif effect.apply_to == "bonus_attack" then line = "" .. _"Bonus attack: " .. effect.description .. "" elseif effect.apply_to == "status" and effect.add == "not_living" then diff --git a/lua/unitdata.lua b/lua/unitdata.lua index 26caa524..86f97e30 100644 --- a/lua/unitdata.lua +++ b/lua/unitdata.lua @@ -312,7 +312,9 @@ local wml_based_implementation = { add_item = function(unit, item_number, item_sort) unit = normalize_unit_param(unit) - local item = wesnoth.deepcopy(loti.item.type[item_number]) + local item = {} + item.number = item_number + item.name = loti.item.type[item_number].name if item_sort then item.sort = item_sort end