local storage_attack = 1235 -- value of monster bonus damage, ex. set it to 5 for 5% but if you want to disable it set to -1
local storage_defense = 1236 -- value of monster bonus defense, ex. set it to 5 for 5% but if you want to disable it set to -1
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if creature:isPlayer() and attacker:isMonster() then
local bonus_damage = attacker:getStorageValue(storage_attack)
if bonus_damage > 0 then
multip = 1 + (bonus_damage / 100)
return primaryDamage * multip, primaryType, secondaryDamage, secondaryType
end
end
if creature:isMonster() and attacker:isPlayer() then
local bonus_defense = creature:getStorageValue(storage_defense)
if bonus_defense > 0 then
multip = math.max(0, 1 - (bonus_defense / 100))
return primaryDamage * multip, primaryType, secondaryDamage * multip, secondaryType
end
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
function onManaChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if creature:isPlayer() and attacker:isMonster() then
local bonus_damage = attacker:getStorageValue(storage_attack)
if bonus_damage > 0 then
multip = 1 + (bonus_damage / 100)
return primaryDamage * multip, primaryType, secondaryDamage, secondaryType
end
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end