void KilledUnit(Unit *pVictim) { if (pVictim->GetGUID() != me->GetGUID()) if (IceTombGUID) { Unit* Tomb = Unit::GetUnit((*me), IceTombGUID); if (Tomb) { Tomb->RemoveAurasDueToSpell(SPELL_ICE_TOMB); Tomb->RemoveAurasDueToSpell(SPELL_ASPHYXIATION); Tomb->ApplySpellImmune(0, IMMUNITY_ID, SPELL_MYSTIC_BUFFET, false); Tomb->ApplySpellImmune(0, IMMUNITY_ID, SPELL_MYSTIC_BUFFET2, false); } } }
void JustDied(Unit *killer) { if (killer->GetGUID() != me->GetGUID()) if (IceTombGUID) { Unit* Tomb = Unit::GetUnit((*me), IceTombGUID); if (Tomb) { Tomb->RemoveAurasDueToSpell(SPELL_ICE_TOMB); Tomb->RemoveAurasDueToSpell(SPELL_ASPHYXIATION); Tomb->ApplySpellImmune(0, IMMUNITY_ID, SPELL_MYSTIC_BUFFET, false); Tomb->ApplySpellImmune(0, IMMUNITY_ID, SPELL_MYSTIC_BUFFET2, false); } } icetombs.clear(); }
void CastExplosion() { DoZoneInCombat(); // make sure everyone is in threatlist std::vector<Unit*> targets; std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); for (; i != me->getThreatManager().getThreatList().end(); ++i) { Unit *pTarget = (*i)->getTarget(); if (pTarget->GetTypeId() != TYPEID_PLAYER) continue; if (pTarget->HasAura(SPELL_ICEBOLT)) { pTarget->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, true); targets.push_back(pTarget); continue; } for (IceBlockMap::const_iterator itr = iceblocks.begin(); itr != iceblocks.end(); ++itr) { if (GameObject* pGo = GameObject::GetGameObject(*me, itr->second)) { if (pGo->IsInBetween(me, pTarget, 2.0f) && me->GetExactDist2d(pTarget->GetPositionX(), pTarget->GetPositionY()) - me->GetExactDist2d( pGo->GetPositionX(), pGo->GetPositionY()) < 5.0f) { pTarget->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, true); targets.push_back(pTarget); break; } } } } me->CastSpell(me, SPELL_FROST_EXPLOSION, true); for (std::vector<Unit*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) (*itr)->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, false); }
void UpdateAI(const uint32 diff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if (phase == 1) { if (FrostAura_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FROST_AURA); FrostAura_Timer = 5000; }else FrostAura_Timer -= diff; if (LifeDrain_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target, m_bIsRegularMode ? SPELL_LIFE_DRAIN_H : SPELL_LIFE_DRAIN); LifeDrain_Timer = 24000; }else LifeDrain_Timer -= diff; if (Blizzard_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_BLIZZARD); Blizzard_Timer = 20000; }else Blizzard_Timer -= diff; // Cleave if (m_uiCleaveTimer < diff) { DoCast(m_creature->getVictim(), SPELL_CLEAVE); m_uiCleaveTimer = 7000 + rand()%3000; } else m_uiCleaveTimer -= diff; // Tail Sweep if (m_uiTailSweepTimer < diff) { DoCast(m_creature->getVictim(), m_bIsRegularMode ? SPELL_TAIL_LASH_H : SPELL_TAIL_LASH); m_uiTailSweepTimer = 15000 + rand()%5000; } else m_uiTailSweepTimer -= diff; if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() > 10) { if (Fly_Timer < diff) { phase = 2; m_creature->InterruptNonMeleeSpells(false); m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); m_creature->StopMoving(); m_creature->GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MoveIdle(); m_creature->GetMap()->CreatureRelocation(m_creature, SAPPHIRON_X, SAPPHIRON_Y, SAPPHIRON_Z + 2.0f, m_creature->GetOrientation()); m_creature->SendMonsterMove(SAPPHIRON_X, SAPPHIRON_Y, SAPPHIRON_Z + 20, SPLINETYPE_NORMAL, m_creature->GetSplineFlags(), 1); //DoCast(m_creature,11010); m_creature->SetHover(true); //DoCast(m_creature,18430); Icebolt_Timer = 4000; Icebolt_Count = 0; landoff = false; }else Fly_Timer -= diff; } } if (phase == 2) { if (Icebolt_Timer < diff && Icebolt_Count < 5) { if (Icebolt_Count == 1 || Icebolt_Count == 3) if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) { DoCast(target, SPELL_ICEBOLT); targets.push_back(target); } ++Icebolt_Count; Icebolt_Timer = 4000; }else Icebolt_Timer -= diff; if (Icebolt_Count == 5 && !landoff) { if (FrostBreath_Timer < diff) { // apply immune std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList(); for(std::list<HostileReference *>::iterator itr = t_list.begin(); itr != t_list.end(); ++itr) { Unit* pUnit = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) { if (!pUnit->HasAura(SPELL_ICEBOLT)) { for(std::vector<Unit*>::iterator itr2 = targets.begin(); itr2 != targets.end(); ++itr2) { if (*itr) { if (pUnit->GetDistance2d(*itr2) <= 10 && (*itr2)->HasAura(SPELL_ICEBOLT)) pUnit->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); } } } } } DoScriptText(EMOTE_BREATH, m_creature); DoCast(m_creature->getVictim(),SPELL_FROST_BREATH_H); land_Timer = 2000; landoff = true; FrostBreath_Timer = 6000; }else FrostBreath_Timer -= diff; } if (landoff) { if (land_Timer < diff) { phase = 1; m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LAND); m_creature->SetHover(false); //m_creature->GetMotionMaster()->Clear(false); //m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); DoStartMovement(m_creature->getVictim()); std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList(); for(std::list<HostileReference *>::iterator itr = t_list.begin(); itr != t_list.end(); ++itr) { Unit* pUnit = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) pUnit->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, false); } targets.clear(); Fly_Timer = 67000; }else land_Timer -= diff; } } if (Beserk_Timer < diff) { DoScriptText(EMOTE_ENRAGE, m_creature); DoCast(m_creature,SPELL_BESERK, 1); Beserk_Timer = 900000; }else Beserk_Timer -= diff; if (phase!=2) DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if (phase == 1) { if (FrostAura_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FROST_AURA); FrostAura_Timer = 5000; }else FrostAura_Timer -= diff; if (LifeDrain_Timer < diff) { if (Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0)) DoCastSpellIfCan(target,SPELL_LIFE_DRAIN); LifeDrain_Timer = 24000; }else LifeDrain_Timer -= diff; if (Blizzard_Timer < diff) { if (Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0)) DoCastSpellIfCan(target,SPELL_BLIZZARD); Blizzard_Timer = 20000; }else Blizzard_Timer -= diff; // Cleave if (m_uiCleaveTimer < diff) { DoCast(m_creature->getVictim(), SPELL_CLEAVE); m_uiCleaveTimer = 7000 + rand()%3000; } else m_uiCleaveTimer -= diff; // Tail Sweep if (m_uiTailSweepTimer < diff) { DoCast(m_creature->getVictim(), m_bIsRegularMode ? SPELL_TAIL_LASH : SPELL_TAIL_LASH_H); m_uiTailSweepTimer = 15000 + rand()%5000; } else m_uiTailSweepTimer -= diff; if (m_creature->GetHealthPercent() > 10.0f) { if (Fly_Timer < diff) { phase = 2; m_creature->InterruptNonMeleeSpells(false); m_creature->StopMoving(); m_creature->HandleEmote(EMOTE_ONESHOT_LIFTOFF); m_creature->GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MoveIdle(); m_creature->MonsterMove(SAPPHIRON_X, SAPPHIRON_Y, SAPPHIRON_Z + 20, 1); //DoCast(m_creature,11010); //m_creature->SetHover(true); //DoCast(m_creature,18430); Icebolt_Timer = 4000; Icebolt_Count = 0; landoff = false; }else Fly_Timer -= diff; } } if (phase == 2) { if (Icebolt_Timer < diff && Icebolt_Count < 5) { if (Icebolt_Count == 1 || Icebolt_Count == 3) if (Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0)) { DoCast(target, SPELL_ICEBOLT); targets.push_back(target); } ++Icebolt_Count; Icebolt_Timer = 4000; }else Icebolt_Timer -= diff; if (Icebolt_Count == 5 && !landoff) { if (FrostBreath_Timer < diff) { // apply immune ThreatList const& tList = m_creature->getThreatManager().getThreatList(); for (ThreatList::const_iterator iter = tList.begin();iter != tList.end(); ++iter) { Unit* pUnit = m_creature->GetMap()->GetUnit((*iter)->getUnitGuid()); if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER) && pUnit->isAlive()) { if (!pUnit->HasAura(SPELL_ICEBOLT)) { for(std::vector<Unit*>::iterator itr = targets.begin(); itr!= targets.end(); ++itr) { if (*itr) { if(!(*itr)->isAlive()) return; if (pUnit->GetDistance2d(*itr) <= 5 && (*itr)->HasAura(SPELL_ICEBOLT)) pUnit->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); } } } } } DoScriptText(EMOTE_BREATH, m_creature); DoCast(m_creature->getVictim(),m_bIsRegularMode ? SPELL_FROST_BREATH : SPELL_FROST_BREATH_H); land_Timer = 2000; landoff = true; FrostBreath_Timer = 6000; }else FrostBreath_Timer -= diff; } if (landoff) { if (land_Timer < diff) { phase = 1; m_creature->HandleEmote(EMOTE_ONESHOT_LAND); m_creature->SetHover(false); m_creature->GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); ThreatList const& tList = m_creature->getThreatManager().getThreatList(); for (ThreatList::const_iterator iter = tList.begin();iter != tList.end(); ++iter) { Unit* pUnit = m_creature->GetMap()->GetUnit((*iter)->getUnitGuid()); if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) pUnit->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, false); } targets.clear(); Fly_Timer = 67000; isAtGround = false; land_time = 3500; }else land_Timer -= diff; } } if(phase == 1 && isAtGround == false) { if(land_time < diff) { isAtGround = true; DoStartMovement(m_creature->getVictim()); }else land_time -=diff; } if (Beserk_Timer < diff) { if (DoCastSpellIfCan(m_creature, SPELL_BESERK) == CAST_OK) { DoScriptText(EMOTE_GENERIC_ENRAGED, m_creature); Beserk_Timer = 300000; } }else Beserk_Timer -= diff; if (phase!=2 && isAtGround == true) DoMeleeAttackIfReady(); }