*Fix a bug that shade of Akama causes crash.

--HG--
branch : trunk
This commit is contained in:
megamage
2008-12-14 11:55:32 -06:00
parent 29f92cbd90
commit 1d2179a529
@@ -1,4 +1,4 @@
/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> /* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
@@ -188,9 +188,12 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI
bool IsBanished; bool IsBanished;
bool HasKilledAkama; bool HasKilledAkama;
bool reseting;
void Reset() void Reset()
{ {
reseting = true;
m_creature->setActive(true); // TODO: setActive(true, time); m_creature->setActive(true); // TODO: setActive(true, time);
FindChannelers(); FindChannelers();
@@ -221,15 +224,17 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI
if(!Sorcerers.empty()) if(!Sorcerers.empty())
{ {
for(std::list<uint64>::iterator itr = Sorcerers.begin(); itr != Sorcerers.end(); ++itr) for(std::list<uint64>::iterator itr = Sorcerers.begin(); itr != Sorcerers.end(); ++itr)
{
if(Creature* Sorcerer = ((Creature*)Unit::GetUnit(*m_creature, *itr))) if(Creature* Sorcerer = ((Creature*)Unit::GetUnit(*m_creature, *itr)))
if(Sorcerer->isAlive()) if(Sorcerer->isAlive())
{ {
Sorcerer->SetVisibility(VISIBILITY_OFF); Sorcerer->SetVisibility(VISIBILITY_OFF);
Sorcerer->DealDamage(Sorcerer, Sorcerer->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); Sorcerer->Kill(Sorcerer);
}
} }
Sorcerers.clear(); Sorcerers.clear();
} }
if(Unit* Akama = Unit::GetUnit(*m_creature, AkamaGUID)) if(Unit* Akama = Unit::GetUnit(*m_creature, AkamaGUID))
Akama->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); Akama->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
@@ -253,6 +258,8 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI
if(pInstance && m_creature->isAlive()) if(pInstance && m_creature->isAlive())
pInstance->SetData(DATA_SHADEOFAKAMAEVENT, NOT_STARTED); pInstance->SetData(DATA_SHADEOFAKAMAEVENT, NOT_STARTED);
reseting = false;
} }
void Aggro(Unit* who) { } void Aggro(Unit* who) { }
@@ -274,6 +281,9 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI
void IncrementDeathCount(uint64 guid = 0) // If guid is set, will remove it from list of sorcerer void IncrementDeathCount(uint64 guid = 0) // If guid is set, will remove it from list of sorcerer
{ {
if(reseting)
return;
debug_log("SD2: Increasing Death Count for Shade of Akama encounter"); debug_log("SD2: Increasing Death Count for Shade of Akama encounter");
++DeathCount; ++DeathCount;
m_creature->RemoveSingleAuraFromStack(SPELL_SHADE_SOUL_CHANNEL_2, 0); m_creature->RemoveSingleAuraFromStack(SPELL_SHADE_SOUL_CHANNEL_2, 0);