function damageSystem_onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if creature:isPlayer() then
if creature:isFakeDead() then return 0 end
if getSV(creature, SV.player_ignoreDamage) == 1 then return 0 end
if getSV(creature, SV.playerIsDead) == 1 then return 0 end
setSV(creature, SV.lastDmg, os.time())
end
if creature:getCondition(INVISIBLE, 1) then return 0 end
if attacker and attacker:isPlayer() then setSV(attacker, SV.lastHit, os.time()) end
primaryDamage = tauntCreatures(creature, attacker, primaryDamage, primaryType, origin)
primaryDamage = bufferMonsters(creature, attacker, primaryDamage, primaryType, origin)
primaryDamage = baseDamage(creature, attacker, primaryDamage, secondaryDamage, primaryType, origin)
primaryDamage = damageModifers1(creature, attacker, primaryDamage, primaryType, origin)
primaryDamage = playerResistance(creature, attacker, primaryDamage, primaryType)
primaryDamage = damageModifers2(creature, attacker, primaryDamage, primaryType)
primaryDamage = playerArmor(creature, attacker, primaryDamage, primaryType)
primaryDamage = damageModifers3(creature, attacker, primaryDamage, primaryType)
primaryDamage = playerDefence(creature, attacker, primaryDamage, primaryType)
primaryDamage = damageModifers4(creature, attacker, primaryDamage, primaryType, origin)
primaryDamage = finalDamage(creature, attacker, primaryDamage, primaryType)
if primaryDamage == 0 and antiSpam(creature:getId(), 20) then creature:getPosition():sendMagicEffect(4) end
return primaryDamage, primaryType
end