-
-
Notifications
You must be signed in to change notification settings - Fork 647
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: boss mechanics Anomaly (#1983)
- Loading branch information
Luan Luciano
authored
Dec 9, 2023
1 parent
ec2b32e
commit 13ec0f2
Showing
6 changed files
with
104 additions
and
197 deletions.
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
162 changes: 36 additions & 126 deletions
162
data-otservbr-global/scripts/actions/quests/heart_of_destruction/anomaly_lever.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 |
---|---|---|
@@ -1,129 +1,39 @@ | ||
-- FUNCTIONS | ||
local function doCheckArea() | ||
local upConer = { x = 32258, y = 31237, z = 14 } -- upLeftCorner | ||
local downConer = { x = 32284, y = 31262, z = 14 } -- downRightCorner | ||
|
||
for i = upConer.x, downConer.x do | ||
for j = upConer.y, downConer.y do | ||
for k = upConer.z, downConer.z do | ||
local room = { x = i, y = j, z = k } | ||
local tile = Tile(room) | ||
if tile then | ||
local creatures = tile:getCreatures() | ||
if creatures and #creatures > 0 then | ||
for _, creature in pairs(creatures) do | ||
local player = Player(creature) | ||
if player then | ||
return true | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
return false | ||
end | ||
|
||
local function clearArea() | ||
local upConer = { x = 32258, y = 31237, z = 14 } -- upLeftCorner | ||
local downConer = { x = 32284, y = 31262, z = 14 } -- downRightCorner | ||
|
||
for i = upConer.x, downConer.x do | ||
for j = upConer.y, downConer.y do | ||
for k = upConer.z, downConer.z do | ||
local room = { x = i, y = j, z = k } | ||
local tile = Tile(room) | ||
if tile then | ||
local creatures = tile:getCreatures() | ||
if creatures and #creatures > 0 then | ||
for _, creatureUid in pairs(creatures) do | ||
local creature = Creature(creatureUid) | ||
if creature then | ||
if creature:isPlayer() then | ||
creature:teleportTo({ x = 32104, y = 31329, z = 12 }) | ||
elseif creature:isMonster() then | ||
creature:remove() | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
-- FUNCTIONS END | ||
|
||
local heartDestructionAnomaly = Action() | ||
function heartDestructionAnomaly.onUse(player, item, fromPosition, itemEx, toPosition) | ||
local config = { | ||
playerPositions = { | ||
Position(32245, 31245, 14), | ||
Position(32245, 31246, 14), | ||
Position(32245, 31247, 14), | ||
Position(32245, 31248, 14), | ||
Position(32245, 31249, 14), | ||
}, | ||
|
||
newPos = { x = 32271, y = 31257, z = 14 }, | ||
} | ||
|
||
local pushPos = { x = 32245, y = 31245, z = 14 } | ||
|
||
if item.actionid == 14325 then | ||
if item.itemid == 8911 then | ||
if player:getPosition().x == pushPos.x and player:getPosition().y == pushPos.y and player:getPosition().z == pushPos.z then | ||
local storePlayers = {} | ||
for i = 1, #config.playerPositions do | ||
local tile = Tile(Position(config.playerPositions[i])) | ||
if tile then | ||
local playerTile = tile:getTopCreature() | ||
if playerTile and playerTile:isPlayer() then | ||
storePlayers[#storePlayers + 1] = playerTile | ||
end | ||
end | ||
end | ||
|
||
if doCheckArea() == false then | ||
clearArea() | ||
|
||
local players | ||
|
||
for i = 1, #storePlayers do | ||
players = storePlayers[i] | ||
config.playerPositions[i]:sendMagicEffect(CONST_ME_POFF) | ||
players:teleportTo(config.newPos) | ||
players:setBossCooldown("Anomaly", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) | ||
end | ||
Position(config.newPos):sendMagicEffect(11) | ||
|
||
areaAnomaly1 = addEvent(clearArea, 15 * 60000) | ||
|
||
Game.setStorageValue(14322, 0) -- Anomaly Stages | ||
|
||
Game.createMonster("Spark of Destruction", { x = 32267, y = 31253, z = 14 }, false, true) | ||
Game.createMonster("Spark of Destruction", { x = 32274, y = 31255, z = 14 }, false, true) | ||
Game.createMonster("Spark of Destruction", { x = 32274, y = 31249, z = 14 }, false, true) | ||
Game.createMonster("Spark of Destruction", { x = 32267, y = 31249, z = 14 }, false, true) | ||
Game.createMonster("Anomaly", { x = 32271, y = 31249, z = 14 }, false, true) | ||
|
||
local vortex = Tile({ x = 32261, y = 31250, z = 14 }):getItemById(23482) | ||
if vortex then | ||
vortex:transform(23483) | ||
vortex:setActionId(14324) | ||
end | ||
else | ||
player:sendTextMessage(19, "Someone is in the area.") | ||
end | ||
else | ||
return true | ||
local config = { | ||
boss = { | ||
name = "Anomaly", | ||
position = Position(32271, 31249, 14), | ||
}, | ||
playerPositions = { | ||
{ pos = Position(32245, 31245, 14), teleport = Position(32271, 31257, 14), effect = CONST_ME_TELEPORT }, | ||
{ pos = Position(32245, 31246, 14), teleport = Position(32271, 31257, 14), effect = CONST_ME_TELEPORT }, | ||
{ pos = Position(32245, 31247, 14), teleport = Position(32271, 31257, 14), effect = CONST_ME_TELEPORT }, | ||
{ pos = Position(32245, 31248, 14), teleport = Position(32271, 31257, 14), effect = CONST_ME_TELEPORT }, | ||
{ pos = Position(32245, 31249, 14), teleport = Position(32271, 31257, 14), effect = CONST_ME_TELEPORT }, | ||
}, | ||
specPos = { | ||
from = Position(32258, 31237, 14), | ||
to = Position(32284, 31262, 14), | ||
}, | ||
monsters = { | ||
{ name = "Spark of Destruction", pos = Position(32267, 31253, 14) }, | ||
{ name = "Spark of Destruction", pos = Position(32274, 31255, 14) }, | ||
{ name = "Spark of Destruction", pos = Position(32274, 31249, 14) }, | ||
{ name = "Spark of Destruction", pos = Position(32267, 31249, 14) }, | ||
}, | ||
onUseExtra = function() | ||
Game.setStorageValue(GlobalStorage.HeartOfDestruction.ChargedAnomaly, 0) | ||
local tile = Tile(Position(32261, 31250, 14)) | ||
if tile then | ||
local vortex = tile:getItemById(23482) | ||
if vortex then | ||
vortex:transform(23483) | ||
vortex:setActionId(14324) | ||
end | ||
end | ||
item:transform(item.itemid == 8911 and 8912 or 8911) | ||
end | ||
return true | ||
end | ||
end, | ||
exit = Position(32182, 31250, 14), | ||
} | ||
|
||
heartDestructionAnomaly:aid(14325) | ||
heartDestructionAnomaly:register() | ||
local lever = BossLever(config) | ||
lever:aid(14325) | ||
lever:register() |
52 changes: 22 additions & 30 deletions
52
...otservbr-global/scripts/creaturescripts/quests/heart_of_destruction/anomaly_transform.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
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
9 changes: 7 additions & 2 deletions
9
data-otservbr-global/scripts/movements/quests/heart_of_destruction/vortex_anomaly.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 |
---|---|---|
@@ -1,18 +1,23 @@ | ||
local vortexAnomaly = MoveEvent() | ||
|
||
vortexAnomaly:type("stepin") | ||
|
||
function vortexAnomaly.onStepIn(creature, item, position, fromPosition) | ||
if not creature then | ||
return true | ||
end | ||
|
||
if item.itemid == 22894 then | ||
if creature:isMonster() then | ||
if creature:getName():lower() == "charged anomaly" then | ||
creature:addHealth(-6000, COMBAT_DROWNDAMAGE) | ||
end | ||
elseif isPlayer(creature) then | ||
elseif creature:isPlayer() then | ||
creature:addHealth(-100, COMBAT_ENERGYDAMAGE) | ||
end | ||
end | ||
return true | ||
end | ||
|
||
vortexAnomaly:type("stepin") | ||
vortexAnomaly:id(22894) | ||
vortexAnomaly:register() |
51 changes: 17 additions & 34 deletions
51
data-otservbr-global/scripts/spells/monster/charge_vortex.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