function onStatsChange(cid, attacker, type, combat, value) if type == STATSCHANGE_HEALTHLOSS then if isCreature(attacker) then if math.random(100) <= 50 then if combat == COMBAT_ICEDAMAGE then if getPlayerStorageValue(cid, 99123) >= 1 then doAreaCombatHealth(cid, COMBAT_ICEDAMAGE, getThingPos(attacker), 0, - value, - value, 43) doSendMagicEffect(getThingPos(cid), 43) doSendAnimatedText(getThingPos(cid), "REFLECT.", math.random(1, 255)) return false end elseif combat == COMBAT_HOLYDAMAGE then if getPlayerStorageValue(cid, 99124) >= 1 then doAreaCombatHealth(cid, COMBAT_HOLYDAMAGE, getThingPos(attacker), 0, - value, - value, 39) doSendMagicEffect(getThingPos(cid), 39) doSendAnimatedText(getThingPos(cid), "REFLECT.", math.random(1, 255)) return false end elseif combat == COMBAT_DEATHDAMAGE then if getPlayerStorageValue(cid, 99125) >= 1 then doAreaCombatHealth(cid, COMBAT_DEATHDAMAGE, getThingPos(attacker), 0, - value, - value, 17) doSendMagicEffect(getThingPos(cid), 17) doSendAnimatedText(getThingPos(cid), "REFLECT.", math.random(1, 255)) return false end elseif combat == COMBAT_PHYSICALDAMAGE then if getPlayerStorageValue(cid, 99126) >= 1 then doAreaCombatHealth(cid, COMBAT_PHYSICALDAMAGE, getThingPos(attacker), 0, - value, - value, 3) doSendMagicEffect(getThingPos(cid), 3) doSendAnimatedText(getThingPos(cid), "REFLECT.", math.random(1, 255)) return false end elseif combat == COMBAT_ENERGYDAMAGE then if getPlayerStorageValue(cid, 99127) >= 1 then doAreaCombatHealth(cid, COMBAT_ENERGYDAMAGE, getThingPos(attacker), 0, - value, - value, 11) doSendMagicEffect(getThingPos(cid), 11) doSendAnimatedText(getThingPos(cid), "REFLECT.", math.random(1, 255)) return false end elseif combat == COMBAT_EARTHDAMAGE then if getPlayerStorageValue(cid, 99128) >= 1 then doAreaCombatHealth(cid, COMBAT_EARTHDAMAGE, getThingPos(attacker), 0, - value, - value, 45) doSendMagicEffect(getThingPos(cid), 45) doSendAnimatedText(getThingPos(cid), "REFLECT.", math.random(1, 255)) return false end elseif combat == COMBAT_POISONDAMAGE then if getPlayerStorageValue(cid, 99129) >= 1 then doAreaCombatHealth(cid, COMBAT_POISONDAMAGE, getThingPos(attacker), 0, - value, - value, 8) doSendMagicEffect(getThingPos(cid), 8) doSendAnimatedText(getThingPos(cid), "REFLECT.", math.random(1, 255)) return false end elseif combat == COMBAT_FIREDAMAGE then if getPlayerStorageValue(cid, 99130) >= 1 then doAreaCombatHealth(cid, COMBAT_FIREDAMAGE, getThingPos(attacker), 0, - value, - value, 15) doSendMagicEffect(getThingPos(cid), 15) doSendAnimatedText(getThingPos(cid), "REFLECT.", math.random(1, 255)) return false end end end end end return true end