Skip to content

Commit bf1067e

Browse files
committed
fix: grave danger darashia boss
1 parent 10e8450 commit bf1067e

4 files changed

Lines changed: 141 additions & 177 deletions

File tree

data-otservbr-global/monster/quests/grave_danger/bosses/sir_baeloc.lua

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ monster.speed = 125
2121
monster.manaCost = 0
2222

2323
monster.events = {
24-
"sir_baeloc_health",
25-
"brothers_summon",
26-
"grave_danger_death",
24+
"BossHealthCheck"
2725
}
2826

2927
monster.changeTarget = {
@@ -80,14 +78,14 @@ monster.voices = {
8078
monster.loot = {
8179
{ name = "platinum coin", minCount = 1, maxCount = 5, chance = 100000 },
8280
{ name = "crystal coin", minCount = 0, maxCount = 2, chance = 50000 },
81+
{ name = "silver token", minCount = 0, maxCount = 3, chance = 40000 },
8382
{ name = "supreme health potion", minCount = 0, maxCount = 6, chance = 35000 },
8483
{ name = "ultimate mana potion", minCount = 0, maxCount = 20, chance = 32000 },
8584
{ name = "ultimate spirit potion", minCount = 0, maxCount = 20, chance = 32000 },
8685
{ name = "mastermind potion", minCount = 0, maxCount = 10, chance = 12000 },
8786
{ name = "berserk potion", minCount = 0, maxCount = 10, chance = 12000 },
8887
{ name = "piece of draconian steel", minCount = 0, maxCount = 4, chance = 9000 },
8988
{ id = 3039, minCount = 0, maxCount = 1, chance = 12000 }, -- red gem
90-
{ name = "silver token", minCount = 0, maxCount = 2, chance = 9500 },
9189
{ id = 23542, chance = 5200 }, -- collar of blue plasma
9290
{ id = 23544, chance = 5200 }, -- collar of red plasma
9391
{ name = "knight legs", chance = 11000 },

data-otservbr-global/monster/quests/grave_danger/bosses/sir_nictros.lua

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,15 @@ monster.corpse = 31599
2020
monster.speed = 125
2121
monster.manaCost = 0
2222

23-
monster.events = {
24-
"sir_nictros_health",
25-
"brothers_summon",
26-
}
27-
2823
monster.changeTarget = {
2924
interval = 4000,
3025
chance = 10,
3126
}
3227

28+
monster.events = {
29+
"BossHealthCheck",
30+
}
31+
3332
monster.bosstiary = {
3433
bossRaceId = 1754,
3534
bossRace = RARITY_ARCHFOE,
Lines changed: 135 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,144 @@
11
local nictrosPosition = Position(33427, 31428, 13)
22
local baelocPosition = Position(33422, 31428, 13)
33

4+
local healthStates = {
5+
nictros85 = false,
6+
baeloc85 = false
7+
}
8+
49
local config = {
5-
boss = {
6-
name = "Sir Nictros",
7-
createFunction = function()
8-
local nictros = Game.createMonster("Sir Nictros", nictrosPosition, true, true)
9-
local baeloc = Game.createMonster("Sir Baeloc", baelocPosition, true, true)
10-
return nictros and baeloc
11-
end,
12-
},
13-
requiredLevel = 250,
14-
playerPositions = {
15-
{ pos = Position(33424, 31413, 13), teleport = Position(33423, 31448, 13) },
16-
{ pos = Position(33425, 31413, 13), teleport = Position(33423, 31448, 13) },
17-
{ pos = Position(33426, 31413, 13), teleport = Position(33423, 31448, 13) },
18-
{ pos = Position(33427, 31413, 13), teleport = Position(33423, 31448, 13) },
19-
{ pos = Position(33428, 31413, 13), teleport = Position(33423, 31448, 13) },
20-
},
21-
specPos = {
22-
from = Position(33414, 31426, 13),
23-
to = Position(33433, 31449, 13),
24-
},
25-
onUseExtra = function(player)
26-
addEvent(function()
27-
local baeloc = Creature("Sir Baeloc")
28-
local nictros = Creature("Sir Nictros")
29-
30-
if baeloc then
31-
baeloc:say("Ah look my Brother! Challengers! After all this time finally a chance to prove our skills!")
32-
addEvent(function()
33-
local nictros = Creature("Sir Nictros")
34-
if nictros then
35-
nictros:say("Indeed! It has been a while! As the elder one I request the right of the first battle!")
36-
end
37-
end, 6 * 1000)
38-
end
39-
40-
addEvent(function()
41-
local baeloc = Creature("Sir Baeloc")
42-
local nictros = Creature("Sir Nictros")
43-
if baeloc then
44-
baeloc:say("Oh, man! You always get the fun!")
45-
if nictros then
46-
nictros:teleportTo(Position(33426, 31437, 13))
47-
nictros:setMoveLocked(false)
48-
end
49-
end
50-
end, 12 * 1000)
51-
end, 4 * 1000)
52-
end,
53-
exit = Position(33290, 32474, 9),
10+
boss = {
11+
name = "Sir Nictros",
12+
createFunction = function()
13+
local nictros = Game.createMonster("Sir Nictros", nictrosPosition, true, true)
14+
local baeloc = Game.createMonster("Sir Baeloc", baelocPosition, true, true)
15+
16+
if nictros then
17+
nictros:registerEvent("BossHealthCheck")
18+
-- Start with Nictros active
19+
nictros:setMoveLocked(false)
20+
end
21+
if baeloc then
22+
-- Start with Baeloc locked
23+
baeloc:setMoveLocked(true)
24+
baeloc:registerEvent("BossHealthCheck")
25+
end
26+
27+
-- Reset health triggers in case this is a retry
28+
healthStates.nictros85 = false
29+
healthStates.baeloc85 = false
30+
31+
return nictros and baeloc
32+
end,
33+
},
34+
requiredLevel = 250,
35+
playerPositions = {
36+
{ pos = Position(33424, 31413, 13), teleport = Position(33423, 31448, 13) },
37+
{ pos = Position(33425, 31413, 13), teleport = Position(33423, 31448, 13) },
38+
{ pos = Position(33426, 31413, 13), teleport = Position(33423, 31448, 13) },
39+
{ pos = Position(33427, 31413, 13), teleport = Position(33423, 31448, 13) },
40+
{ pos = Position(33428, 31413, 13), teleport = Position(33423, 31448, 13) },
41+
},
42+
specPos = {
43+
from = Position(33414, 31426, 13),
44+
to = Position(33433, 31449, 13),
45+
},
46+
onUseExtra = function(player)
47+
addEvent(function()
48+
local baeloc = Creature("Sir Baeloc")
49+
local nictros = Creature("Sir Nictros")
50+
51+
if baeloc then
52+
baeloc:say("Ah look my Brother! Challengers! After all this time finally a chance to prove our skills!")
53+
addEvent(function()
54+
local nictros = Creature("Sir Nictros")
55+
if nictros then
56+
nictros:say("Indeed! It has been a while! As the elder one I request the right of the first battle!")
57+
end
58+
end, 6 * 1000)
59+
end
60+
61+
addEvent(function()
62+
local baeloc = Creature("Sir Baeloc")
63+
local nictros = Creature("Sir Nictros")
64+
if baeloc then
65+
baeloc:say("Oh, man! You always get the fun!")
66+
-- Keep Baeloc locked initially - will be released later
67+
baeloc:setMoveLocked(true)
68+
end
69+
if nictros then
70+
nictros:teleportTo(Position(33426, 31437, 13))
71+
-- Make sure Nictros can move and attack
72+
nictros:setMoveLocked(false)
73+
end
74+
end, 12 * 1000)
75+
end, 4 * 1000)
76+
end,
77+
exit = Position(33290, 32474, 9),
5478
}
5579

5680
local lever = BossLever(config)
5781
lever:position(Position(33423, 31413, 13))
5882
lever:register()
83+
84+
-- Health Trigger Logic
85+
local BossHealthCheck = CreatureEvent("BossHealthCheck")
86+
87+
function BossHealthCheck.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
88+
-- Safety check
89+
if not creature or not creature:isMonster() then
90+
return primaryDamage, primaryType, secondaryDamage, secondaryType
91+
end
92+
93+
local name = creature:getName()
94+
95+
-- Calculate health percentage correctly
96+
local function getHealthPercentage(creature)
97+
local health = creature:getHealth()
98+
local maxHealth = creature:getMaxHealth()
99+
return (health / maxHealth) * 100
100+
end
101+
102+
local healthPercent = getHealthPercentage(creature)
103+
104+
-- Debug logging
105+
print("[BossHealthCheck] Health check for:", name, "Health:", creature:getHealth(), "/", creature:getMaxHealth(), "=", healthPercent, "%")
106+
107+
-- NICTROS reaches 85% health
108+
if name == "Sir Nictros" and not healthStates.nictros85 and healthPercent <= 85 then
109+
healthStates.nictros85 = true
110+
print("[BossHealthCheck] Nictros at 85% or below - releasing Baeloc")
111+
112+
creature:say("I'll step back now. Let's see how you handle my brother!")
113+
creature:teleportTo(nictrosPosition)
114+
creature:setMoveLocked(true) -- Lock Nictros until Baeloc hits 85%
115+
116+
-- Release Baeloc to fight
117+
local baeloc = Creature("Sir Baeloc")
118+
if baeloc then
119+
baeloc:teleportTo(Position(33426, 31435, 13))
120+
baeloc:setDirection(DIRECTION_SOUTH)
121+
baeloc:setMoveLocked(false) -- Allow Baeloc to move and attack
122+
baeloc:say("My turn! Let me show you my skills!")
123+
end
124+
125+
-- BAELOC reaches 85% health
126+
elseif name == "Sir Baeloc" and healthStates.nictros85 and not healthStates.baeloc85 and healthPercent <= 85 then
127+
healthStates.baeloc85 = true
128+
print("[BossHealthCheck] Baeloc at 85% - releasing Nictros for joint attack")
129+
130+
creature:say("Brother! I need your assistance!")
131+
132+
-- Release Nictros to join the fight
133+
local nictros = Creature("Sir Nictros")
134+
if nictros then
135+
nictros:setMoveLocked(false) -- Allow Nictros to move and attack again
136+
nictros:teleportTo(Position(33424, 31435, 13)) -- Teleport near Baeloc
137+
nictros:say("Now we fight together, brother!")
138+
end
139+
end
140+
141+
return primaryDamage, primaryType, secondaryDamage, secondaryType
142+
end
143+
144+
BossHealthCheck:register()

data-otservbr-global/scripts/quests/grave_danger_quest/creaturescripts_baeloc_nictros.lua

Lines changed: 0 additions & 119 deletions
This file was deleted.

0 commit comments

Comments
 (0)