Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local AREA_CROSS6X6 = {
- {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0},
- {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},
- {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
- {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
- {1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1},
- {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
- {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
- {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},
- {0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}
- }
- function getPosByArea(area, topleftpos)
- arr = {}
- for y, a in pairs(area) do
- arr[y] = {}
- for x, tile in pairs(a) do
- if isInArray({1,3}, tile) then
- arr[y][x] = {x=(x-1)+topleftpos.x, y=(y-1)+topleftpos.y, z=topleftpos.z}
- end
- end
- end
- return arr
- end
- function onCastSpell(cid, var)
- for _,pos in ipairs(getPosByArea(AREA_CROSS6X6), getThingPos(cid)) do
- local f, formula = (getPlayerLevel(cid) + getPlayerMagLevel(cid))*2.5, math.random(f*0.9,f*1.1)
- doSendMagicEffect(pos, CONST_ME_FIREAREA)
- if isCreature(getThingFromPos(pos).uid) then
- if isPlayer(getThingFromPos(pos).uid) then
- doTargetCombatHealth(cid, getThingFromPos(pos).uid, COMBAT_PHYSICALDAMAGE, -formula, -formula, CONST_ME_NONE)
- elseif isMonster(getThingFromPos(pos).uid) then
- doCreatureAddHealth(getThingFromPos(pos).uid, getCreatureHealth(getThingFromPos(pos).uid) >= formula and -formula or getCreatureHealth(getThingFromPos(pos).uid))
- end
- doSendAnimatedText(pos, getCreatureHealth(getThingFromPos(pos).uid) >= formula and formula or getCreatureHealth(getThingFromPos(pos).uid), TEXTCOLOR_RED)
- end
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment