Dark Steps.lua

main 89 lines · 3.8 KB Raw
Alex Alex Commit Server upload 18/10/2026 23:38
1
2local damage = 200 -- Dano ao passar sobre o alvo
3
4
5local finalOutfits = {65} -- LookTypes alternados no ponto final
6local killOutfits = {66, 66, 67, 66, 66, 67, 68, 69, 45} -- LookTypes caso mate o alvo
7
8function onCastSpell(creature, variant)
9 if not creature or not creature:isPlayer() then
10 return false
11 end
12
13 local player = creature:getPlayer()
14 local originalOutfit = player:getOutfit() -- Salvar outfit original
15
16 local pos = player:getPosition()
17 local dir = player:getDirection()
18
19 local killedTarget = false -- Flag para verificar se um alvo foi morto
20
21
22 for i = 1, advanceDistance do
23 local newPos = Position(pos.x, pos.y, pos.z)
24
25 if dir == NORTH then newPos.y = pos.y - i
26 elseif dir == SOUTH then newPos.y = pos.y + i
27 elseif dir == EAST then newPos.x = pos.x + i
28 elseif dir == WEST then newPos.x = pos.x - i
29 elseif dir == NORTHWEST then newPos.x, newPos.y = pos.x - i, pos.y - i
30 elseif dir == NORTHEAST then newPos.x, newPos.y = pos.x + i, pos.y - i
31 elseif dir == SOUTHWEST then newPos.x, newPos.y = pos.x - i, pos.y + i
32 elseif dir == SOUTHEAST then newPos.x, newPos.y = pos.x + i, pos.y + i
33 end
34
35 local tile = Tile(newPos)
36 if tile and tile:isWalkable() then
37 table.insert(positionsPassed, newPos)
38 else
39
40 end
41 end
42
43
44 for i, p in ipairs(positionsPassed) do
45 addEvent(function()
46 if player then
47 player:teleportTo(p, true)
48 player:setOutfit({lookType = dashOutfits[(i % #dashOutfits) + 1]})
49
50 local tile = Tile(p)
51 if tile then
52
53 for _, creature in ipairs(tile:getCreatures()) do
54 if creature ~= player and (creature:isMonster() or creature:isPlayer()) then
55 local healthBefore = creature:getHealth()
56 creature:addHealth(-damage)
57
58 -- Se o alvo morreu, define a flag para troca de outfits
59 if healthBefore > 0 and creature:getHealth() <= 0 then
60 killedTarget = true
61 end
62 end
63 end
64 end
65 end
66 playSound(creature, "heal.ogg")
67
68 if i == #positionsPassed then
69 if killedTarget then
70 for j = 1, #killOutfits do
71 addEvent(function()
72 if player then player:setOutfit({lookType = killOutfits[j]}) end
73 end, j * 100)
74 end
75 addEvent(function()
76 if player then player:setOutfit(originalOutfit) end
77 end, (#killOutfits + 1) * 100)
78 else
79 player:setOutfit({lookType = finalOutfits[1]})
80 addEvent(function()
81 if player then player:setOutfit(originalOutfit) end
82 end, 100)
83 end
84 end
85 end, i * advanceSpeed)
86 end
87
88 return true
89end
Top