void AttackStart(Unit* who)
    {
        if (instance->GetBossState(DATA_MOGRAINE_AND_WHITE_EVENT) == NOT_STARTED)
            return;

        ScriptedAI::AttackStart(who);
    }
bool AreaTrigger_at_kelthuzad_center(Player* pPlayer, const AreaTriggerEntry *at)
{
    if (pPlayer->isGameMaster())
        return false;

    ScriptedInstance* pInstance = pPlayer->GetInstanceData();
    if (!pInstance || pInstance->IsEncounterInProgress() || pInstance->GetBossState(BOSS_KELTHUZAD) == DONE)
        return false;

    Creature* pKelthuzad = CAST_CRE(Unit::GetUnit(*pPlayer, pInstance->GetData64(DATA_KELTHUZAD)));
    if (!pKelthuzad)
        return false;

    boss_kelthuzadAI* pKelthuzadAI = CAST_AI(boss_kelthuzadAI, pKelthuzad->AI());
    if (!pKelthuzadAI)
        return false;

    pKelthuzadAI->AttackStart(pPlayer);
    if (GameObject* trigger = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_KELTHUZAD_TRIGGER)))
    {
        if (trigger->getLootState() == GO_READY)
            trigger->UseDoorOrButton();

        // Note: summon must be done by trigger and not by KT. 
        // Otherwise, they attack immediately as KT is in combat.
        for (uint8 i = 0; i <= MAX_ABOMINATIONS; ++i)
        {
            if (Creature* sum = trigger->SummonCreature(NPC_ABOMINATION, PosAbominations[i]))
            {
                pKelthuzadAI->spawns.Summon(sum);
                sum->GetMotionMaster()->MoveRandom(9.0f);
                sum->SetReactState(REACT_DEFENSIVE);
            }
        }
        for (uint8 i = 0; i <= MAX_WASTES; ++i)
        {
            if (Creature* sum = trigger->SummonCreature(NPC_WASTE, PosWastes[i]))
            {
                pKelthuzadAI->spawns.Summon(sum);
                sum->GetMotionMaster()->MoveRandom(5.0f);
                sum->SetReactState(REACT_DEFENSIVE);
            }
        }
        for (uint8 i = 0; i <= MAX_WEAVERS; ++i)
        {
            if (Creature* sum = trigger->SummonCreature(NPC_WEAVER, PosWeavers[i]))
            {
                pKelthuzadAI->spawns.Summon(sum);
                sum->GetMotionMaster()->MoveRandom(9.0f);
                sum->SetReactState(REACT_DEFENSIVE);
            }
        }
    }

    return true;
}
    void UpdateAI(const uint32 diff)
    {
        if (!UpdateVictim())
            return;

        if (_bHasDied && !_bHeal && instance->GetBossState(DATA_MOGRAINE_AND_WHITE_EVENT) == SPECIAL)
        {
            // On ressurection, stop fake death and heal whitemane and resume fight
            if (Unit* Whitemane = Unit::GetUnit((*me), instance->GetData64(DATA_WHITEMANE)))
            {
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                me->SetStandState(UNIT_STAND_STATE_STAND);
                DoCast(Whitemane, SPELL_LAYONHANDS);

                CrusaderStrike_Timer = 10000;
                HammerOfJustice_Timer = 10000;

                if (me->getVictim())
                    me->GetMotionMaster()->MoveChase(me->getVictim());

                _bHeal = true;
            }
        }

        // This if-check to make sure mograine does not attack while fake death
        if (_bFakeDeath)
            return;

        // CrusaderStrike_Timer
        if (CrusaderStrike_Timer <= diff)
        {
            DoCast(me->getVictim(), SPELL_CRUSADERSTRIKE);
            CrusaderStrike_Timer = 10000;
        }
        else CrusaderStrike_Timer -= diff;

        //HammerOfJustice_Timer
        if (HammerOfJustice_Timer <= diff)
        {
            DoCast(me->getVictim(), SPELL_HAMMEROFJUSTICE);
            HammerOfJustice_Timer = 60000;
        }
        else HammerOfJustice_Timer -= diff;

        DoMeleeAttackIfReady();
    }
 void JustReachedHome()
 {
     if (instance->GetBossState(DATA_MOGRAINE_AND_WHITE_EVENT != NOT_STARTED))
         instance->SetBossState(DATA_MOGRAINE_AND_WHITE_EVENT, FAIL);
 }