Skip to content

Commit

Permalink
[3127] Replace Princess Moria with Priestess of Thaurissan if require…
Browse files Browse the repository at this point in the history
…d - BRD

Also cleanup script for Emperor Dagran Thaurissan

Close #138
  • Loading branch information
xfurry committed Apr 20, 2015
1 parent 327097b commit c3af183
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 53 deletions.
5 changes: 5 additions & 0 deletions scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.h
Expand Up @@ -23,6 +23,7 @@ enum

NPC_EMPEROR = 9019,
NPC_PRINCESS = 8929,
NPC_PRIESTESS = 10076,
NPC_PHALANX = 9502,
NPC_HATEREL = 9034,
NPC_ANGERREL = 9035,
Expand Down Expand Up @@ -80,6 +81,9 @@ enum
GO_DWARFRUNE_F01 = 170583,
GO_DWARFRUNE_G01 = 170584,

QUEST_ROYAL_RESCUE = 4003, // horde quest
QUEST_FATE_KINGDOM = 4362, // alliance quest

SPELL_STONED = 10255, // Aura of Warbringer Constructs in Relict Vault

FACTION_DWARF_HOSTILE = 754, // Hostile faction for the Tomb of the Seven dwarfs
Expand Down Expand Up @@ -157,6 +161,7 @@ class instance_blackrock_depths : public ScriptedInstance

private:
void DoCallNextDwarf();
bool CanReplacePrincess();

uint32 m_auiEncounter[MAX_ENCOUNTER];
std::string m_strInstData;
Expand Down
Expand Up @@ -44,15 +44,13 @@ struct boss_emperor_dagran_thaurissanAI : public ScriptedAI

ScriptedInstance* m_pInstance;

uint32 m_uiHandOfThaurissan_Timer;
uint32 m_uiAvatarOfFlame_Timer;
// uint32 m_uiCounter;
uint32 m_uiHandOfThaurissanTimer;
uint32 m_uiAvatarOfFlameTimer;

void Reset() override
{
m_uiHandOfThaurissan_Timer = 4000;
m_uiAvatarOfFlame_Timer = 25000;
// m_uiCounter = 0;
m_uiHandOfThaurissanTimer = 4000;
m_uiAvatarOfFlameTimer = 25000;
}

void Aggro(Unit* /*pWho*/) override
Expand All @@ -68,6 +66,10 @@ struct boss_emperor_dagran_thaurissanAI : public ScriptedAI

if (Creature* pPrincess = m_pInstance->GetSingleCreatureFromStorage(NPC_PRINCESS))
{
// check if we didn't update the entry
if (pPrincess->GetEntry() != NPC_PRINCESS)
return;

if (pPrincess->isAlive())
{
pPrincess->SetFactionTemporary(FACTION_NEUTRAL, TEMPFACTION_NONE);
Expand All @@ -86,34 +88,25 @@ struct boss_emperor_dagran_thaurissanAI : public ScriptedAI
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;

if (m_uiHandOfThaurissan_Timer < uiDiff)
if (m_uiHandOfThaurissanTimer < uiDiff)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
DoCastSpellIfCan(pTarget, SPELL_HANDOFTHAURISSAN);

// 3 Hands of Thaurissan will be casted
// if (m_uiCounter < 3)
//{
// m_uiHandOfThaurissan_Timer = 1000;
// ++m_uiCounter;
//}
// else
//{
m_uiHandOfThaurissan_Timer = 5000;
// m_uiCounter = 0;
//}
{
if (DoCastSpellIfCan(pTarget, SPELL_HANDOFTHAURISSAN) == CAST_OK)
m_uiHandOfThaurissanTimer = 5000;
}
}
else
m_uiHandOfThaurissan_Timer -= uiDiff;
m_uiHandOfThaurissanTimer -= uiDiff;

// AvatarOfFlame_Timer
if (m_uiAvatarOfFlame_Timer < uiDiff)
if (m_uiAvatarOfFlameTimer < uiDiff)
{
DoCastSpellIfCan(m_creature->getVictim(), SPELL_AVATAROFFLAME);
m_uiAvatarOfFlame_Timer = 18000;
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_AVATAROFFLAME) == CAST_OK)
m_uiAvatarOfFlameTimer = 18000;
}
else
m_uiAvatarOfFlame_Timer -= uiDiff;
m_uiAvatarOfFlameTimer -= uiDiff;

DoMeleeAttackIfReady();
}
Expand Down Expand Up @@ -150,17 +143,17 @@ struct boss_moira_bronzebeardAI : public ScriptedAI

ScriptedInstance* m_pInstance;

uint32 m_uiHeal_Timer;
uint32 m_uiMindBlast_Timer;
uint32 m_uiShadowWordPain_Timer;
uint32 m_uiSmite_Timer;
uint32 m_uiHealTimer;
uint32 m_uiMindBlastTimer;
uint32 m_uiShadowWordPainTimer;
uint32 m_uiSmiteTimer;

void Reset() override
{
m_uiHeal_Timer = 12000; // These times are probably wrong
m_uiMindBlast_Timer = 16000;
m_uiShadowWordPain_Timer = 2000;
m_uiSmite_Timer = 8000;
m_uiHealTimer = 12000; // These times are probably wrong
m_uiMindBlastTimer = 16000;
m_uiShadowWordPainTimer = 2000;
m_uiSmiteTimer = 8000;
}

void AttackStart(Unit* pWho) override
Expand All @@ -183,7 +176,7 @@ struct boss_moira_bronzebeardAI : public ScriptedAI
{
// if evade, then check if he is alive. If not, start make portal
if (!pEmperor->isAlive())
m_creature->CastSpell(m_creature, SPELL_OPEN_PORTAL, false);
DoCastSpellIfCan(m_creature, SPELL_OPEN_PORTAL);
}
}
}
Expand All @@ -195,45 +188,46 @@ struct boss_moira_bronzebeardAI : public ScriptedAI
return;

// MindBlast_Timer
if (m_uiMindBlast_Timer < uiDiff)
if (m_uiMindBlastTimer < uiDiff)
{
DoCastSpellIfCan(m_creature->getVictim(), SPELL_MINDBLAST);
m_uiMindBlast_Timer = 14000;
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MINDBLAST) == CAST_OK)
m_uiMindBlastTimer = 14000;
}
else
m_uiMindBlast_Timer -= uiDiff;
m_uiMindBlastTimer -= uiDiff;

// ShadowWordPain_Timer
if (m_uiShadowWordPain_Timer < uiDiff)
if (m_uiShadowWordPainTimer < uiDiff)
{
DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWWORDPAIN);
m_uiShadowWordPain_Timer = 18000;
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWWORDPAIN) == CAST_OK)
m_uiShadowWordPainTimer = 18000;
}
else
m_uiShadowWordPain_Timer -= uiDiff;
m_uiShadowWordPainTimer -= uiDiff;

// Smite_Timer
if (m_uiSmite_Timer < uiDiff)
if (m_uiSmiteTimer < uiDiff)
{
DoCastSpellIfCan(m_creature->getVictim(), SPELL_SMITE);
m_uiSmite_Timer = 10000;
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SMITE) == CAST_OK)
m_uiSmiteTimer = 10000;
}
else
m_uiSmite_Timer -= uiDiff;
m_uiSmiteTimer -= uiDiff;

// Heal_Timer
if (m_uiHeal_Timer < uiDiff)
if (m_uiHealTimer < uiDiff)
{
if (Creature* pEmperor = m_pInstance->GetSingleCreatureFromStorage(NPC_EMPEROR))
{
if (pEmperor->isAlive() && pEmperor->GetHealthPercent() != 100.0f)
DoCastSpellIfCan(pEmperor, SPELL_HEAL);
{
if (DoCastSpellIfCan(pEmperor, SPELL_HEAL) == CAST_OK)
m_uiHealTimer = 10000;
}
}

m_uiHeal_Timer = 10000;
}
else
m_uiHeal_Timer -= uiDiff;
m_uiHealTimer -= uiDiff;

// No meele?
}
Expand Down
Expand Up @@ -46,8 +46,12 @@ void instance_blackrock_depths::OnCreatureCreate(Creature* pCreature)
{
switch (pCreature->GetEntry())
{
case NPC_EMPEROR:
case NPC_PRINCESS:
// replace the princess if required
if (CanReplacePrincess())
pCreature->UpdateEntry(NPC_PRIESTESS);
// no break;
case NPC_EMPEROR:
case NPC_PHALANX:
case NPC_HATEREL:
case NPC_ANGERREL:
Expand Down Expand Up @@ -400,6 +404,27 @@ void instance_blackrock_depths::DoCallNextDwarf()
++m_uiDwarfRound;
}

// function that replaces the princess if requirements are met
bool instance_blackrock_depths::CanReplacePrincess()
{
Map::PlayerList const& players = instance->GetPlayers();
if (players.isEmpty())
return false;

for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
if (Player* pPlayer = itr->getSource())
{
// if at least one player didn't complete the quest, return false
if ((pPlayer->GetTeam() == ALLIANCE && !pPlayer->GetQuestRewardStatus(QUEST_FATE_KINGDOM))
|| (pPlayer->GetTeam() == HORDE && !pPlayer->GetQuestRewardStatus(QUEST_ROYAL_RESCUE)))
return false;
}
}

return true;
}

void instance_blackrock_depths::Update(uint32 uiDiff)
{
if (m_uiDwarfFightTimer)
Expand Down
2 changes: 1 addition & 1 deletion sd2_revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __SD2_REVISION_NR_H__
#define __SD2_REVISION_NR_H__
#define SD2_REVISION_NR "3126"
#define SD2_REVISION_NR "3127"
#endif // __SD2_REVISION_NR_H__

0 comments on commit c3af183

Please sign in to comment.