local c = {
storage = 41523,
time = 4
}
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH)
local function doBlockEffect(cid)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
doSendAnimatedText(getPlayerPosition(cid), "Blocked", COLOR_RED)
end
function onCastSpell(cid, var)
local target = getTopCreature(variantToPosition(var)).uid
if not isPlayer(target) then
target = cid
end
if exhaustion.check(cid, 43534) then
doPlayerSendCancel(cid, "You need to wait "..exhaustion.get(cid, 43534).." seconds before you can use the rune again.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return false
end
if exhaustion.check(target, c.storage) then
local n = target == cid and "You are" or getPlayerName(target).." is"
doPlayerSendCancel(cid, n.." already blocking attacks.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return false
end
exhaustion.set(cid, 43534, 60)
exhaustion.set(target, c.storage, c.time)
doSendAnimatedText(getPlayerPosition(target), "Blocked", COLOR_RED)
doSendMagicEffect(getPlayerPosition(target), CONST_ME_MAGIC_RED)
doCombat(cid, combat, var)
for x = 1, c.time do
addEvent(doBlockEffect, x * 1000, target)
end
return true
end