Skip to content

Commit

Permalink
Update rupture_resonance.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
Luan Luciano authored Jan 20, 2024
1 parent f41b8c1 commit c08debd
Showing 1 changed file with 26 additions and 41 deletions.
Original file line number Diff line number Diff line change
@@ -1,50 +1,35 @@
local function createSpawnWave(stage)
Game.createMonster("Spark of Destruction", Position(32331, 31254, 14), false, true)
Game.createMonster("Spark of Destruction", Position(32338, 31254, 14), false, true)
Game.createMonster("Spark of Destruction", Position(32330, 31250, 14), false, true)
Game.createMonster("Spark of Destruction", Position(32338, 31250, 14), false, true)
Game.createMonster("Damage Resonance", Position(32332, 31250, 14), false, true)
Game.setStorageValue(GlobalStorage.HeartOfDestruction.RuptureResonanceStage, stage)
Game.setStorageValue(GlobalStorage.HeartOfDestruction.RuptureResonanceActive, 1)
end

local ruptureResonance = CreatureEvent("RuptureResonance")

function ruptureResonance.onThink(creature)
if not creature or not creature:isMonster() then
return false
end

local hp = (creature:getHealth() / creature:getMaxHealth()) * 100
if hp <= 80 and ruptureResonanceStage == 0 and resonanceActive == false then
Game.createMonster("spark of destruction", { x = 32331, y = 31254, z = 14 }, false, true)
Game.createMonster("spark of destruction", { x = 32338, y = 31254, z = 14 }, false, true)
Game.createMonster("spark of destruction", { x = 32330, y = 31250, z = 14 }, false, true)
Game.createMonster("spark of destruction", { x = 32338, y = 31250, z = 14 }, false, true)
Game.createMonster("damage resonance", { x = 32332, y = 31250, z = 14 }, false, true)
ruptureResonanceStage = 1
resonanceActive = true
elseif hp <= 60 and ruptureResonanceStage == 1 and resonanceActive == false then
Game.createMonster("spark of destruction", { x = 32331, y = 31254, z = 14 }, false, true)
Game.createMonster("spark of destruction", { x = 32338, y = 31254, z = 14 }, false, true)
Game.createMonster("spark of destruction", { x = 32330, y = 31250, z = 14 }, false, true)
Game.createMonster("spark of destruction", { x = 32338, y = 31250, z = 14 }, false, true)
Game.createMonster("damage resonance", { x = 32332, y = 31250, z = 14 }, false, true)
ruptureResonanceStage = 2
resonanceActive = true
elseif hp <= 40 and ruptureResonanceStage == 2 and resonanceActive == false then
Game.createMonster("spark of destruction", { x = 32331, y = 31254, z = 14 }, false, true)
Game.createMonster("spark of destruction", { x = 32338, y = 31254, z = 14 }, false, true)
Game.createMonster("spark of destruction", { x = 32330, y = 31250, z = 14 }, false, true)
Game.createMonster("spark of destruction", { x = 32338, y = 31250, z = 14 }, false, true)
Game.createMonster("damage resonance", { x = 32332, y = 31250, z = 14 }, false, true)
ruptureResonanceStage = 3
resonanceActive = true
elseif hp <= 25 and ruptureResonanceStage == 3 and resonanceActive == false then
Game.createMonster("spark of destruction", { x = 32331, y = 31254, z = 14 }, false, true)
Game.createMonster("spark of destruction", { x = 32338, y = 31254, z = 14 }, false, true)
Game.createMonster("spark of destruction", { x = 32330, y = 31250, z = 14 }, false, true)
Game.createMonster("spark of destruction", { x = 32338, y = 31250, z = 14 }, false, true)
Game.createMonster("damage resonance", { x = 32332, y = 31250, z = 14 }, false, true)
ruptureResonanceStage = 4
resonanceActive = true
elseif hp <= 10 and ruptureResonanceStage == 4 and resonanceActive == false then
Game.createMonster("spark of destruction", { x = 32331, y = 31254, z = 14 }, false, true)
Game.createMonster("spark of destruction", { x = 32338, y = 31254, z = 14 }, false, true)
Game.createMonster("spark of destruction", { x = 32330, y = 31250, z = 14 }, false, true)
Game.createMonster("spark of destruction", { x = 32338, y = 31250, z = 14 }, false, true)
Game.createMonster("damage resonance", { x = 32332, y = 31250, z = 14 }, false, true)
ruptureResonanceStage = -1
resonanceActive = true
local ruptureResonanceStage = Game.getStorageValue(GlobalStorage.HeartOfDestruction.RuptureResonanceStage)
local resonanceActive = Game.setStorageValue(GlobalStorage.HeartOfDestruction.RuptureResonanceActive)

local hpPercent = (creature:getHealth() / creature:getMaxHealth()) * 100
if hpPercent <= 80 and ruptureResonanceStage == 0 and resonanceActive ~= 1 then
createSpawnWave(1)
elseif hpPercent <= 60 and ruptureResonanceStage == 1 and resonanceActive ~= 1 then
createSpawnWave(2)
Game.setStorageValue(GlobalStorage.HeartOfDestruction.RuptureResonanceStage, 0)
elseif hpPercent <= 40 and ruptureResonanceStage == 2 and resonanceActive ~= 1 then
createSpawnWave(3)
elseif hpPercent <= 25 and ruptureResonanceStage == 3 and resonanceActive ~= 1 then
createSpawnWave(4)
elseif hpPercent <= 10 and ruptureResonanceStage == 4 and resonanceActive ~= 1 then
createSpawnWave(-1)
end

return true
Expand Down

0 comments on commit c08debd

Please sign in to comment.