-- Stone Skin Amulet Damage Increased
ITEM_STONE_SKIN_AMULET = 2197
local hasSSA = function (item)
return item and item:getId() == ITEM_STONE_SKIN_AMULET
end
local ec = EventCallback
function ec.onLook(player, thing, position, distance, description)
if thing:isItem() and hasSSA(thing) then
return description:gsub("protection physical %+%d-%%%, death %+%d+%%", string.format("protection physical +%d%%%%, death +%d%%%%, +5%%%% damage increased", description:match("protection physical %+(%d-)%%, death %+(%d+)%%")))
end
return description
end
ec:register(4)
function ec.onTargetCombat(creature, target)
if creature and target then
local player = creature:getPlayer()
if player and hasSSA(player:getSlotItem(CONST_SLOT_NECKLACE)) then
target:registerEvent("SSADamageIncreasedHP")
target:registerEvent("SSADamageIncreasedMP")
end
end
return RETURNVALUE_NOERROR
end
ec:register(4)
local applyDamage = function (creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType)
if attacker and attacker:isPlayer() then
if hasSSA(attacker:getSlotItem(CONST_SLOT_NECKLACE)) then
return math.floor(primaryDamage * 1.05), primaryType, math.floor(secondaryDamage * 1.05), secondaryType
end
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
local creatureEvent = CreatureEvent("SSADamageIncreasedHP")
creatureEvent.onHealthChange = applyDamage
creatureEvent:register()
creatureEvent = CreatureEvent("SSADamageIncreasedMP")
creatureEvent.onManaChange = applyDamage
creatureEvent:register()