Skip to content

Commit b7131b3

Browse files
google-labs-jules[bot]killerwife
authored andcommitted
Fix(AI): Correct Lord Kazzak's Berserk spell casting
Lord Kazzak was incorrectly stopping his Shadow Volley casts after entering the Berserk phase. This was due to the Shadow Volley logic being inside the timer check for the Berserk spell itself. After the timer expired, the block was no longer executed. This commit refactors the logic by introducing a boolean flag, m_bIsInBerserk, to track the Berserk state. The Shadow Volley cast is now independent of the Berserk timer and its frequency is increased when the Berserk phase is active.
1 parent fcfa80c commit b7131b3

1 file changed

Lines changed: 20 additions & 18 deletions

File tree

src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/boss_kazzak.cpp

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ struct boss_kazzakAI : public ScriptedAI
6161
uint32 m_uiMarkOfKazzakTimer;
6262
uint32 m_uiTwistedReflectionTimer;
6363
uint32 m_uiSupremeTimer;
64+
bool m_bIsInBerserk;
6465

6566
void Reset() override
6667
{
@@ -71,6 +72,7 @@ struct boss_kazzakAI : public ScriptedAI
7172
m_uiMarkOfKazzakTimer = 25000;
7273
m_uiTwistedReflectionTimer = 33000;
7374
m_uiSupremeTimer = 3 * MINUTE * IN_MILLISECONDS;
75+
m_bIsInBerserk = false;
7476
}
7577

7678
void JustRespawned() override
@@ -107,29 +109,29 @@ struct boss_kazzakAI : public ScriptedAI
107109
if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim())
108110
return;
109111

110-
if (m_uiSupremeTimer)
112+
// Berserk
113+
if (m_uiSupremeTimer && m_uiSupremeTimer <= uiDiff)
111114
{
112-
// Enrage - cast shadowbolt volley every second
113-
if (m_uiSupremeTimer <= uiDiff)
115+
if (DoCastSpellIfCan(m_creature, SPELL_BERSERK) == CAST_OK)
114116
{
115-
if (DoCastSpellIfCan(m_creature, SPELL_BERSERK) == CAST_OK)
116-
{
117-
DoScriptText(urand(0, 1) ? SAY_SURPREME1 : SAY_SURPREME2, m_creature);
118-
m_uiSupremeTimer = 0;
119-
}
117+
DoScriptText(urand(0, 1) ? SAY_SURPREME1 : SAY_SURPREME2, m_creature);
118+
m_bIsInBerserk = true;
119+
m_uiShadowVolleyTimer = 1000;
120120
}
121-
else
122-
m_uiSupremeTimer -= uiDiff;
121+
// a small amount of time will be lost, but this is acceptable.
122+
m_uiSupremeTimer = 0;
123+
}
124+
else
125+
m_uiSupremeTimer -= uiDiff;
123126

124-
// Cast shadowbolt volley on timer before Berserk
125-
if (m_uiShadowVolleyTimer < uiDiff)
126-
{
127-
if (DoCastSpellIfCan(m_creature, SPELL_SHADOW_VOLLEY) == CAST_OK)
128-
m_uiShadowVolleyTimer = urand(5000, 30000);
129-
}
130-
else
131-
m_uiShadowVolleyTimer -= uiDiff;
127+
// Shadow Volley
128+
if (m_uiShadowVolleyTimer <= uiDiff)
129+
{
130+
if (DoCastSpellIfCan(m_creature, SPELL_SHADOW_VOLLEY) == CAST_OK)
131+
m_uiShadowVolleyTimer = urand(m_bIsInBerserk ? 1000 : 5000, m_bIsInBerserk ? 3000 : 30000);
132132
}
133+
else
134+
m_uiShadowVolleyTimer -= uiDiff;
133135

134136
if (m_uiCleaveTimer < uiDiff)
135137
{

0 commit comments

Comments
 (0)