 local function UpdateDamage(inst)     if inst.components.weapon and inst.components.inventoryitem then         local caster = inst.components.inventoryitem.owner         if caster and caster:HasTag("tryndamere") then             local dmg = inst.basicdamage + (1-caster.components.health:GetPercent())*TUNING.DAMAGE_HEALTH             inst.components.weapon:SetDamage(dmg)         end     end end  local function OnLoad(inst, data)     UpdateDamage(inst) end  local function onunequip(inst, owner)     if inst.components.weapon then         inst.components.weapon:SetDamage(inst.basicdamage)     end     if owner:HasTag("tryndamere") then         owner.critical = 0     end     owner.AnimState:Hide("ARM_carry")     owner.AnimState:Show("ARM_normal") end  local function MakeSword(name, critical, damage)     local assets =     {         Asset("ANIM", "anim/"..name..".zip"),         Asset("ANIM", "anim/swap_"..name..".zip"),     }     local function onequip(inst, owner)         if owner:HasTag("tryndamere") then             owner.critical = inst.critical         end         UpdateDamage(inst)         owner.AnimState:OverrideSymbol("swap_object", "swap_"..name, name)         owner.AnimState:Show("ARM_carry")         owner.AnimState:Hide("ARM_normal")     end     local function fn()         local inst = CreateEntity()          inst.entity:AddTransform()         inst.entity:AddAnimState()         inst.entity:AddNetwork()          MakeInventoryPhysics(inst)          inst.AnimState:SetBank(name)         inst.AnimState:SetBuild(name)         inst.AnimState:PlayAnimation("idle_90s")          inst.entity:SetPristine()         inst.basicdamage = damage         inst.critical = critical          if not TheWorld.ismastersim then             return inst         end          inst:AddComponent("weapon")         inst.components.weapon:SetDamage(damage)         inst.components.weapon:SetOnAttack(UpdateDamage)          inst.OnLoad = OnLoad          inst:AddComponent("inspectable")          inst:AddComponent("inventoryitem")         inst.components.inventoryitem.atlasname = "images/inventoryimages/"..name..".xml"         inst.components.inventoryitem.imagename = name          inst:AddComponent("equippable")         inst.components.equippable:SetOnEquip(onequip)         inst.components.equippable:SetOnUnequip(onunequip)          MakeHauntableLaunch(inst)          return inst     end     return Prefab( name, fn, assets)  end return MakeSword("mysword",20,20),        MakeSword("hugesword",35,40),        MakeSword("kingsword",50,60)