Holy Chain.lua

main 59 lines · 2.1 KB Raw
Alex Alex Commit Server upload 18/10/2026 23:38
1local combat = createCombatObject()
2
3
4
5local tickInterval = 200 -- Intervalo entre os ticks (200 ms)
6local ticks = 4 -- Quantidade de ticks
7
8local baseHpPerTick = 100 -- Cura base por tick
9
10
11
12local offsetX = 2
13local offsetY = 0
14
15
16local offsetX93 = 0
17local offsetY93 = 0
18
19function onCastSpell(creature, var)
20 local maxMana = creature:getMaxMana()
21 local restorePerTick = math.floor(maxMana * manaPercentPerTick)
22 local level = creature:getLevel()
23 local tickCount = 0
24
25 local adjustedHpPerTick = math.floor(baseHpPerTick * (1 + math.floor(level / 10) * levelScaling))
26
27 local function restoreManaAndHp(creatureId)
28 local creature = Creature(creatureId)
29 if not creature then return end
30
31 tickCount = tickCount + 1
32 creature:addMana(restorePerTick)
33 creature:addHealth(adjustedHpPerTick)
34
35 local playerPos = creature:getPosition()
36
37 -- Aplica o efeito 93 com offsets separados
38 local effectPos1 = Position(playerPos.x + offsetX93, playerPos.y + offsetY93, playerPos.z)
39 effectPos1:sendMagicEffect(93)
40
41 -- Aplica o efeito 125 apenas na primeira vez
42 if tickCount == 1 then
43 local effectPos2 = Position(playerPos.x + 2 - offsetX, playerPos.y - offsetY, playerPos.z)
44 effectPos2:sendMagicEffect(125)
45 end
46
47 if tickCount < ticks then
48 addEvent(restoreManaAndHp, tickInterval, creatureId)
49 end
50 end
51
52 addEvent(restoreManaAndHp, tickInterval, creature:getId())
53
54 local adjustedPos = Position(creature:getPosition().x + offsetX, creature:getPosition().y + offsetY, creature:getPosition().z)
55 adjustedPos:sendMagicEffect(100)
56
57 return false
58end
59
Top