*Fix a crash bug of phase hunter script.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-01-19 10:50:31 -06:00
parent a07f3af045
commit c81b6bc7b6
@@ -814,7 +814,8 @@ struct TRINITY_DLL_DECL mob_phase_hunterAI : public ScriptedAI
void Aggro(Unit *who)
{
PlayerGUID = who->GetGUID();
if(Player *player = who->GetCharmerOrOwnerPlayerOrPlayerItself())
PlayerGUID = player->GetGUID();
}
void SpellHit(Unit *caster, const SpellEntry *spell)
@@ -849,7 +850,8 @@ struct TRINITY_DLL_DECL mob_phase_hunterAI : public ScriptedAI
{
Unit* target = Unit::GetUnit((*m_creature), PlayerGUID);
if(target && !Weak && m_creature->GetHealth() < (m_creature->GetMaxHealth() / 100 * WeakPercent) && ((Player*)target)->GetQuestStatus(10190) == QUEST_STATUS_INCOMPLETE)
if(target && !Weak && m_creature->GetHealth() < (m_creature->GetMaxHealth() / 100 * WeakPercent)
&& ((Player*)target)->GetQuestStatus(10190) == QUEST_STATUS_INCOMPLETE)
{
DoTextEmote(EMOTE_WEAK, 0);
Weak = true;