It works, kinda, but I need to unequip and equip the weapon to get it note the wielder effects. Also, I've seen some cases where when it removes, certain stats are lowered to below starting (i.e. 4% physical penetration, levels up to 8%, remove it, now I have a base -4% physical penetration).
What I'd like to do is when it does the upgrade bit is:
1) remove the weapon in question from its inventory (whether MAINHAND, OFFHAND, or PSIONIC FOCUS), decreasing stats as approriate
2) Changes it properties
3) Re-equip, ignoring any requirements (and hopefully increasing stats and traits appropriately)
Code: Select all
do_trigger = function(self,t,target)
if target and not target.weapon_bond_done then
target.weapon_bond_done = true
if self:getInven(self.INVEN_MAINHAND) then
for i, o in ipairs(self:getInven(self.INVEN_MAINHAND)) do
if (o.combat and (o.combat.talented == "axe" or o.combat.talented == "sword" or o.combat.talented == "mace" or o.combat.talented == "whip" or o.combat.talented == "trident" or o.combat.talented == "knife")) or (o.special_combat and o.special_combat.talented == "shield") then
t.do_upgrade(self,t,i,o,target)
end
end
end
if self:getInven(self.INVEN_OFFHAND) then
for i, o in ipairs(self:getInven(self.INVEN_OFFHAND)) do
if (o.combat and (o.combat.talented == "axe" or o.combat.talented == "sword" or o.combat.talented == "mace" or o.combat.talented == "whip" or o.combat.talented == "trident" or o.combat.talented == "knife")) or (o.special_combat and o.special_combat.talented == "shield") then
t.do_upgrade(self,t,i,o,target)
end
end
end
if self:getInven("PSIONIC_FOCUS") then
for i,o in ipairs(self:getInven("PSIONIC_FOCUS")) do
if type(o) == "boolean" then o = nil end
if o and ((o.combat and (o.combat.talented == "axe" or o.combat.talented == "sword" or o.combat.talented == "mace" or o.combat.talented == "whip" or o.combat.talented == "trident" or o.combat.talented == "knife")) or (o.special_combat and o.special_combat.talented == "shield")) then
t.do_upgrade(self,t,i,o,target)
end
end
end
end
Code: Select all
do_upgrade = function(self,t,inven,o,target)
... some stuff ...
local object = self:removeObject(inven, 1)
At the end, I'm guessing I'll need to do a
Code: Select all
self:addObject(inven, object)