Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local config = {
- times = 4,
- speed = 350, -- em milisegundos
- min_damage = 1000,
- max_damage = 1600,
- }
- local pos = {
- [0] = {y = -1},
- [1] = {x = 1},
- [2] = {y = 1},
- [3] = {x = -1},
- }
- local area_walk = {
- [0] = createCombatArea({
- {0, 0, 0},
- {1, 2, 1},
- {0, 0, 0},
- }),
- [1] = createCombatArea({
- {0, 1, 0},
- {0, 2, 0},
- {0, 1, 0},
- }),
- [2] = createCombatArea({
- {0, 0, 0},
- {1, 2, 1},
- {0, 0, 0},
- }),
- [3] = createCombatArea({
- {0, 1, 0},
- {0, 2, 0},
- {0, 1, 0},
- }),
- }
- local areas = {
- [0] = createCombatArea({
- {0, 0, 0},
- {0, 2, 0},
- {1, 1, 1},
- }),
- [1] = createCombatArea({
- {1, 0, 0},
- {1, 2, 0},
- {1, 0, 0},
- }),
- [2] = createCombatArea({
- {1, 1, 1},
- {0, 2, 0},
- {0, 0, 0},
- }),
- [3] = createCombatArea({
- {0, 0, 1},
- {0, 2, 1},
- {0, 0, 1},
- }),
- }
- function isWalkablelks(cid, pos)
- pos.stackpos = 0
- if getTileThingByPos(pos).uid ~= 0 then
- local n = getTileInfo(pos)
- if n.protection == false and n.house == false and getTopCreature(pos).uid == 0 and doTileQueryAdd(cid, pos) == RETURNVALUE_NOERROR then
- return true
- end
- end
- return false
- end
- local function Walk(cid, dir, times, atime)
- local function doSendAura(cid)
- mayNotMove(cid, false)
- end
- local move = mayNotMove(cid, false)
- local atime = atime or 1
- if isCreature(cid) then
- if atime < times then
- local cp = getThingPos(cid)
- local x = pos[dir].x or 0
- local y = pos[dir].y or 0
- local topos = {x = cp.x + x, y = cp.y + y, z = cp.z}
- local efeitox = {x=cp.x+4, y=cp.y-2, z=cp.z}
- local target = getTopCreature(topos).uid
- if not getTilePzInfo(topos) and isCreature(target) and not isNpc(target) then
- doAreaCombatHealth(cid, COMBAT_ENERGYDAMAGE, getThingPos(cid), areas[dir], -config.min_damage, -config.max_damage, 4)
- doCreatureSay(cid, 'Hakunamatata!', 19)
- mayNotMove(cid, false)
- addEvent(doSendAura, 1500, cid)
- setPlayerStorageValue(cid, 24753, -1)
- return false
- elseif isWalkablelks(cid, topos) then
- doAreaCombatHealth(cid, COMBAT_ENERGYDAMAGE, getThingPos(cid), area_walk[dir], -config.min_damage, -config.max_damage, 4)
- doTeleportThing(cid, topos)
- else
- doSendMagicEffect(cp, 3)
- addEvent(doSendAura, 1500, cid)
- setPlayerStorageValue(cid, 24753, -1)
- return false
- end
- addEvent(Walk, config.speed, cid, dir, times, atime + 1)
- return true
- end
- addEvent(doSendAura, 1500, cid)
- setPlayerStorageValue(cid, 24753, -1)
- end
- return false
- end
- function onCastSpell(cid, var)
- if getPlayerStorageValue(cid, 24753) > 0 then
- return false
- end
- Walk(cid, getCreatureLookDirection(cid), config.times)
- mayNotMove(cid, true)
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment