Ren.lua

main 62 lines · 2.6 KB Raw
Alex Alex Commit Server upload 18/10/2026 23:38
1local combat = createCombatObject()
2
3
4
5local tickInterval = 1000 -- Intervalo entre os ticks (1 segundo)
6local ticks = 4 -- Quantidade de ticks (4 vezes, 25 HP cada, totalizando 100 HP)
7local manaPercentPerTick = 0.10 -- Percentual de mana restaurada por tick (10%)
8local baseHpPerTick = 50 -- Cura base por tick (25 HP)
9
10
11
12local offsetX = 1 -- +1 para direita, -1 para esquerda
13local offsetY = 0 -- +1 para baixo, -1 para cima
14
15function onCastSpell(creature, var)
16 local maxMana = creature:getMaxMana()
17
18
19 local tickCount = 0
20
21
22 local adjustedHpPerTick = math.floor(baseHpPerTick * (1 + math.floor(level / 10) * levelScaling))
23
24
25 local function restoreManaAndHp(creatureId)
26 local creature = Creature(creatureId)
27 if not creature then
28 return
29 end
30
31 tickCount = tickCount + 1
32 creature:addMana(restorePerTick) -- Restaura a mana
33
34
35
36 local playerPos = creature:getPosition()
37
38
39 local effectPos1 = Position(playerPos.x + offsetX, playerPos.y + offsetY, playerPos.z)
40 local effectPos2 = Position(playerPos.x + 2 - offsetX, playerPos.y - offsetY, playerPos.z)
41
42
43 effectPos1:sendMagicEffect(191)
44 effectPos2:sendMagicEffect(192)
45
46
47 if tickCount < ticks then
48 addEvent(restoreManaAndHp, tickInterval, creatureId)
49 else
50 end
51 end
52
53 -- Inicia o buff de mana e cura
54 addEvent(restoreManaAndHp, tickInterval, creature:getId())
55
56 -- Aplica o efeito 193 com o eixo ajustado
57 local adjustedPos = Position(creature:getPosition().x + offsetX, creature:getPosition().y + offsetY, creature:getPosition().z)
58 adjustedPos:sendMagicEffect(191)
59
60 return false
61end
62
Top