-
-
Notifications
You must be signed in to change notification settings - Fork 647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: faceless bane mechanics and quest #2466
Closed
CarlosE-Dev
wants to merge
5
commits into
opentibiabr:main
from
CarlosE-Dev:feat/faceless-bane-boss-room
Closed
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e6fa059
added mechanic
eee4ea7
Lua code format - (Stylua)
github-actions[bot] 350af75
fix: dry/reset storages
d1f38c8
Merge branch 'feat/faceless-bane-boss-room' of https://github.com/Car…
6846be7
Update data-otservbr-global/scripts/creaturescripts/quests/the_dream_…
CarlosE-Dev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
data-otservbr-global/scripts/creaturescripts/monster/faceless_bane_immunity.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
local bossName = "Faceless Bane" | ||
|
||
-- reset monster HP to 100% | ||
function healBoss(creature) | ||
creature:addHealth(creature:getMaxHealth()) | ||
creature:getPosition():sendMagicEffect(CONST_ME_BLOCKHIT) | ||
return true | ||
end | ||
|
||
-- summon spectres | ||
function createSummons(pos) | ||
Game.createMonster("Gazer Spectre", pos) | ||
Game.createMonster("Ripper Spectre", pos) | ||
Game.createMonster("Burster Spectre", pos) | ||
return true | ||
end | ||
|
||
-- reset the monster HP and summon spectres upon death | ||
function resetBoss(creature, deaths) | ||
healBoss(creature) | ||
createSummons(creature:getPosition()) | ||
Game.setStorageValue(GlobalStorage.FacelessBaneDeaths, deaths + 1) | ||
Game.setStorageValue(GlobalStorage.FacelessBaneStepsOn, 0) | ||
Game.setStorageValue(GlobalStorage.FacelessBaneResetSteps, 1) | ||
return true | ||
end | ||
|
||
local facelessBaneImmunity = CreatureEvent("facelessBaneImmunity") | ||
|
||
-- ensure that the boss stay invulnerable when the mechanic has not been executed | ||
function facelessBaneImmunity.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType) | ||
if creature and creature:isMonster() and creature:getName() == bossName then | ||
local creatureHealthPercent = (creature:getHealth() * 100) / creature:getMaxHealth() | ||
local facelessBaneDeathsStorage = Game.getStorageValue(GlobalStorage.FacelessBaneDeaths) | ||
|
||
if creatureHealthPercent <= 20 and facelessBaneDeathsStorage < 1 then | ||
resetBoss(creature, facelessBaneDeathsStorage) | ||
return true | ||
end | ||
|
||
if Game.getStorageValue(GlobalStorage.FacelessBaneStepsOn) < 1 then | ||
healBoss(creature) | ||
return true | ||
else | ||
return primaryDamage, primaryType, secondaryDamage, secondaryType | ||
end | ||
end | ||
return true | ||
end | ||
|
||
facelessBaneImmunity:register() |
111 changes: 111 additions & 0 deletions
111
...r-global/scripts/creaturescripts/quests/the_dream_courts/faceless_bane_step_positions.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
local walkedPositions = {} | ||
|
||
-- this variable controls the time to boss become immortal again, (after 1 minute, if dont die) | ||
local lastResetTime = os.time() | ||
|
||
-- reset sqm's / make the boss immortal again | ||
local function resetWalkedPositions() | ||
if lastResetTime > os.time() then | ||
return true | ||
end | ||
walkedPositions = {} | ||
Game.setStorageValue(GlobalStorage.FacelessBaneStepsOn, 0) | ||
lastResetTime = os.time() + (1 * 60) | ||
end | ||
|
||
-- energy effect to make the boss mortal | ||
local function sendEnergyEffect() | ||
-- positions: pipes on room, that should be electrocuted | ||
local pipePositions = { | ||
Position(33612, 32568, 13), | ||
Position(33612, 32567, 13), | ||
Position(33612, 32566, 13), | ||
Position(33612, 32565, 13), | ||
Position(33612, 32564, 13), | ||
Position(33612, 32563, 13), | ||
Position(33612, 32562, 13), | ||
Position(33612, 32561, 13), | ||
Position(33612, 32560, 13), | ||
Position(33612, 32559, 13), | ||
Position(33612, 32558, 13), | ||
Position(33612, 32557, 13), | ||
Position(33612, 32556, 13), | ||
Position(33622, 32556, 13), | ||
Position(33622, 32557, 13), | ||
Position(33622, 32558, 13), | ||
Position(33622, 32559, 13), | ||
Position(33622, 32560, 13), | ||
Position(33622, 32561, 13), | ||
Position(33622, 32562, 13), | ||
Position(33622, 32563, 13), | ||
Position(33622, 32564, 13), | ||
Position(33622, 32565, 13), | ||
Position(33622, 32566, 13), | ||
Position(33622, 32567, 13), | ||
Position(33622, 32568, 13), | ||
} | ||
|
||
-- energy effect / sound on pipes | ||
for _, pp in ipairs(pipePositions) do | ||
pp:sendMagicEffect(CONST_ME_PURPLEENERGY) | ||
pp:sendSingleSoundEffect(SOUND_EFFECT_TYPE_SPELL_GREAT_ENERGY_BEAM) | ||
end | ||
|
||
return true | ||
end | ||
|
||
local facelessBaneStepPositions = MoveEvent() | ||
|
||
-- 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 | ||
|
||
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 | ||
|
||
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 #walkedPositions == 13 then | ||
Game.setStorageValue(GlobalStorage.FacelessBaneStepsOn, 1) | ||
addEvent(resetWalkedPositions, 60 * 1000) | ||
sendEnergyEffect() | ||
return true | ||
end | ||
end | ||
|
||
return true | ||
end | ||
CarlosE-Dev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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:register() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not that it will make a big difference, but if you leave the positions inside the function they will be related every time you call the function, I would leave them outside the function