Skip to content

Commit

Permalink
Remove Acherus Deathcharger AI - handled by DB
Browse files Browse the repository at this point in the history
  • Loading branch information
xfurry committed Nov 4, 2016
1 parent b011fe9 commit d363e4d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 151 deletions.
5 changes: 2 additions & 3 deletions sql/scriptdev2/scriptdev2.sql
Expand Up @@ -623,7 +623,6 @@ UPDATE creature_template SET ScriptName='npc_scarlet_ghoul' WHERE entry=28845;
UPDATE creature_template SET ScriptName='npc_highlord_darion_mograine' WHERE entry=29173;
UPDATE creature_template SET ScriptName='npc_fellow_death_knight' WHERE entry IN (29199, 29204, 29200);
UPDATE creature_template SET ScriptName='npc_lich_king_light_dawn' WHERE entry=29183;
UPDATE creature_template SET ScriptName='npc_acherus_deathcharger' WHERE entry=28782;
UPDATE creature_template SET ScriptName='npc_scarlet_courier' WHERE entry=29076;

/* ELWYNN FOREST */
Expand Down Expand Up @@ -5904,8 +5903,8 @@ INSERT INTO script_texts (entry,content_default,sound,type,language,emote,commen
(-1609095,'$gPoppy:Mama;!',0,0,0,434,'scarlet ghoul SAY_GHUL_SPAWN_5'),
(-1609096,'It puts the ghoul in the pit or else it gets the lash!',0,0,0,25,'gothik the harvester SAY_GOTHIK_THROW_IN_PIT'),

(-1609097,'%s rears up, beckoning you to ride it.',0,2,0,0,'Acherus Deathcharger EMOTE_HORSE_READY'),
(-1609098,'Impressive, death knight. Return to me in the world of the living for your reward.',0,0,0,2,'Salanar the Horseman SAY_RACE_FINISHED'),
(-1609097,'REUSE ME',0,0,0,0,'REUSE ME'),
(-1609098,'REUSE ME',0,0,0,0,'REUSE ME'),

(-1609201,'Soldiers of the Scourge, stand ready! Prepare to unleash your fury upon the Argent Dawn!',14677,1,0,0,'Highlord Darion Mograine'),
(-1609202,'The sky weeps at the devastation of these lands! Soon, Azeroth\'s futile tears will rain down upon us!',14678,1,0,0,'Highlord Darion Mograine'),
Expand Down
151 changes: 3 additions & 148 deletions src/scriptdev2/scripts/eastern_kingdoms/scarlet_enclave/ebon_hold.cpp
Expand Up @@ -786,7 +786,8 @@ struct npc_unworthy_initiate_anchorAI : public ScriptedAI
if (pInitiate && pSource)
{
pInitiate->SetLootRecipient(pSource);
m_creature->CastSpell(pInitiate, SPELL_CHAINED_PESANT_BREATH, true);
m_creature->InterruptNonMeleeSpells(false);
m_creature->CastSpell(pInitiate, SPELL_CHAINED_PESANT_BREATH, false);
}
}

Expand Down Expand Up @@ -959,6 +960,7 @@ struct npc_unworthy_initiateAI : public ScriptedAI
{
if (m_uiPhase == PHASE_DRESSUP)
{
// ToDo: send the creature to the left / right in order to grab a weapon
m_creature->CastSpell(m_creature, SPELL_INITIATE_VISUAL, false);

m_uiPhase = PHASE_ACTIVATE;
Expand Down Expand Up @@ -2757,147 +2759,6 @@ CreatureAI* GetAI_npc_lich_king_light_dawn(Creature* pCreature)
return new npc_lich_king_light_dawnAI(pCreature);
}

/*######
## npc_acherus_deathcharger
######*/

enum
{
EMOTE_HORSE_READY = -1609097,
SAY_RACE_FINISHED = -1609098,

SPELL_HORSEMAN_SLAIN = 52692,
SPELL_RACE_COMPLETE = 52361,

NPC_DARK_RIDER_OF_ACHERUS = 28768,
NPC_SALANAR_THE_HORSEMAN = 28788,

FACTION_FRIENDLY = 35,
};

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

bool m_bIsRiderDead;

uint8 m_uiQuestEndStage;
uint32 m_uiQuestEndTimer;

ObjectGuid m_salaranGuid;

void Reset() override
{
m_bIsRiderDead = false;
m_uiQuestEndStage = 0;
m_uiQuestEndTimer = 0;

SetCombatMovement(true);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}

void EnterEvadeMode() override
{
if (m_bIsRiderDead)
{
m_creature->RemoveAllAurasOnEvade();
m_creature->DeleteThreatList();
m_creature->CombatStop(true);
m_creature->LoadCreatureAddon(true);
m_creature->SetLootRecipient(NULL);

// Stop movemnet
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MoveIdle();

// Prepare to be mounted
SetCombatMovement(false);
DoScriptText(EMOTE_HORSE_READY, m_creature);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->SetFactionTemporary(FACTION_FRIENDLY, TEMPFACTION_RESTORE_RESPAWN);
}
else
ScriptedAI::EnterEvadeMode();
}

void JustSummoned(Creature* pSummoned) override
{
if (pSummoned->GetEntry() == NPC_SALANAR_THE_HORSEMAN)
{
float fX, fY, fZ;
m_creature->GetContactPoint(pSummoned, fX, fY, fZ, INTERACTION_DISTANCE);
pSummoned->GetMotionMaster()->MovePoint(1, fX, fY, fZ);

m_salaranGuid = pSummoned->GetObjectGuid();
m_uiQuestEndTimer = 4000;
}
}

void SummonedCreatureJustDied(Creature* pSummoned) override
{
// Initial vehicle rider - handled in DB
if (pSummoned->GetEntry() == NPC_DARK_RIDER_OF_ACHERUS)
{
m_bIsRiderDead = true;
DoCastSpellIfCan(m_creature, SPELL_HORSEMAN_SLAIN, CAST_TRIGGERED);
}
}

void UpdateAI(const uint32 uiDiff) override
{
if (m_uiQuestEndTimer)
{
if (m_uiQuestEndTimer <= uiDiff)
{
switch (m_uiQuestEndStage)
{
case 0:
if (Creature* pSalaran = m_creature->GetMap()->GetCreature(m_salaranGuid))
DoScriptText(SAY_RACE_FINISHED, pSalaran);

m_uiQuestEndTimer = 5000;
break;
case 1:
// Cast completion spell on player
Creature* pSalaran = m_creature->GetMap()->GetCreature(m_salaranGuid);
Player* pPlayer = m_creature->GetCharmerOrOwnerPlayerOrPlayerItself();
if (!pPlayer || !pSalaran)
return;

pSalaran->CastSpell(pPlayer, SPELL_RACE_COMPLETE, true);
pSalaran->ForcedDespawn(1000);
m_creature->ForcedDespawn(1000);
m_uiQuestEndTimer = 0;
break;
}
++m_uiQuestEndStage;
}
else
m_uiQuestEndTimer -= uiDiff;
}
}
};

CreatureAI* GetAI_npc_acherus_deathcharger(Creature* pCreature)
{
return new npc_acherus_deathchargerAI(pCreature);
}

bool EffectDummyCreature_npc_acherus_deathcharger(Unit* /*pCaster*/, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Creature* pCreatureTarget, ObjectGuid /*originalCasterGuid*/)
{
// always check spellid and effectindex
if (uiSpellId == SPELL_HORSEMAN_SLAIN && uiEffIndex == EFFECT_INDEX_0)
{
// Make horse evade
pCreatureTarget->AI()->EnterEvadeMode();

// always return true when we are handling this spell and effect
return true;
}

return false;
}

/*######
## npc_scarlet_courier
######*/
Expand Down Expand Up @@ -3082,12 +2943,6 @@ void AddSC_ebon_hold()
pNewScript->GetAI = &GetAI_npc_lich_king_light_dawn;
pNewScript->RegisterSelf();

pNewScript = new Script;
pNewScript->Name = "npc_acherus_deathcharger";
pNewScript->GetAI = &GetAI_npc_acherus_deathcharger;
pNewScript->pEffectDummyNPC = &EffectDummyCreature_npc_acherus_deathcharger;
pNewScript->RegisterSelf();

pNewScript = new Script;
pNewScript->Name = "npc_scarlet_courier";
pNewScript->GetAI = &GetAI_npc_scarlet_courier;
Expand Down

0 comments on commit d363e4d

Please sign in to comment.