Skip to content

Commit

Permalink
Outland: Port doom lord kazzak to spell lists and combat ai and spell…
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Sep 19, 2023
1 parent 08a67a5 commit caec8f7
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 179 deletions.
13 changes: 0 additions & 13 deletions sql/scriptdev2/scriptdev2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1527,21 +1527,8 @@ INSERT INTO script_texts (entry,content_default,sound,type,language,emote,broadc
('-1000138','Prepare to enter oblivion, meddlers. You have unleashed a god!','0','1','0','15','18443','Salhadaar SAY'),
('-1000139','Avruu''s magic is broken! I''m free once again!','0','0','0','0','13447','aeranas SAY_FREE'),

('-1000147','I remember well the sting of defeat at the conclusion of the Third War. I have waited far too long for my revenge. Now the shadow of the Legion falls over this world. It is only a matter of time until all of your failed creation... is undone. ','11332','1','0','0','20076','kazzak SAY_INTRO'),
('-1000148','The Legion will conquer all!','11333','1','0','0','20077','kazzak SAY_AGGRO1'),
('-1000149','All mortals will perish!','11334','1','0','0','20078','kazzak SAY_AGGRO2'),
('-1000150','All life must be eradicated! ','11335','1','0','0','20079','kazzak SAY_SURPREME1'),
('-1000151','I''ll rip the flesh from your bones!','11336','1','0','0','20080','kazzak SAY_SURPREME2'),
('-1000152','Kirel narak!','11337','1','0','0','20081','kazzak SAY_KILL1'),
('-1000153','Contemptible wretch!','11338','1','0','0','20082','kazzak SAY_KILL2'),
('-1000154','The universe will be remade.','11339','1','0','0','20083','kazzak SAY_KILL3'),
('-1000155','The Legion... will never... fall.','11340','1','0','0','20084','kazzak SAY_DEATH'),

('-1000156','Bloodmaul Brew? Me favorite!','0','0','0','0','18171','bladespire ogre SAY_BREW_1'),

('-1000157','Invaders, you dangle upon the precipice of oblivion! The Burning Legion comes and with it comes your end.','0','1','0','0','15895','kazzak SAY_RAND1'),
('-1000158','Impudent whelps, you only delay the inevitable. Where one has fallen, ten shall rise. Such is the will of Kazzak...','0','1','0','0','16432','kazzak SAY_RAND2'),

('-1000159','Do not proceed. You will be eliminated.','11344','1','0','0','20941','doomwalker SAY_AGGRO'),
('-1000160','Tectonic disruption commencing.','11345','1','0','0','20942','doomwalker SAY_EARTHQUAKE_1'),
('-1000161','Magnitude set. Release.','11346','1','0','0','20943','doomwalker SAY_EARTHQUAKE_2'),
Expand Down
3 changes: 3 additions & 0 deletions sql/scriptdev2/spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(28856,'spell_increased_healing_done_dummy'),
(28851,'spell_increased_healing_done_dummy'),
(28853,'spell_increased_healing_done_dummy'),
(21056,'spell_mark_of_lord_kazzak'),
(21063,'spell_twisted_reflection'),
(491,'spell_gameobject_call_for_help_on_usage'), -- Khadgar's Unlocking
(857,'spell_gameobject_call_for_help_on_usage'), -- Khadgar's Unlocking
(1804,'spell_gameobject_call_for_help_on_usage'), -- Pick Lock
Expand Down Expand Up @@ -415,6 +417,7 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(34012,'spell_raise_dead'),
(34019,'spell_raise_dead'),
(41071,'spell_raise_dead'),
(32960,'spell_mark_of_doomlord_kazzak'),
(40567,'spell_ogrila_flasks'),
(40568,'spell_ogrila_flasks'),
(40572,'spell_ogrila_flasks'),
Expand Down
184 changes: 56 additions & 128 deletions src/game/AI/ScriptDevAI/scripts/outland/boss_doomlord_kazzak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,182 +22,110 @@ SDCategory: Hellfire Peninsula
EndScriptData */

#include "AI/ScriptDevAI/include/sc_common.h"
#include "AI/ScriptDevAI/base/CombatAI.h"

enum
{
SAY_INTRO = -1000147,
SAY_AGGRO1 = -1000148,
SAY_AGGRO2 = -1000149,
SAY_SURPREME1 = -1000150,
SAY_SURPREME2 = -1000151,
SAY_KILL1 = -1000152,
SAY_KILL2 = -1000153,
SAY_KILL3 = -1000154,
SAY_DEATH = -1000155,
EMOTE_GENERIC_FRENZY = -1000002,
SAY_RAND1 = -1000157,
SAY_RAND2 = -1000158,
SAY_INTRO = 20076,
SAY_INTRO_2 = 15895, // no sound
SAY_AGGRO1 = 20077,
SAY_AGGRO2 = 20078,
SAY_SUPREME_1 = 20079,
SAY_SUPREME_2 = 20080,
SAY_KILL1 = 20081,
SAY_KILL2 = 20082,
SAY_KILL3 = 20083,
SAY_DEATH = 20084,
SAY_DEATH_2 = 16432,
EMOTE_GENERIC_FRENZY = 1191,

SPELL_SHADOW_VOLLEY = 32963,
SPELL_CLEAVE = 16044,
SPELL_THUNDERCLAP = 36706,
SPELL_VOID_BOLT = 21066,
SPELL_MARK_OF_KAZZAK = 32960,
SPELL_FRENZY = 32964, // triggers 32963
SPELL_ENRAGE = 32964, // triggers 32963
SPELL_CAPTURE_SOUL = 48473, // procs 32966 on player kill
SPELL_TWISTED_REFLECTION = 21063,
SPELL_BERSERK = 32965, // triggers 32963
};

struct boss_doomlordkazzakAI : public ScriptedAI
struct boss_doomlordkazzakAI : public CombatAI
{
boss_doomlordkazzakAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); }

uint32 m_uiShadowVolleyTimer;
uint32 m_uiCleaveTimer;
uint32 m_uiThunderClapTimer;
uint32 m_uiVoidBoltTimer;
uint32 m_uiMarkOfKazzakTimer;
uint32 m_uiEnrageTimer;
uint32 m_uiGreatEnrageTimer;
uint32 m_uiTwistedReflectionTimer;

void Reset() override
boss_doomlordkazzakAI(Creature* creature) : CombatAI(creature, 0)
{
m_uiShadowVolleyTimer = urand(6000, 10000);
m_uiCleaveTimer = 7000;
m_uiThunderClapTimer = urand(14000, 18000);
m_uiVoidBoltTimer = 30000;
m_uiMarkOfKazzakTimer = 25000;
m_uiEnrageTimer = 60000;
m_uiGreatEnrageTimer = 3 * MINUTE * IN_MILLISECONDS;
m_uiTwistedReflectionTimer = 33000; // Timer may be incorrect
AddOnKillText(SAY_KILL1, SAY_KILL2, SAY_KILL3);
}

void JustRespawned() override
{
DoScriptText(SAY_INTRO, m_creature);
CombatAI::JustRespawned();
DoScriptText(urand(0, 1) ? SAY_INTRO : SAY_INTRO_2, m_creature);
}

void Aggro(Unit* /*pWho*/) override
void Aggro(Unit* /*who*/) override
{
DoScriptText(urand(0, 1) ? SAY_AGGRO1 : SAY_AGGRO2, m_creature);
DoCastSpellIfCan(m_creature, SPELL_CAPTURE_SOUL, CAST_TRIGGERED);
DoCastSpellIfCan(nullptr, SPELL_CAPTURE_SOUL, CAST_TRIGGERED);
}

void KilledUnit(Unit* pVictim) override
void JustDied(Unit* /*killer*/) override
{
// When Kazzak kills a player (not pets/totems), he regens some health
if (pVictim->GetTypeId() != TYPEID_PLAYER)
return;
DoScriptText(urand(0, 1) ? SAY_DEATH : SAY_DEATH_2, m_creature);
}

switch (urand(0, 2))
void OnSpellCast(SpellEntry const* spellInfo, Unit* target) override
{
switch (spellInfo->Id)
{
case 0: DoScriptText(SAY_KILL1, m_creature); break;
case 1: DoScriptText(SAY_KILL2, m_creature); break;
case 2: DoScriptText(SAY_KILL3, m_creature); break;
case SPELL_ENRAGE:
DoScriptText(EMOTE_GENERIC_FRENZY, m_creature);
DoScriptText(urand(0, 1) ? SAY_SUPREME_1 : SAY_SUPREME_2, m_creature);
break;
}
}
};

void JustDied(Unit* /*pKiller*/) override
// 32960 - Mark of Kazzak
struct MarkOfDoomlordKazzak : public AuraScript
{
void OnPeriodicCalculateAmount(Aura* aura, uint32& amount) const override
{
DoScriptText(SAY_DEATH, m_creature);
if (aura->GetTarget()->HasMana())
amount = aura->GetTarget()->GetMaxPower(POWER_MANA) * 5 / 100;
}

void UpdateAI(const uint32 uiDiff) override
void OnPeriodicTickEnd(Aura* aura) const override
{
// Return since we have no target
if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim())
return;

// Cleave_Timer
if (m_uiCleaveTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK)
m_uiCleaveTimer = urand(8000, 12000);
}
else
m_uiCleaveTimer -= uiDiff;

// ThunderClap_Timer
if (m_uiThunderClapTimer < uiDiff)
{
if (DoCastSpellIfCan(nullptr, SPELL_THUNDERCLAP) == CAST_OK)
m_uiThunderClapTimer = urand(10000, 14000);
}
else
m_uiThunderClapTimer -= uiDiff;

// VoidBolt_Timer
if (m_uiVoidBoltTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_VOID_BOLT) == CAST_OK)
m_uiVoidBoltTimer = urand(15000, 18000);
}
else
m_uiVoidBoltTimer -= uiDiff;

// MarkOfKazzak_Timer
if (m_uiMarkOfKazzakTimer < uiDiff)
if (aura->GetTarget()->HasMana())
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, SPELL_MARK_OF_KAZZAK, SELECT_FLAG_PLAYER | SELECT_FLAG_POWER_MANA))
if (aura->GetTarget()->GetPower(POWER_MANA) == 0)
{
if (DoCastSpellIfCan(pTarget, SPELL_MARK_OF_KAZZAK) == CAST_OK)
m_uiMarkOfKazzakTimer = 20000;
aura->GetTarget()->CastSpell(nullptr, 32961, TRIGGERED_OLD_TRIGGERED);
aura->GetTarget()->RemoveAurasDueToSpell(aura->GetId());
}
}
else
m_uiMarkOfKazzakTimer -= uiDiff;

// Enrage_Timer
if (m_uiEnrageTimer < uiDiff)
{
if (DoCastSpellIfCan(nullptr, SPELL_FRENZY) == CAST_OK)
{
DoScriptText(EMOTE_GENERIC_FRENZY, m_creature);
m_uiEnrageTimer = 60000;
}
}
else
m_uiEnrageTimer -= uiDiff;

// Great_Enrage_Timer
if (m_uiGreatEnrageTimer)
{
if (m_uiGreatEnrageTimer <= uiDiff)
{
if (DoCastSpellIfCan(nullptr, SPELL_BERSERK) == CAST_OK)
m_uiGreatEnrageTimer = 0;
}
else
m_uiGreatEnrageTimer -= uiDiff;
}

// Twisted Reflection
if (m_uiTwistedReflectionTimer < uiDiff)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, SPELL_TWISTED_REFLECTION, SELECT_FLAG_PLAYER))
{
if (DoCastSpellIfCan(pTarget, SPELL_TWISTED_REFLECTION) == CAST_OK)
m_uiTwistedReflectionTimer = 15000;
}
}
else
m_uiTwistedReflectionTimer -= uiDiff;

DoMeleeAttackIfReady();
}
};

UnitAI* GetAI_boss_doomlordkazzak(Creature* pCreature)
// 21063 - Twisted Reflection
struct TwistedReflection : public AuraScript
{
return new boss_doomlordkazzakAI(pCreature);
}
SpellAuraProcResult OnProc(Aura* aura, ProcExecutionData& procData) const override
{
procData.triggerTarget = procData.victim;
procData.triggeredSpellId = 21064;
return SPELL_AURA_PROC_OK;
}
};

void AddSC_boss_doomlordkazzak()
{
Script* pNewScript = new Script;
pNewScript->Name = "boss_doomlord_kazzak";
pNewScript->GetAI = &GetAI_boss_doomlordkazzak;
pNewScript->GetAI = &GetNewAIInstance<boss_doomlordkazzakAI>;
pNewScript->RegisterSelf();

RegisterSpellScript<MarkOfDoomlordKazzak>("spell_mark_of_doomlord_kazzak");
RegisterSpellScript<TwistedReflection>("spell_twisted_reflection");
}
18 changes: 18 additions & 0 deletions src/game/AI/ScriptDevAI/scripts/world/boss_highlord_kruul.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,22 @@ GameObjectAI* GetAI_go_infernaling_summoner(GameObject* go)
return new go_infernaling_summoner(go);
}

// 21056 - Mark of Kazzak
struct MarkOfLordKazzak : public AuraScript
{
void OnPeriodicTickEnd(Aura* aura) const override
{
if (aura->GetTarget()->HasMana())
{
if (aura->GetTarget()->GetPower(POWER_MANA) == 0)
{
aura->GetTarget()->CastSpell(nullptr, 21058, TRIGGERED_OLD_TRIGGERED);
aura->GetTarget()->RemoveAurasDueToSpell(aura->GetId());
}
}
}
};

void AddSC_boss_highlord_kruul()
{
Script* pNewScript = new Script;
Expand All @@ -422,4 +438,6 @@ void AddSC_boss_highlord_kruul()
pNewScript->Name = "go_infernaling_summoner";
pNewScript->GetGameObjectAI = &GetAI_go_infernaling_summoner;
pNewScript->RegisterSelf();

RegisterSpellScript<MarkOfLordKazzak>("spell_mark_of_lord_kazzak");
}
34 changes: 0 additions & 34 deletions src/game/Spells/SpellAuras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7069,19 +7069,6 @@ void Aura::PeriodicTick()
DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %s power leech of %s for %u dmg inflicted by %u",
GetCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), pdamage, GetId());

switch (GetId())
{
case 32960: // Mark of Kazzak
{
if (target->GetTypeId() == TYPEID_PLAYER && target->GetPowerType() == POWER_MANA)
{
// Drain 5% of target's mana
pdamage = target->GetMaxPower(POWER_MANA) * 5 / 100;
}
break;
}
}

int32 drain_amount = target->GetPower(power) > pdamage ? pdamage : target->GetPower(power);

drain_amount -= target->GetResilienceRatingDamageReduction(uint32(drain_amount), SpellDmgClass(spellProto->DmgClass), false, power);
Expand Down Expand Up @@ -7114,27 +7101,6 @@ void Aura::PeriodicTick()

target->AddThreat(pCaster, float(gain) * 0.5f, false, GetSpellSchoolMask(spellProto), spellProto);
}

// Some special cases
switch (GetId())
{
case 21056: // Mark of Kazzak
case 32960: // Mark of Kazzak
{
uint32 triggerSpell = 0;
switch (GetId())
{
case 21056: triggerSpell = 21058; break;
case 32960: triggerSpell = 32961; break;
}
if (target->GetTypeId() == TYPEID_PLAYER && target->GetPower(power) == 0)
{
target->CastSpell(target, triggerSpell, TRIGGERED_OLD_TRIGGERED, nullptr, this);
target->RemoveAurasDueToSpell(GetId());
}
break;
}
}
break;
}
case SPELL_AURA_PERIODIC_ENERGIZE:
Expand Down
4 changes: 0 additions & 4 deletions src/game/Spells/UnitAuraProcHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -905,10 +905,6 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(ProcExecutionData& data)
basepoints[0] = damage;
break;
}
// Twisted Reflection (boss spell)
case 21063:
triggered_spell_id = 21064;
break;
// Unstable Power
case 24658:
{
Expand Down

0 comments on commit caec8f7

Please sign in to comment.