From eee4ea71e971fbde4ef3934d4036e2132c256e92 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 18 Mar 2024 18:54:34 +0000 Subject: [PATCH] Lua code format - (Stylua) --- .../the_dream_courts/bosses/faceless_bane.lua | 3 +- .../faceless_bane_on_death.lua | 9 +- .../faceless_bane_step_positions.lua | 94 ++++++++----------- 3 files changed, 45 insertions(+), 61 deletions(-) diff --git a/data-otservbr-global/monster/quests/the_dream_courts/bosses/faceless_bane.lua b/data-otservbr-global/monster/quests/the_dream_courts/bosses/faceless_bane.lua index 31b4c3fa10e..5737ef10033 100644 --- a/data-otservbr-global/monster/quests/the_dream_courts/bosses/faceless_bane.lua +++ b/data-otservbr-global/monster/quests/the_dream_courts/bosses/faceless_bane.lua @@ -22,7 +22,7 @@ monster.manaCost = 0 monster.changeTarget = { interval = 4000, - chance = 20 + chance = 20, } monster.reflects = { @@ -138,7 +138,6 @@ monster.elements = { { type = COMBAT_DEATHDAMAGE, percent = 50 }, } - monster.immunities = { { type = "paralyze", condition = true }, { type = "outfit", condition = false }, diff --git a/data-otservbr-global/scripts/creaturescripts/quests/the_dream_courts/faceless_bane_on_death.lua b/data-otservbr-global/scripts/creaturescripts/quests/the_dream_courts/faceless_bane_on_death.lua index eae46adcc5b..0ec1656c2ad 100644 --- a/data-otservbr-global/scripts/creaturescripts/quests/the_dream_courts/faceless_bane_on_death.lua +++ b/data-otservbr-global/scripts/creaturescripts/quests/the_dream_courts/faceless_bane_on_death.lua @@ -2,13 +2,12 @@ local bossName = "Faceless Bane" local facelessBaneOnDeath = CreatureEvent("facelessBaneOnDeath") function facelessBaneOnDeath.onDeath(creature) - if creature:getName() == bossName then onDeathForDamagingPlayers(creature, function(creature, player) - -- reset global storage state to default / ensure sqm's reset for the next team - Game.setStorageValue(GlobalStorage.FacelessBaneDeaths, -1) - Game.setStorageValue(GlobalStorage.FacelessBaneStepsOn, -1) - Game.setStorageValue(GlobalStorage.FacelessBaneResetSteps, 1) + -- reset global storage state to default / ensure sqm's reset for the next team + Game.setStorageValue(GlobalStorage.FacelessBaneDeaths, -1) + Game.setStorageValue(GlobalStorage.FacelessBaneStepsOn, -1) + Game.setStorageValue(GlobalStorage.FacelessBaneResetSteps, 1) end) end return true diff --git a/data-otservbr-global/scripts/creaturescripts/quests/the_dream_courts/faceless_bane_step_positions.lua b/data-otservbr-global/scripts/creaturescripts/quests/the_dream_courts/faceless_bane_step_positions.lua index 00025eaf17b..80ca5d331ab 100644 --- a/data-otservbr-global/scripts/creaturescripts/quests/the_dream_courts/faceless_bane_step_positions.lua +++ b/data-otservbr-global/scripts/creaturescripts/quests/the_dream_courts/faceless_bane_step_positions.lua @@ -15,7 +15,7 @@ end -- energy effect to make the boss mortal local function sendEnergyEffect() - -- positions: pipes on room, that should be electrocuted + -- positions: pipes on room, that should be electrocuted local pipePositions = { Position(33612, 32568, 13), Position(33612, 32567, 13), @@ -42,7 +42,7 @@ local function sendEnergyEffect() Position(33622, 32565, 13), Position(33622, 32566, 13), Position(33622, 32567, 13), - Position(33622, 32568, 13) + Position(33622, 32568, 13), } -- energy effect / sound on pipes @@ -56,70 +56,56 @@ end local facelessBaneStepPositions = MoveEvent() - -- capture steps in the specific SQM's to make the boss mortal - -- +-- capture steps in the specific SQM's to make the boss mortal +-- function facelessBaneStepPositions.onStepIn(creature, item, position, fromPosition) - local player = creature:getPlayer() - if not player then - return true - end + local player = creature:getPlayer() + if not player then + return true + end - if Game.getStorageValue(GlobalStorage.FacelessBaneResetSteps) == 1 then - Game.setStorageValue(GlobalStorage.FacelessBaneResetSteps, 0) - lastResetTime = os.time() - resetWalkedPositions() + if Game.getStorageValue(GlobalStorage.FacelessBaneResetSteps) == 1 then + Game.setStorageValue(GlobalStorage.FacelessBaneResetSteps, 0) + lastResetTime = os.time() + resetWalkedPositions() + end + + if Game.getStorageValue(GlobalStorage.FacelessBaneStepsOn) < 1 then + local positionAlreadyAdded = false + if #walkedPositions == 0 then + position:sendSingleSoundEffect(SOUND_EFFECT_TYPE_SPELL_BUZZ) + position:sendMagicEffect(CONST_ME_YELLOWENERGY) + table.insert(walkedPositions, position) + return true end - if Game.getStorageValue(GlobalStorage.FacelessBaneStepsOn) < 1 then - local positionAlreadyAdded = false - if #walkedPositions == 0 then - position:sendSingleSoundEffect(SOUND_EFFECT_TYPE_SPELL_BUZZ) - position:sendMagicEffect(CONST_ME_YELLOWENERGY) - table.insert(walkedPositions, position) - return true + for _, p in ipairs(walkedPositions) do + if p == position then + positionAlreadyAdded = true + break end + end - for _, p in ipairs(walkedPositions) do - if p == position then - positionAlreadyAdded = true - break - end - end + if positionAlreadyAdded then + return true + else + position:sendSingleSoundEffect(SOUND_EFFECT_TYPE_SPELL_BUZZ) + position:sendMagicEffect(CONST_ME_YELLOWENERGY) + table.insert(walkedPositions, position) - if positionAlreadyAdded then + if #walkedPositions == 13 then + Game.setStorageValue(GlobalStorage.FacelessBaneStepsOn, 1) + addEvent(resetWalkedPositions, 60 * 1000) + sendEnergyEffect() return true - else - position:sendSingleSoundEffect(SOUND_EFFECT_TYPE_SPELL_BUZZ) - position:sendMagicEffect(CONST_ME_YELLOWENERGY) - table.insert(walkedPositions, position) - - if #walkedPositions == 13 then - Game.setStorageValue(GlobalStorage.FacelessBaneStepsOn, 1) - addEvent(resetWalkedPositions, 60 * 1000) - sendEnergyEffect() - return true - end end - - return true end + + return true + end return true end -- positions: SQM's to step -facelessBaneStepPositions:position( - Position(33615, 32567, 13), - Position(33613, 32567, 13), - Position(33611, 32563, 13), - Position(33610, 32561, 13), - Position(33611, 32558, 13), - Position(33614, 32557, 13), - Position(33617, 32558, 13), - Position(33620, 32557, 13), - Position(33623, 32558, 13), - Position(33624, 32561, 13), - Position(33623, 32563, 13), - Position(33621, 32567, 13), - Position(33619, 32567, 13) -) +facelessBaneStepPositions:position(Position(33615, 32567, 13), Position(33613, 32567, 13), Position(33611, 32563, 13), Position(33610, 32561, 13), Position(33611, 32558, 13), Position(33614, 32557, 13), Position(33617, 32558, 13), Position(33620, 32557, 13), Position(33623, 32558, 13), Position(33624, 32561, 13), Position(33623, 32563, 13), Position(33621, 32567, 13), Position(33619, 32567, 13)) facelessBaneStepPositions:register()