local advanceDistance = 4 -- Distância que o jogador avança local damage = 200 -- Dano ao passar sobre o alvo local advanceSpeed = 100 -- Velocidade do avanço (ms entre cada sqm) local dashOutfits = {62, 63, 64, 65} -- Outfits alternados durante o avanço local finalOutfits = {65} -- LookTypes alternados no ponto final local killOutfits = {66, 66, 67, 66, 66, 67, 68, 69, 45} -- LookTypes caso mate o alvo function onCastSpell(creature, variant) if not creature or not creature:isPlayer() then return false end local player = creature:getPlayer() local originalOutfit = player:getOutfit() -- Salvar outfit original local pos = player:getPosition() local dir = player:getDirection() local positionsPassed = {} -- Armazena as posições percorridas local killedTarget = false -- Flag para verificar se um alvo foi morto -- Definir a trajetória baseada na direção do jogador for i = 1, advanceDistance do local newPos = Position(pos.x, pos.y, pos.z) if dir == NORTH then newPos.y = pos.y - i elseif dir == SOUTH then newPos.y = pos.y + i elseif dir == EAST then newPos.x = pos.x + i elseif dir == WEST then newPos.x = pos.x - i elseif dir == NORTHWEST then newPos.x, newPos.y = pos.x - i, pos.y - i elseif dir == NORTHEAST then newPos.x, newPos.y = pos.x + i, pos.y - i elseif dir == SOUTHWEST then newPos.x, newPos.y = pos.x - i, pos.y + i elseif dir == SOUTHEAST then newPos.x, newPos.y = pos.x + i, pos.y + i end local tile = Tile(newPos) if tile and tile:isWalkable() then table.insert(positionsPassed, newPos) else break -- Para o dash ao encontrar um obstáculo end end -- Avançar pelos SQMs alterando os outfits dinamicamente for i, p in ipairs(positionsPassed) do addEvent(function() if player then player:teleportTo(p, true) player:setOutfit({lookType = dashOutfits[(i % #dashOutfits) + 1]}) local tile = Tile(p) if tile then -- Verifica se há criaturas no local e aplica dano for _, creature in ipairs(tile:getCreatures()) do if creature ~= player and (creature:isMonster() or creature:isPlayer()) then local healthBefore = creature:getHealth() creature:addHealth(-damage) -- Se o alvo morreu, define a flag para troca de outfits if healthBefore > 0 and creature:getHealth() <= 0 then killedTarget = true end end end end end playSound(creature, "heal.ogg") -- Se for o último avanço, alterna os outfits antes de voltar ao original if i == #positionsPassed then if killedTarget then for j = 1, #killOutfits do addEvent(function() if player then player:setOutfit({lookType = killOutfits[j]}) end end, j * 100) end addEvent(function() if player then player:setOutfit(originalOutfit) end end, (#killOutfits + 1) * 100) else player:setOutfit({lookType = finalOutfits[1]}) addEvent(function() if player then player:setOutfit(originalOutfit) end end, 100) end end end, i * advanceSpeed) end return true end