Index: scripts/globals/abilities/spirit_link.lua =================================================================== --- scripts/globals/abilities/spirit_link.lua (revision 1734) +++ scripts/globals/abilities/spirit_link.lua (working copy) @@ -10,20 +10,38 @@ ----------------------------------- function OnUseAbility(player, target, ability) - drainpct = math.random(25,35) / 100; - drainamount = 0; - if((player:getHP()/player:getMaxHP()) < drainpct) then --using this will kill you, so use up to 1HP + local skin = player:getMod(MOD_STONESKIN); + local drainpct = math.random(25,35) / 100; + local drainamount = 0; + local playerHP = player:getHP(); + local playerMaxHP = player:getMaxHP(); + if (skin > 0) then + drainamount = drainpct*playerMaxHP; + if((skin + playerHP) < drainamount) then + drainamount = playerHP - 1 + skin; + player:delMod(MOD_STONESKIN,skin); + player:delStatusEffect(EFFECT_STONESKIN); + player:setHP(1); + else + player:delMod(MOD_STONESKIN,drainamount); + player:delHP((drainamount-skin)); + end + elseif((playerHP/playerMaxHP) < drainpct) then --using this will kill you, so use up to 1HP drainamount = player:getHP() - 1; player:setHP(1); else drainamount = drainpct*player:getMaxHP(); - player:delHP(drainpct*player:getMaxHP()); + player:delHP(drainamount); end - drainamount = drainamount * 2; - + if(player:getEquipID(4)==15238) then + drainamount = drainamount + 15; + end player:petAddHP(drainamount); --add the hp to pet player:addTP(player:petGetTP()/2); --add half pet tp to you player:petTP(player:petGetTP()/2); -- remove half tp from pet - + if (player:getMod(MOD_STONESKIN)<=0) then + player:setMod(MOD_STONESKIN,0); + player:delStatusEffect(EFFECT_STONESKIN); + end end;