1
2local function showEffectCenter(creature, effect)
3 if creature and not creature:isRemoved() then
4 print("Efeito Centralizado: ", effect) -- Debug
5 creature:getPosition():sendMagicEffect(effect)
6 end
7end
8
9
10local function showEffectAtOffset(creature, effect, offset)
11 if creature and not creature:isRemoved() then
12 local pos = creature:getPosition()
13 pos.x = pos.x + offset.x
14 pos.y = pos.y + offset.y
15
16 pos:sendMagicEffect(effect)
17 end
18end
19
20
21local function applyParalysisEffect(target)
22
23
24 local effect = 237 -- Efeito a ser exibido
25
26 for i = 0, duration, interval do
27 addEvent(function()
28 if target and not target:isRemoved() then
29 target:getPosition():sendMagicEffect(effect)
30 end
31 end, i)
32 end
33end
34
35
36local function applyAreaDamage(creature)
37 local pos = creature:getPosition()
38 local damage = -100
39 local effect = 236
40
41
42 local paralysis = Condition(CONDITION_PARALYZE)
43 paralysis:setParameter(CONDITION_PARAM_TICKS, 3000)
44 paralysis:setParameter(CONDITION_PARAM_SPEED, -1000)
45
46 for x = -2, 2 do
47 for y = -2, 2 do
48 local targetPos = Position(pos.x + x, pos.y + y, pos.z)
49 targetPos:sendMagicEffect(effect)
50
51 local tile = Tile(targetPos)
52 if tile then
53 local target = tile:getTopCreature()
54 if target and target ~= creature then
55 target:addHealth(damage)
56 target:addCondition(paralysis)
57 applyParalysisEffect(target)
58 end
59 end
60 end
61 end
62end
63
64function onCastSpell(creature, var)
65 local waittime = 1
66 local storage = 99916
67
68 if creature:getStorageValue(storage) > os.time() then
69
70 (creature:getStorageValue(storage) - os.time()) .. "] segundos.")
71 return false
72 end
73
74 creature:setStorageValue(storage, os.time() + waittime)
75 local originalOutfit = creature:getOutfit()
76
77 -- Define as outfits para os frames da magia
78 local outfits = {
79 {lookType = 73}, {lookType = 74}, {lookType = 75}, {lookType = 76},
80 {lookType = 77}, {lookType = 78}, {lookType = 79}, {lookType = 80},
81 {lookType = 79}, {lookType = 80}, {lookType = 79}, {lookType = 80},
82 {lookType = 79}, {lookType = 80}, {lookType = 79}, {lookType = 45}
83 }
84
85 -- IDs dos efeitos para teste (use IDs conhecidos: 1 ou 2)
86 local effect1 = {id = 237, offset = {x = 0, y = 0}} -- Testando com ID 1
87 local effect2 = {id = 237, offset = {x = 0, y = 0}} -- Testando com ID 2
88
89
90 -- Teste: Mostra o efeito centralizado
91 addEvent(function()
92 showEffectCenter(creature, effectCenterId)
93 end, 0)
94
95 -- Teste: Mostra os efeitos com offset
96 addEvent(function()
97 showEffectAtOffset(creature, effect1.id, effect1.offset)
98 showEffectAtOffset(creature, effect2.id, effect2.offset)
99 end, 300)
100
101
102 addEvent(function()
103 if not creature or creature:isRemoved() then return end
104 applyAreaDamage(creature)
105 end, 700)
106
107
108 for i = 1, #outfits do
109 addEvent(function()
110 if creature and not creature:isRemoved() then
111 creature:setOutfit(outfits[i])
112 end
113 end, (i - 1) * 80)
114 end
115
116 -- Restaura o outfit original
117 addEvent(function()
118 if creature and not creature:isRemoved() then
119 creature:setOutfit(originalOutfit)
120 end
121 end, (#outfits * 100) + 100)
122
123
124 addEvent(function()
125 if creature and not creature:isRemoved() then
126 -- playSound(creature, "woodcutting.ogg")
127 end
128 end, 0)
129 playSound(creature, "energy.ogg")
130 return false
131end
132