void UpdateAI(const uint32 uiDiff) override
    {
        if (!m_pInstance || m_pInstance->GetData(TYPE_VALITHRIA) == DONE)
            return;

        if (m_uiResetTimer)
        {
            if (m_uiResetTimer <= uiDiff)
            {
                if (Creature* pGreenDragon = m_pInstance->GetSingleCreatureFromStorage(NPC_VALITHRIA))
                {
                    pGreenDragon->ForcedDespawn();
                    Reset();
                }
                m_uiResetTimer = 0;
            }
            else
                m_uiResetTimer -= uiDiff;

            return;
        }

        if (m_uiCheckTimer <= uiDiff)
        {
            if (Creature* pGreenDragon = m_pInstance->GetSingleCreatureFromStorage(NPC_VALITHRIA))
            {
                if (!pGreenDragon->isAlive())
                    m_uiResetTimer = 60000;
            }

            m_uiCheckTimer = 2000;
        }
        else
            m_uiCheckTimer -= uiDiff;
    }
Example #2
0
        // Only call in context where m_pInstance is valid
        bool CanPreventAddsResurrect()
        {
            // If any add is alive, return false
            if (m_pInstance->GetData(TYPE_ZATH) != SPECIAL || m_pInstance->GetData(TYPE_LORKHAN) != SPECIAL)
            {
                return false;
            }

            // Else Prevent them Resurrecting
            if (Creature* pLorkhan = m_pInstance->GetSingleCreatureFromStorage(NPC_LORKHAN))
            {
                if (boss_thekalBaseAI* pFakerAI = dynamic_cast<boss_thekalBaseAI*>(pLorkhan->AI()))
                {
                    pFakerAI->PreventRevive();
                }
            }
            if (Creature* pZath = m_pInstance->GetSingleCreatureFromStorage(NPC_ZATH))
            {
                if (boss_thekalBaseAI* pFakerAI = dynamic_cast<boss_thekalBaseAI*>(pZath->AI()))
                {
                    pFakerAI->PreventRevive();
                }
            }

            return true;
        }
 void JustDidDialogueStep(int32 iEntry) override
 {
     switch (iEntry)
     {
         case SAY_COUNCIL_INTRO_2:
             m_creature->GetMotionMaster()->MovePoint(1, aLanathelFlyPos[0], aLanathelFlyPos[1], aLanathelFlyPos[2]);
             break;
         case NPC_BLOOD_ORB_CONTROL:
             if (m_pInstance)
             {
                 if (Creature* pTaldaram = m_pInstance->GetSingleCreatureFromStorage(NPC_TALDARAM))
                 {
                     pTaldaram->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER);
                     pTaldaram->RemoveAurasDueToSpell(SPELL_FEIGN_DEATH);
                     pTaldaram->SetHealth(1);
                 }
                 if (Creature* pKeleseth = m_pInstance->GetSingleCreatureFromStorage(NPC_KELESETH))
                 {
                     pKeleseth->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER);
                     pKeleseth->RemoveAurasDueToSpell(SPELL_FEIGN_DEATH);
                     pKeleseth->SetHealth(1);
                 }
                 if (Creature* pValanar = m_pInstance->GetSingleCreatureFromStorage(NPC_VALANAR))
                 {
                     pValanar->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER);
                     pValanar->RemoveAurasDueToSpell(SPELL_FEIGN_DEATH);
                     pValanar->SetHealth(1);
                 }
             }
             break;
     }
 }
Example #4
0
    void UpdateAI(const uint32 uiDiff) override
    {
        if (m_uiResurrectTimer)
        {
            if (m_uiResurrectTimer <= uiDiff)
            {
                if (!m_pInstance)
                    return;

                switch (m_uiResurrectPhase)
                {
                    case 0:
                        DoCastSpellIfCan(m_creature, SPELL_SCOURGE_RES_CHANNEL);
                        if (Creature* pIngvar = m_pInstance->GetSingleCreatureFromStorage(NPC_INGVAR))
                        {
                            if (pIngvar->HasAura(SPELL_SUMMON_BANSHEE))
                                pIngvar->RemoveAurasDueToSpell(SPELL_SUMMON_BANSHEE);
                        }
                        m_uiResurrectTimer = 3000;
                        break;
                    case 1:
                        if (Creature* pIngvar = m_pInstance->GetSingleCreatureFromStorage(NPC_INGVAR))
                        {
                            pIngvar->CastSpell(pIngvar, SPELL_SCOURGE_RES_SUMMON, true);
                            // Workaround - set Feign death again because it's removed by the previous casted spell
                            pIngvar->CastSpell(pIngvar, SPELL_FEIGN_DEATH, true);
                        }
                        m_uiResurrectTimer = 5000;
                        break;
                    case 2:
                        if (Creature* pIngvar = m_pInstance->GetSingleCreatureFromStorage(NPC_INGVAR))
                            pIngvar->CastSpell(pIngvar, SPELL_SCOURGE_RES_HEAL, false);
                        m_uiResurrectTimer = 3000;
                        break;
                    case 3:
                        if (Creature* pIngvar = m_pInstance->GetSingleCreatureFromStorage(NPC_INGVAR))
                            pIngvar->CastSpell(pIngvar, SPELL_TRANSFORM, false);
                        // despawn the creature
                        m_creature->GetMotionMaster()->MovePoint(2, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ() + 50);
                        m_creature->ForcedDespawn(5000);
                        m_uiResurrectTimer = 0;
                        break;
                }

                ++m_uiResurrectPhase;
            }
            else
                m_uiResurrectTimer -= uiDiff;
        }
    }
Example #5
0
    void JustDied(Unit* /*pKiller*/) override
    {
        DoScriptText(SAY_DEATH, m_creature);

        if (!m_pInstance)
            return;

        m_pInstance->SetData(TYPE_THEKAL, DONE);

        // remove the two adds
        if (Creature* pZath = m_pInstance->GetSingleCreatureFromStorage(NPC_ZATH))
            pZath->ForcedDespawn();
        if (Creature* pLorkhan = m_pInstance->GetSingleCreatureFromStorage(NPC_LORKHAN))
            pLorkhan->ForcedDespawn();
    }
    void JustReachedHome() override
    {
        if (m_pInstance)
        {
            // Note: council respawn handled by creature linking

            if (Creature* pVoiceTrigger = m_pInstance->GetSingleCreatureFromStorage(NPC_COUNCIL_VOICE))
                pVoiceTrigger->AI()->EnterEvadeMode();

            if (Creature* pController = m_pInstance->GetSingleCreatureFromStorage(NPC_ILLIDARI_COUNCIL))
                pController->AI()->EnterEvadeMode();

            m_pInstance->SetData(TYPE_COUNCIL, FAIL);
        }
    }
Example #7
0
        void SummonedMovementInform(Creature* pSummoned, uint32 uiType, uint32 uiPointId) override
        {
            if (uiType != POINT_MOTION_TYPE)
            {
                return;
            }

            if (uiPointId == 1)
            {
                if (pSummoned->GetEntry() == NPC_CORE_ENTROPIUS)
                {
                    // Interrupt Velen's casting when entropius has reached the ground
                    if (Creature* pVelen = m_pInstance->GetSingleCreatureFromStorage(NPC_VELEN))
                    {
                        pVelen->InterruptNonMeleeSpells(false);
                    }
                }
                else if (pSummoned->GetEntry() == NPC_VELEN)
                {
                    // Cast teleport and despawn Velen, the portal and Kalec; Liadrin will despawn on timer
                    pSummoned->CastSpell(pSummoned, SPELL_TELEPORT_VISUAL, true);
                    pSummoned->ForcedDespawn(1000);

                    // Note: portal should despawn only after all the soldiers have reached this point and "teleported" outside
                    if (Creature* pPortal = m_creature->GetMap()->GetCreature(m_PortalGuid))
                    {
                        pPortal->ForcedDespawn(5000);
                    }

                    if (Creature* pKalec = m_pInstance->GetSingleCreatureFromStorage(NPC_KALECGOS))
                    {
                        pKalec->ForcedDespawn(1000);
                    }
                }
            }
            else if (uiPointId == 2 && pSummoned->GetEntry() == NPC_CORE_ENTROPIUS)
            {
                // When the purified Muru reaches the ground the sunwell ignites and Muru despawns
                DoCastSpellIfCan(m_creature, SPELL_SUNWELL_IGNITION);

                if (Creature* pLiadrin = m_pInstance->GetSingleCreatureFromStorage(NPC_LIADRIN))
                {
                    pLiadrin->SetStandState(UNIT_STAND_STATE_KNEEL);
                }

                pSummoned->ForcedDespawn();
            }
        }
Example #8
0
bool EffectDummyCreature_npc_crystal_spike_trigger(Unit* /*pCaster*/, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Creature* pCreatureTarget, ObjectGuid /*originalCasterGuid*/)
{
    // always check spellid and effectindex
    if (uiSpellId == SPELL_CRYSTAL_SPIKE_AURA && uiEffIndex == EFFECT_INDEX_0)
    {
        if (pCreatureTarget->GetEntry() == NPC_CRYSTAL_SPIKE_INITIAL || pCreatureTarget->GetEntry() == NPC_CRYSTAL_SPIKE_TRIGGER)
        {
            ScriptedInstance* pInstance = (ScriptedInstance*)pCreatureTarget->GetInstanceData();
            if (!pInstance)
                return true;

            Creature* pOrmorok = pInstance->GetSingleCreatureFromStorage(NPC_ORMOROK);
            if (!pOrmorok)
                return true;

            // The following spells define the direction of the spike line
            // All of the spells are targeting the back of the caster, but some take a small turn to left or right
            // The exact algorithm is unk but we know that the chances of getting a straight line are about 75%. The other two directions are about 12.5% each
            uint32 castSpellId;
            if (roll_chance_i(75))
                castSpellId = SPELL_CRYSTAL_SPIKE_BACK;
            else
                castSpellId = urand(0, 1) ? SPELL_CRYSTAL_SPIKE_LEFT : SPELL_CRYSTAL_SPIKE_RIGHT;

            pCreatureTarget->CastSpell(pCreatureTarget, castSpellId, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, pOrmorok->GetObjectGuid());
            // always return true when we are handling this spell and effect
            return true;
        }
    }

    return false;
}
Example #9
0
    void UpdateAI(const uint32 uiDiff) override
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (m_uiSeparationCheckTimer < uiDiff)
        {
            if (!m_pInstance)
                return;

            // Distance guesswork, but should be ok
            Creature* pGarr = m_pInstance->GetSingleCreatureFromStorage(NPC_GARR);
            if (pGarr && pGarr->isAlive() && !m_creature->IsWithinDist2d(pGarr->GetPositionX(), pGarr->GetPositionY(), 50.0f))
                DoCastSpellIfCan(m_creature, SPELL_SEPARATION_ANXIETY, CAST_TRIGGERED);

            m_uiSeparationCheckTimer = 5000;
        }
        else
            m_uiSeparationCheckTimer -= uiDiff;

        // Cast Erruption and let them die
        if (m_creature->GetHealthPercent() <= 10.0f)
        {
            DoCastSpellIfCan(m_creature->getVictim(), SPELL_ERUPTION);
            m_creature->SetDeathState(JUST_DIED);
            m_creature->RemoveCorpse();
        }

        DoMeleeAttackIfReady();
    }
Example #10
0
        void WaypointReached(uint32 uiPointId) override
        {
            switch (uiPointId)
            {
            case 7:
                DoScriptText(SAY_FIRST_CORNER, m_creature);
                m_uiSubeventPhase = 0;
                m_uiEventTimer = 2000;
                m_uiPoint = uiPointId;
                SetEscortPaused(true);
                break;
            case 15:
                m_uiSubeventPhase = 0;
                m_uiEventTimer = 2000;
                m_uiPoint = uiPointId;
                SetEscortPaused(true);
                break;
            case 26:
                DoScriptText(SAY_NARALEX_CHAMBER, m_creature);
                break;
            case 32:
                if (Creature* pNaralex = m_pInstance->GetSingleCreatureFromStorage(NPC_NARALEX))
                {
                    m_creature->SetFacingToObject(pNaralex);
                }

                m_creature->SetStandState(UNIT_STAND_STATE_KNEEL);
                m_uiEventTimer = 2000;
                m_uiSubeventPhase = 0;
                m_uiPoint = uiPointId;
                SetEscortPaused(true);
                break;
            }
        }
Example #11
0
        // Handle circel movement around the boss
        void MovementInform(uint32 uiMoveType, uint32 uiPointId) override
        {
            if (uiMoveType != POINT_MOTION_TYPE || !uiPointId || !m_pInstance)
            {
                return;
            }

            if (Creature* pSummoner = m_pInstance->GetSingleCreatureFromStorage(NPC_KILJAEDEN))
            {
                // Calculate new position based on the angle between the boss and self
                float fX, fY, fAng;
                fAng = pSummoner->GetAngle(m_creature) + M_PI_F / 8;
                // Normalize angle
                if (fAng > 2 * M_PI_F)
                {
                    fAng = fAng - 2 * M_PI_F;
                }

                pSummoner->GetNearPoint2D(fX, fY, 25.0f, fAng);

                // Move to new position
                m_creature->GetMotionMaster()->Clear();
                m_creature->GetMotionMaster()->MovePoint(1, fX, fY, m_creature->GetPositionZ());
            }
        }
    void JustDied(Unit* pKiller)
    {
        if (!m_pInstance)
            return;

        Creature* pDelrissa = m_pInstance->GetSingleCreatureFromStorage(NPC_DELRISSA);
        uint32 uiLackeyDeathCount = m_pInstance->GetData(TYPE_DELRISSA_DEATH_COUNT);

        if (!pDelrissa)
            return;

        //should delrissa really yell if dead?
        DoScriptText(LackeyDeath[uiLackeyDeathCount].id, pDelrissa);

        m_pInstance->SetData(TYPE_DELRISSA_DEATH_COUNT, SPECIAL);

        //increase local var, since we now may have four dead
        ++uiLackeyDeathCount;

        if (uiLackeyDeathCount == MAX_ACTIVE_LACKEY)
        {
            //time to make her lootable and complete event if she died before lackeys
            if (!pDelrissa->isAlive())
            {
                if (!pDelrissa->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE))
                    pDelrissa->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);

                m_pInstance->SetData(TYPE_DELRISSA, DONE);
            }
        }
    }
    void EnterCombat(Unit* pWho)
    {
        if (!pWho)
            return;

        if (m_pInstance)
        {
            for(uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i)
            {
                if (Creature* pAdd = m_creature->GetMap()->GetCreature(m_aLackeyGuid[i]))
                {
                    if (!pAdd->getVictim() && pAdd != m_creature)
                    {
                        pWho->SetInCombatWith(pAdd);
                        pAdd->AddThreat(pWho);
                    }
                }
            }

            if (Creature* pDelrissa = m_pInstance->GetSingleCreatureFromStorage(NPC_DELRISSA))
            {
                if (pDelrissa->isAlive() && !pDelrissa->getVictim())
                {
                    pWho->SetInCombatWith(pDelrissa);
                    pDelrissa->AddThreat(pWho);
                }
            }
        }

        Aggro(pWho);
    }
Example #14
0
    void DoInitializeAdds()
    {
        // not if m_creature are dead, so avoid
        if (!m_creature->isAlive())
            return;

        // it's empty, so first time
        if (m_vAddsEntryList.empty())
        {
            m_vAddsEntryList.resize(MAX_ACTIVE_ADDS);

            for (uint8 i = 0; i < MAX_ACTIVE_ADDS; ++i)
            {
                uint8 uiAddVersion = urand(0, 1);
                m_vAddsEntryList[i] = aSpawnEntries[i][uiAddVersion];
                m_creature->SummonCreature(aSpawnEntries[i][uiAddVersion], m_aAddPositions[i][0], m_aAddPositions[i][1], m_aAddPositions[i][2], m_aAddPositions[i][3], TEMPSPAWN_CORPSE_DESPAWN, 0);
            }
        }
        // Resummon the killed adds
        else
        {
            if (!m_pInstance)
                return;

            for (uint8 i = 0; i < MAX_ACTIVE_ADDS; ++i)
            {
                // If we already have the creature on the map, then don't summon it
                if (m_pInstance->GetSingleCreatureFromStorage(m_vAddsEntryList[i], true))
                    continue;

                m_creature->SummonCreature(m_vAddsEntryList[i], m_aAddPositions[i][0], m_aAddPositions[i][1], m_aAddPositions[i][2], m_aAddPositions[i][3], TEMPSPAWN_CORPSE_DESPAWN, 0);
            }
        }
    }
Example #15
0
    void UpdateAI(const uint32 uiDiff) override
    {
        m_councilDialogue.DialogueUpdate(uiDiff);

        if (m_uiAggroYellTimer)
        {
            if (m_uiAggroYellTimer <= uiDiff)
            {
                // Start yells
                m_councilDialogue.StartNextDialogueText(SAY_GATH_AGGRO);
                m_uiAggroYellTimer = 0;
            }
            else
                m_uiAggroYellTimer -= uiDiff;
        }

        if (m_uiEnrageTimer)
        {
            if (m_uiEnrageTimer <= uiDiff)
            {
                // Cast berserk on all members
                for (unsigned int i : aCouncilMember)
                {
                    if (Creature* pMember = m_pInstance->GetSingleCreatureFromStorage(i))
                        pMember->CastSpell(pMember, SPELL_BERSERK, TRIGGERED_OLD_TRIGGERED);
                }
                // Start yells
                m_councilDialogue.StartNextDialogueText(SAY_GATH_BERSERK);
                m_uiEnrageTimer = 0;
            }
            else
                m_uiEnrageTimer -= uiDiff;
        }
    }
Example #16
0
bool EffectAuraDummy_spell_aura_dummy_awaken_dwarf(const Aura* pAura, bool bApply)
{
    if (bApply)
    {
        return true;
    }

    if ((pAura->GetId() == SPELL_AWAKEN_EARTHEN_DWARF || pAura->GetId() == SPELL_AWAKEN_EARTHEN_GUARDIAN) && pAura->GetEffIndex() == EFFECT_INDEX_0)
    {
        if (Creature* pTarget = (Creature*)pAura->GetTarget())
        {
            pTarget->RemoveAurasDueToSpell(SPELL_STONED);

            ScriptedInstance* pInstance = (ScriptedInstance*)pTarget->GetInstanceData();
            if (!pInstance)
            {
                return true;
            }

            if (Creature* pArchaedas = pInstance->GetSingleCreatureFromStorage(NPC_ARCHAEDAS))
            {
                pTarget->AI()->AttackStart(pArchaedas->getVictim());
            }
        }
    }

    return true;
}
Example #17
0
bool EffectDummyCreature_npc_vault_warder(Unit* /*pCaster*/, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Creature* pCreatureTarget, ObjectGuid /*originalCasterGuid*/)
{
    // always check spellid and effectindex
    if (uiSpellId == SPELL_AWAKEN_VAULT_WARDER && uiEffIndex == EFFECT_INDEX_0)
    {
        if (pCreatureTarget->GetEntry() == NPC_VAULT_WARDER)
        {
            pCreatureTarget->RemoveAurasDueToSpell(SPELL_STONED);

            ScriptedInstance* pInstance = (ScriptedInstance*)pCreatureTarget->GetInstanceData();
            if (!pInstance)
            {
                return true;
            }

            if (Creature* pArchaedas = pInstance->GetSingleCreatureFromStorage(NPC_ARCHAEDAS))
            {
                pCreatureTarget->AI()->AttackStart(pArchaedas->getVictim());
            }

            return true;
        }
    }

    return false;
}
    void UpdateAI(const uint32 diff)
    {
        if (Repair_Timer < diff)
        {
            if (m_pInstance && m_pInstance->GetData(TYPE_MEKGINEER_STEAMRIGGER) == IN_PROGRESS)
            {
                if (Creature* pMekgineer = m_pInstance->GetSingleCreatureFromStorage(NPC_STEAMRIGGER))
                {
                    if (m_creature->IsWithinDistInMap(pMekgineer, MAX_REPAIR_RANGE))
                    {
                        //are we already channeling? Doesn't work very well, find better check?
                        if (!m_creature->GetUInt32Value(UNIT_CHANNEL_SPELL))
                        {
                            //m_creature->GetMotionMaster()->MovementExpired();
                            //m_creature->GetMotionMaster()->MoveIdle();

                            DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_REPAIR : SPELL_REPAIR_H, CAST_TRIGGERED);
                        }
                        Repair_Timer = 5000;
                    }
                    else
                    {
                        //m_creature->GetMotionMaster()->MovementExpired();
                        //m_creature->GetMotionMaster()->MoveFollow(pMekgineer,0,0);
                    }
                }
            }else Repair_Timer = 5000;
        }else Repair_Timer -= diff;

        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        DoMeleeAttackIfReady();
    }
Example #19
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (m_uiPassiveSpellTimer)
        {
            if (m_uiPassiveSpellTimer <= uiDiff)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_NETHER_BEAM, CAST_TRIGGERED) == CAST_OK)
                    m_uiPassiveSpellTimer = 1000;
            }
            else
                m_uiPassiveSpellTimer -= uiDiff;
        }

        if (m_uiOrientationTimer)
        {
            if (m_uiOrientationTimer <= uiDiff)
            {
                if (m_pInstance)
                {
                    if (Creature* pNetherspite = m_pInstance->GetSingleCreatureFromStorage(NPC_NETHERSPITE))
                        m_creature->SetFacingToObject(pNetherspite);
                }
                m_uiOrientationTimer = 1000;
            }
            else
                m_uiOrientationTimer -= uiDiff;
        }
    }
Example #20
0
    bool EffectDummy(Unit* /*pCaster*/, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Object* pTarget, ObjectGuid /*originalCasterGuid*/) override
    {
        Creature* pCreatureTarget = pTarget->ToCreature();
        if (uiEffIndex != EFFECT_INDEX_0 || pCreatureTarget->GetEntry() != NPC_SUB_BOSS_TRIGGER)
            return true;

        ScriptedInstance* pInstance = (ScriptedInstance*)pCreatureTarget->GetInstanceData();

        if (!pInstance)
            return true;

        if (Creature* pGoth = pInstance->GetSingleCreatureFromStorage(NPC_GOTHIK))
        {
            uint32 uiNpcEntry = NPC_SPECT_TRAINEE;

            if (uiSpellId == SPELL_B_TO_SKULL)
                uiNpcEntry = NPC_SPECT_DEATH_KNIGHT;
            else if (uiSpellId == SPELL_C_TO_SKULL)
                uiNpcEntry = NPC_SPECT_RIDER;

            pGoth->SummonCreature(uiNpcEntry, pCreatureTarget->GetPositionX(), pCreatureTarget->GetPositionY(), pCreatureTarget->GetPositionZ(), pCreatureTarget->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 0);

            if (uiNpcEntry == NPC_SPECT_RIDER)
                pGoth->SummonCreature(NPC_SPECT_HORSE, pCreatureTarget->GetPositionX(), pCreatureTarget->GetPositionY(), pCreatureTarget->GetPositionZ(), pCreatureTarget->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 0);
        }
        return true;
    }
Example #21
0
bool ProcessEventId_event_spell_summon_nightbane(uint32 /*uiEventId*/, Object* pSource, Object* /*pTarget*/, bool bIsStart)
{
    if (bIsStart && pSource->GetTypeId() == TYPEID_PLAYER)
    {
        ScriptedInstance* pInstance = (ScriptedInstance*)((Player*)pSource)->GetInstanceData();
        if (!pInstance)
            return false;

        if (pInstance->GetData(TYPE_NIGHTBANE) == NOT_STARTED || pInstance->GetData(TYPE_NIGHTBANE) == FAIL)
        {
            if (Creature* pNightbane = pInstance->GetSingleCreatureFromStorage(NPC_NIGHTBANE))
            {
                DoScriptText(EMOTE_AWAKEN, ((Player*)pSource));
                pInstance->SetData(TYPE_NIGHTBANE, IN_PROGRESS);

                // Sort of a hack, it is unclear how this really work but the values appear to be valid (see Onyxia, too)
                pNightbane->SetStandState(UNIT_STAND_STATE_STAND);
                pNightbane->SetByteValue(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_FLY_ANIM);
                pNightbane->SetLevitate(true);

                // Switch to waypoint movement
                if (boss_nightbaneAI* pNightbaneAI = dynamic_cast<boss_nightbaneAI*>(pNightbane->AI()))
                    pNightbaneAI->Start(true);
            }
        }
    }

    return true;
}
    void KilledUnit(Unit* pVictim) override
    {
        if (pVictim->GetTypeId() == TYPEID_PLAYER)
        {
            ++m_uiKillCount;

            if (m_uiKillCount == 3)
            {
                DoScriptText(SAY_DING_KILL, m_creature);

                if (m_pInstance)
                {
                    if (Creature* pJindo = m_pInstance->GetSingleCreatureFromStorage(NPC_JINDO))
                    {
                        if (pJindo->isAlive())
                            DoScriptText(SAY_GRATS_JINDO, pJindo);
                    }
                }

                DoCastSpellIfCan(m_creature, SPELL_LEVEL_UP, CAST_TRIGGERED);
                m_uiKillCount = 0;
            }

            if (m_creature->isInCombat())
            {
                if (Creature* pSpirit = GetClosestCreatureWithEntry(pVictim, NPC_CHAINED_SPIRIT, 50.0f))
                    pSpirit->CastSpell(pVictim, SPELL_REVIVE, TRIGGERED_NONE);
            }
        }
    }
Example #23
0
    void UpdateAI(const uint32 uiDiff) override
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (m_uiFrenzyTimer < uiDiff)
        {
            DoCastSpellIfCan(m_creature, SPELL_LYNX_FRENZY);
            m_uiFrenzyTimer = urand(20000, 30000);          // subsequent frenzys casted every 20-30 seconds
        }
        else
            m_uiFrenzyTimer -= uiDiff;

        if (m_uiShredArmorTimer < uiDiff)
        {
            DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHRED_ARMOR);
            m_uiShredArmorTimer = 4000;
        }
        else
            m_uiShredArmorTimer -= uiDiff;

        // Unite spirits at 10% health
        // Note: maybe there is some spell related to this - needs research
        if (!m_bHasUnited && m_creature->GetHealthPercent() < 10.0f && m_pInstance)
        {
            if (Creature* pHalazzi = m_pInstance->GetSingleCreatureFromStorage(NPC_HALAZZI))
            {
                if (boss_halazziAI* pBossAI = dynamic_cast<boss_halazziAI*>(pHalazzi->AI()))
                    pBossAI->DoReuniteSpirits();
            }
            m_bHasUnited = true;
        }

        DoMeleeAttackIfReady();
    }
    void UpdateAI(const uint32 uiDiff) override
    {
        // Should despawn when aura 44251 expires
        if (m_uiDespawnTimer < uiDiff)
        {
            m_creature->DealDamage(m_creature, m_creature->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
            m_uiDespawnTimer = 0;
        }
        else
            m_uiDespawnTimer -= uiDiff;

        if (m_uiChangeTargetTimer < uiDiff)
        {
            if (!m_pInstance)
                return;

            // Follow the target - do not attack
            if (Creature* pKael = m_pInstance->GetSingleCreatureFromStorage(NPC_KAELTHAS))
            {
                if (Unit* pTarget = pKael->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                    m_creature->GetMotionMaster()->MoveFollow(pTarget, 0, 0);
            }

            m_uiChangeTargetTimer = urand(5000, 15000);
        }
        else
            m_uiChangeTargetTimer -= uiDiff;
    }
    // Wrapper to handle the image version initialize
    void DoInitializeImage()
    {
        if (!m_pInstance)
        {
            return;
        }

        // Initialize the health of the clone
        if (Creature* pProphet = m_pInstance->GetSingleCreatureFromStorage(NPC_SKERAM))
        {
            float fHealthPct = pProphet->GetHealthPercent();
            float fMaxHealthPct = 0;

            // The max health depends on the split phase. It's percent * original boss health
            if (fHealthPct < 25.0f)
            {
                fMaxHealthPct = 0.50f;
            }
            else if (fHealthPct < 50.0f)
            {
                fMaxHealthPct = 0.20f;
            }
            else
            {
                fMaxHealthPct = 0.10f;
            }

            // Set the same health percent as the original boss
            m_creature->SetMaxHealth(m_creature->GetMaxHealth()*fMaxHealthPct);
            m_creature->SetHealthPercent(fHealthPct);
            m_creature->SetCorpseDelay(0);
        }
    }
    void KilledUnit(Unit* pVictim) override
    {
        if (!m_pInstance)
            return;

        if (Creature* pDelrissa = m_pInstance->GetSingleCreatureFromStorage(NPC_DELRISSA))
            pDelrissa->AI()->KilledUnit(pVictim);
    }
Example #27
0
    void KilledUnit(Unit* pVictim) override
    {
        if (!m_pInstance)
            return;

        if (Creature* pHalazzi = m_pInstance->GetSingleCreatureFromStorage(NPC_HALAZZI))
            pHalazzi->AI()->KilledUnit(pVictim);
    }
    // Only for Dreadscale and Icehowl
    void DoSummonNextBeast(uint32 uiBeastEntry)
    {
        if (uiBeastEntry == NPC_DREADSCALE)
        {
            if (Creature* pTirion = m_pInstance->GetSingleCreatureFromStorage(NPC_TIRION_A))
                DoScriptText(SAY_TIRION_BEAST_2, pTirion);

            m_creature->SummonCreature(NPC_DREADSCALE, aSpawnPositions[2][0], aSpawnPositions[2][1], aSpawnPositions[2][2], aSpawnPositions[2][3], TEMPSUMMON_DEAD_DESPAWN, 0);
        }
        else
        {
            if (Creature* pTirion = m_pInstance->GetSingleCreatureFromStorage(NPC_TIRION_A))
                DoScriptText(SAY_TIRION_BEAST_3, pTirion);

            m_creature->SummonCreature(NPC_ICEHOWL, aSpawnPositions[4][0], aSpawnPositions[4][1], aSpawnPositions[4][2], aSpawnPositions[4][3], TEMPSUMMON_DEAD_DESPAWN, 0);
        }
    }
Example #29
0
 void JustDied(Unit* /*pKiller*/) override
 {
     if (m_pInstance)
     {
         if (Creature* pGarr = m_pInstance->GetSingleCreatureFromStorage(NPC_GARR))
             pGarr->CastSpell(pGarr, SPELL_ENRAGE, true, NULL, NULL, m_creature->GetObjectGuid());
     }
 }
    void JustDied(Unit* /*pKiller*/) override
    {
        if (m_pInstance)
        {
            m_pInstance->SetData(TYPE_BLOOD_PRINCE_COUNCIL, DONE);

            // Kill the 3 princes
            if (Creature* pTmp = m_pInstance->GetSingleCreatureFromStorage(NPC_VALANAR))
                m_creature->DealDamage(pTmp, pTmp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NONE, NULL, false);

            if (Creature* pTmp = m_pInstance->GetSingleCreatureFromStorage(NPC_KELESETH))
                m_creature->DealDamage(pTmp, pTmp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NONE, NULL, false);

            if (Creature* pTmp = m_pInstance->GetSingleCreatureFromStorage(NPC_TALDARAM))
                m_creature->DealDamage(pTmp, pTmp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NONE, NULL, false);
        }
    }