void SpellHit(Unit *source, const SpellEntry *spell) { if (spell->Mechanic == MECHANIC_DISARM) DoScriptText(SAY_DISARMED, m_creature); }
void EndingPhase() { if( m_uiEndingTimer ) { switch(m_uiEndingPhase) { case 1: me->GetMotionMaster()->MoveIdle(); me->SetReactState(REACT_PASSIVE); me->AttackStop(); me->CastStop(); DoResetThreat(); DoScriptText(SAY_10_PROZENT, me); DoCastAOE(SPELL_FURY_OF_FROSTMOURNE); KingEnding(5000); break; case 2: KingEnding(10000); break; case 3: DoScriptText(SAY_ENDING_1_KING, me); KingEnding(24000); break; case 4: DoScriptText(SAY_ENDING_2_KING, me); KingEnding(25000); break; case 5: me->GetMotionMaster()->MovePoint(0, MoveEndingPosition); KingEnding(4000); break; case 6: DoCastAOE(SPELL_CHANNEL_KING); DoScriptText(SAY_ENDING_3_KING, me); KingEnding(26000); break; case 7: DoScriptText(SAY_ENDING_4_KING, me); KingEnding(9000); break; case 8: DoScriptText(SAY_ENDING_5_TIRION, pTirion); KingEnding(9000); break; case 9: DoCast(pTirion, SPELL_TIRION_LIGHT); KingEnding(5000); break; case 10: pTirion->RemoveAurasDueToSpell(SPELL_ICEBLOCK_TRIGGER); KingEnding(2000); break; case 11: pTirion->GetMotionMaster()->MovePoint(0, MoveTirionFrostmourne); KingEnding(1000); break; case 12: pTirion->GetMotionMaster()->MoveJump(517.482910, -2124.905762, 1040.861328, 10.0f, 15.0f); //pTirion->JumpTo(pFrostmourne, 15.0f); pTirion->SetUInt32Value(UNIT_NPC_EMOTESTATE, 375); KingEnding(1000); break; case 13: me->RemoveAura(SPELL_CHANNEL_KING); me->CastSpell(me, SPELL_BOOM_VISUAL, false); KingEnding(300); break; case 14: me->CastSpell(me, SPELL_SUMMON_BROKEN_FROSTMOURNE, false); KingEnding(3000); break; case 15: me->CastSpell(me, 73017, false); KingEnding(1000); break; case 16: DoScriptText(SAY_ENDING_6_KING, me); KingEnding(3000); break; case 17: pFrostmourne = me->SummonCreature(27880, me->GetPositionX()+2, me->GetPositionY()+2, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 99999999); pFrostmourne->CastSpell(pFrostmourne, SPELL_BROKEN_FROSTMOURNE, false); pFrostmourne->CastSpell(pFrostmourne, SPELL_FROSTMOURNE_TRIGGER, false); pFrostmourne->GetMotionMaster()->MoveChase(me); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED); //pTirion->CastSpell(pTirion, SPELL_DISENGAGE, false); KingEnding(2000); break; case 18: me->RemoveAllAuras(); me->RemoveAura(SPELL_SUMMON_BROKEN_FROSTMOURNE); DoScriptText(SAY_ENDING_7_KING, me); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 473); KingEnding(5000); break; case 19: DoScriptText(SAY_ENDING_8_TIRION, pTirion); KingEnding(6000); break; case 20: pFather = me->SummonCreature(CREAUTRE_MENETHIL, me->GetPositionX()+5, me->GetPositionY()+5, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 9999999); DoScriptText(SAY_ENDING_9_FATHER, pFather); ReviveCinematic(); KingEnding(6000); break; case 21: DoScriptText(SAY_ENDING_11_FATHER, pFather); pFather->CastSpell(pFather, SPELL_REVIVE_VISUAL, false); KingEnding(6000); break; case 22: DoScriptText(SAY_ENDING_10_TIRION, pTirion); KingEnding(5000); break; case 23: DoScriptText(SAY_ENDING_12_KING, me); //pTirion->SetReactState(REACT_AGGRESSIVE); //pTirion->AI()->AttackStart(me); //pFather->AI()->AttackStart(me); KingEnding(5000); break; } } }
void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; switch (Phase) { case 0: { // *Heroic mode only: if (IsHeroic()) { if (PyroblastTimer <= diff) { me->InterruptSpell(CURRENT_CHANNELED_SPELL); me->InterruptSpell(CURRENT_GENERIC_SPELL); DoCast(me, SPELL_SHOCK_BARRIER, true); DoCast(me->getVictim(), SPELL_PYROBLAST); PyroblastTimer = 60000; } else PyroblastTimer -= diff; } if (FireballTimer <= diff) { DoCast(me->getVictim(), SPELL_FIREBALL_NORMAL); FireballTimer = urand(2000, 6000); } else FireballTimer -= diff; if (PhoenixTimer <= diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1); uint8 random = urand(1, 2); float x = KaelLocations[random][0]; float y = KaelLocations[random][1]; Creature* Phoenix = me->SummonCreature(CREATURE_PHOENIX, x, y, LOCATION_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); if (Phoenix) { Phoenix->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); SetThreatList(Phoenix); if (target) Phoenix->AI()->AttackStart(target); else Phoenix->AI()->AttackStart(me->getVictim()); } DoScriptText(SAY_PHOENIX, me); PhoenixTimer = 60000; } else PhoenixTimer -= diff; if (FlameStrikeTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { me->InterruptSpell(CURRENT_CHANNELED_SPELL); me->InterruptSpell(CURRENT_GENERIC_SPELL); DoCast(target, SPELL_FLAMESTRIKE3, true); DoScriptText(SAY_FLAMESTRIKE, me); } FlameStrikeTimer = urand(15000, 25000); } else FlameStrikeTimer -= diff; // Below 50% if (HealthBelowPct(50)) { me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true); me->StopMoving(); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); GravityLapseTimer = 0; GravityLapsePhase = 0; Phase = 1; } DoMeleeAttackIfReady(); } break; case 1: { if (GravityLapseTimer <= diff) { switch (GravityLapsePhase) { case 0: if (FirstGravityLapse) // Different yells at 50%, and at every following Gravity Lapse { DoScriptText(SAY_GRAVITY_LAPSE, me); FirstGravityLapse = false; if (instance) { instance->HandleGameObject(instance->GetData64(DATA_KAEL_STATUE_LEFT), true); instance->HandleGameObject(instance->GetData64(DATA_KAEL_STATUE_RIGHT), true); } }else { DoScriptText(SAY_RECAST_GRAVITY, me); } DoCast(me, SPELL_GRAVITY_LAPSE_INITIAL); GravityLapseTimer = 2000 + diff;// Don't interrupt the visual spell GravityLapsePhase = 1; break; case 1: TeleportPlayersToSelf(); GravityLapseTimer = 1000; GravityLapsePhase = 2; break; case 2: CastGravityLapseKnockUp(); GravityLapseTimer = 1000; GravityLapsePhase = 3; break; case 3: CastGravityLapseFly(); GravityLapseTimer = 30000; GravityLapsePhase = 4; for (uint8 i = 0; i < 3; ++i) { Unit* target = NULL; target = SelectTarget(SELECT_TARGET_RANDOM, 0); Creature* Orb = DoSpawnCreature(CREATURE_ARCANE_SPHERE, 5, 5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); if (Orb && target) { Orb->SetSpeed(MOVE_RUN, 0.5f); Orb->AddThreat(target, 1000000.0f); Orb->AI()->AttackStart(target); } } DoCast(me, SPELL_GRAVITY_LAPSE_CHANNEL); break; case 4: me->InterruptNonMeleeSpells(false); DoScriptText(SAY_TIRED, me); DoCast(me, SPELL_POWER_FEEDBACK); RemoveGravityLapse(); GravityLapseTimer = 10000; GravityLapsePhase = 0; break; } } else GravityLapseTimer -= diff; } break; } }
void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; switch (stage) { case 0: { bsw->timedCast(SPELL_FEROCIOUS_BUTT, uiDiff); bsw->timedCast(SPELL_ARCTIC_BREATH, uiDiff); bsw->timedCast(SPELL_WHIRL, uiDiff); if (bsw->timedQuery(SPELL_MASSIVE_CRASH, uiDiff)) stage = 1; bsw->timedCast(SPELL_FROTHING_RAGE, uiDiff); DoMeleeAttackIfReady(); break; } case 1: { if (bsw->doCast(SPELL_MASSIVE_CRASH) == CAST_OK) stage = 2; break; } case 2: { if (pTarget = bsw->SelectUnit()) { TrampleCasted = false; me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); stage = 3; bsw->resetTimer(SPELL_TRAMPLE); DoScriptText(-1713506,me,pTarget); SetCombatMovement(false); me->GetMotionMaster()->MoveIdle(); } break; } case 3: { if (bsw->timedQuery(SPELL_TRAMPLE,uiDiff)) { pTarget->GetPosition(fPosX, fPosY, fPosZ); TrampleCasted = false; MovementStarted = true; me->GetMotionMaster()->MovePoint(1, fPosX, fPosY, fPosZ); DoScriptText(-1713508,me); bsw->doCast(SPELL_ADRENALINE); stage = 4; } break; } case 4: { if (MovementStarted) { Map* pMap = me->GetMap(); Map::PlayerList const &lPlayers = pMap->GetPlayers(); for(Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr) { Unit* pPlayer = itr->getSource(); if (!pPlayer) continue; if (pPlayer->isAlive() && pPlayer->IsWithinDistInMap(me, 5.0f)) { bsw->doCast(SPELL_TRAMPLE, pPlayer); TrampleCasted = true; MovementStarted = false; me->GetMotionMaster()->MovementExpired(); me->GetMotionMaster()->MoveChase(me->getVictim()); } } } else stage = 5; if (TrampleCasted) stage = 5; break; } case 5: { if (!TrampleCasted) { bsw->doCast(SPELL_STAGGERED_DAZE); DoScriptText(-1713507,me); } MovementStarted = false; me->GetMotionMaster()->MovementExpired(); me->GetMotionMaster()->MoveChase(me->getVictim()); SetCombatMovement(true); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); stage = 0; break; } } }
void KilledUnit(Unit *victim) { if(!m_bIsDeathPhase) DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), me); }
void JustDied(Unit* /*Killer*/) { if (!IsImage) DoScriptText(SAY_DEATH, me); }
void DoSplit(int atPercent /* 75 50 25 */) { DoScriptText(SAY_SPLIT, me); ov_mycoordinates *place1 = new ov_mycoordinates(-8340.782227f, 2083.814453f, 125.648788f, 0); ov_mycoordinates *place2 = new ov_mycoordinates(-8341.546875f, 2118.504639f, 133.058151f, 0); ov_mycoordinates *place3 = new ov_mycoordinates(-8318.822266f, 2058.231201f, 133.058151f, 0); ov_mycoordinates *bossc=place1, *i1=place2, *i2=place3; switch (urand(0, 2)) { case 0: bossc=place1; i1=place2; i2=place3; break; case 1: bossc=place2; i1=place1; i2=place3; break; case 2: bossc=place3; i1=place1; i2=place2; break; } for (uint16 i = 0; i < 41; ++i) { if (Player* target = CAST_PLR(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))) { if (Group* pGrp = target->GetGroup()) for (uint8 ico = 0; ico < TARGETICONCOUNT; ++ico) { //if (grp->m_targetIcons[ico] == me->GetGUID()) -- private member :( pGrp->SetTargetIcon(ico, 0, 0); } break; } } me->RemoveAllAuras(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetVisible(false); me->SetPosition(bossc->x, bossc->y, bossc->z, bossc->r); Invisible = true; DoResetThreat(); DoStopAttack(); switch (atPercent) { case 75: Images75 = true; break; case 50: Images50 = true; break; case 25: Images25 = true; break; } Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); Creature* Image1 = me->SummonCreature(15263, i1->x, i1->y, i1->z, i1->r, TEMPSUMMON_CORPSE_DESPAWN, 30000); if (Image1) { Image1->SetMaxHealth(me->GetMaxHealth() / 5); Image1->SetHealth(me->GetHealth() / 5); if (target) Image1->AI()->AttackStart(target); CAST_AI(boss_skeram::boss_skeramAI, Image1->AI())->IsImage = true; } Creature* Image2 = me->SummonCreature(15263, i2->x, i2->y, i2->z, i2->r, TEMPSUMMON_CORPSE_DESPAWN, 30000); if (Image2) { Image2->SetMaxHealth(me->GetMaxHealth() / 5); Image2->SetHealth(me->GetHealth() / 5); if (target) Image2->AI()->AttackStart(target); CAST_AI(boss_skeram::boss_skeramAI, Image2->AI())->IsImage = true; } Invisible = true; delete place1; delete place2; delete place3; }
void KilledUnit(Unit* /*Victim*/) { DoScriptText(SAY_KILL, me); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) { if(UnsummonCheck < diff && m_creature->isAlive()) { m_creature->SetLootRecipient(NULL); m_creature->SetVisibility(VISIBILITY_OFF); m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); m_creature->RemoveCorpse(); }else UnsummonCheck -= diff; return; } if(Fireball_Timer < diff) { if(Unit *victim = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(victim, SPELL_FIREBALL,true); Fireball_Timer = 4000+rand()%3000; }else Fireball_Timer -= diff; if(flight) // phase 1 - the flight { Creature *Vazruden = Unit::GetCreature(*m_creature,VazrudenGUID); if(Fly_Timer < diff || !(Vazruden && Vazruden->isAlive() && (Vazruden->GetHealth()*5 > Vazruden->GetMaxHealth()))) { flight = false; BellowingRoar_Timer = 6000; ConeOfFire_Timer = 12000; m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING); m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); m_creature->GetMotionMaster()->Clear(); if(Unit *victim = SelectUnit(SELECT_TARGET_NEAREST,0)) m_creature->AI()->AttackStart(victim); DoStartMovement(m_creature->getVictim()); DoScriptText(EMOTE, m_creature); return; }else Fly_Timer -= diff; if(Turn_Timer < diff) { uint32 waypoint = (Fly_Timer/10000)%2; if(m_creature->GetDistance(VazrudenRing[waypoint][0],VazrudenRing[waypoint][1],VazrudenRing[waypoint][2]) > 5) m_creature->GetMotionMaster()->MovePoint(0,VazrudenRing[waypoint][0],VazrudenRing[waypoint][1],VazrudenRing[waypoint][2]); Turn_Timer = 10000; }else Turn_Timer -= diff; } else // phase 2 - land fight { if(ConeOfFire_Timer < diff) { DoCast(m_creature, SPELL_CONE_OF_FIRE); ConeOfFire_Timer = 12000; Fireball_Timer = 4000; }else ConeOfFire_Timer -= diff; if(HeroicMode && BellowingRoar_Timer < diff) { DoCast(m_creature, SPELL_BELLOWING_ROAR); BellowingRoar_Timer = 45000; }else BellowingRoar_Timer -= diff; DoMeleeAttackIfReady(); } }
void EnterCombat(Unit* /*who*/) { DoScriptText(SAY_AGGRO, me); if (instance) instance->SetData(DATA_CYANIGOSA_EVENT, IN_PROGRESS); }
void EnterCombat(Unit * /*who*/) { DoScriptText(SAY_AGGRO, me); }
void KilledUnit(Unit * victim) { if (victim == me) return; DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me); }
void UpdateAI(const uint32 uiDiff) { if(m_uiBirthState == 1) if(m_uiBirthTimer < uiDiff) { m_creature->SetVisibility(VISIBILITY_ON); m_creature->setFaction(21); m_uiBirthState = 2; } else m_uiBirthTimer -= uiDiff; if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if (m_uiBeserkTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_BESERK) == CAST_OK) { m_uiBeserkTimer = 300000; DoScriptText(EMOTE_ENRAGE, m_creature); } } else m_uiBeserkTimer -= uiDiff; if (m_uiPhase == 1) { if (m_uiLifeDrainTimer < uiDiff) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { if (DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_LIFE_DRAIN : H_SPELL_LIFE_DRAIN) == CAST_OK) m_uiLifeDrainTimer = 24000; } } else m_uiLifeDrainTimer -= uiDiff; if (m_uiBlizzardTimer < uiDiff) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { if (DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_BLIZZARD : H_SPELL_BLIZZARD) == CAST_OK) m_uiBlizzardTimer = urand(17,20)*IN_MILLISECONDS; } } else m_uiBlizzardTimer -= uiDiff; if (m_uiCleaveTimer < uiDiff) { if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) m_uiCleaveTimer = urand(7000, 10000); } else m_uiCleaveTimer -= uiDiff; if (m_uiTailSweepTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_TAIL_SWEEP : H_SPELL_TAIL_SWEEP) == CAST_OK) m_uiTailSweepTimer = urand(10000, 15000); } else m_uiTailSweepTimer -= uiDiff; if (m_creature->GetHealthPercent() > 10.0f) { if (m_uiFlyTimer < uiDiff) { m_uiPhase = 2; m_creature->InterruptNonMeleeSpells(false); m_creature->HandleEmote(EMOTE_ONESHOT_LIFTOFF); m_creature->GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MoveIdle(); DoCastSpellIfCan(m_creature,11010); m_creature->SetHover(true); DoCastSpellIfCan(m_creature,18430); m_uiIceboltTimer = 4000; m_uiIceboltCount = 0; m_bLandoff = false; DoScriptText(EMOTE_FLY, m_creature); } else m_uiFlyTimer -= uiDiff; } DoMeleeAttackIfReady(); } else // Phase 2 { if (m_uiIceboltCount < m_uiIceboltCountMax) { if (m_uiIceboltTimer < uiDiff) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { if(DoCastSpellIfCan(pTarget,SPELL_ICEBOLT) == CAST_OK) { targetGUIDs.push_back(pTarget->GetGUID()); ++m_uiIceboltCount; if (m_uiIceboltCount == m_uiIceboltCountMax) { DoScriptText(EMOTE_BREATH, m_creature); m_uiFrostBreathTimer = 8700; if(pFrostBreathTarget) { pFrostBreathTarget->NearTeleportTo(m_creature->GetPositionX(),m_creature->GetPositionY(),pFrostBreathTarget->GetPositionZ(),0); m_creature->CastSpell(pFrostBreathTarget,SPELL_FROST_BREATH_VISUAL,true); } } m_uiIceboltTimer = 4000; } } } else m_uiIceboltTimer -= uiDiff; } else { if (m_bLandoff) { if (m_uiLandTimer < uiDiff) { m_uiPhase = 1; m_creature->HandleEmote(EMOTE_ONESHOT_LAND); m_creature->SetHover(false); m_creature->GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); m_uiFlyTimer = 45000; DoScriptText(EMOTE_GROUND, m_creature); } else m_uiLandTimer -= uiDiff; } else { if (m_uiFrostBreathTimer < uiDiff) { if(!pFrostBreathTarget) return; Map *map = m_creature->GetMap(); if (!map->IsDungeon()) return; Map::PlayerList const &PlayerList = map->GetPlayers(); //check for each player for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) //check for both iceblocks for(std::vector<uint64>::iterator itr = targetGUIDs.begin(); itr!= targetGUIDs.end(); ++itr) //check if player near iceblock { if(Player* pPlayer = m_creature->GetMap()->GetPlayer(*itr)) if(i->getSource()->GetDistance2d(pPlayer) <= 6.0f) { //check if iceblock is closer to breathtarget then player if(pFrostBreathTarget->GetDistanceOrder(pPlayer,i->getSource(),false)) { i->getSource()->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); immunePlayerGUIDs.push_back(i->getSource()->GetGUID()); break; } } } if (DoCastSpellIfCan(m_creature, SPELL_FROST_BREATH) == CAST_OK) { //remove frost immunity for(std::vector<uint64>::iterator itr = immunePlayerGUIDs.begin(); itr!= immunePlayerGUIDs.end(); ++itr) { if(Player* pPlayer = m_creature->GetMap()->GetPlayer(*itr)) pPlayer->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, false); } m_uiLandTimer = 4000; m_bLandoff = true; immunePlayerGUIDs.clear(); targetGUIDs.clear(); } } else m_uiFrostBreathTimer -= uiDiff; } } } }
void UpdateAI(const uint32 diff) { if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) return; //Check for Frost Bolt if (FrostBolt_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FROST_BOLT); FrostBolt_Timer = (rand()%60)*1000; }else FrostBolt_Timer -= diff; //Check for Frost Bolt Nova if (FrostBoltNova_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FROST_BOLT_NOVA); FrostBoltNova_Timer = 15000; }else FrostBoltNova_Timer -= diff; //Check for Chains Of Kelthuzad if (ChainsOfKelthuzad_Timer < diff) { //DoCast(m_creature->getVictim(),SPELL_CHAINS_OF_KELTHUZAD); //if (rand()%2) //DoScriptText(SAY_CHAIN1, m_creature); //else //DoScriptText(SAY_CHAIN2, m_creature); ChainsOfKelthuzad_Timer = (rand()%30+30)*1000; }else ChainsOfKelthuzad_Timer -= diff; //Check for Mana Detonation if (ManaDetonation_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MANA_DETONATION); if (rand()%2) DoScriptText(SAY_SPECIAL1_MANA_DET, m_creature); ManaDetonation_Timer = 20000; }else ManaDetonation_Timer -= diff; //Check for Shadow Fissure if (ShadowFisure_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SHADOW_FISURE); if (rand()%2) DoScriptText(SAY_SPECIAL3_MANA_DET, m_creature); ShadowFisure_Timer = 25000; }else ShadowFisure_Timer -= diff; //Check for Frost Blast if (FrostBlast_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FROST_BLAST); if (rand()%2) DoScriptText(SAY_FROST_BLAST, m_creature); FrostBlast_Timer = (rand()%30+30)*1000; }else FrostBlast_Timer -= diff; //start phase 3 when we are 40% health if (!Phase3 && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 40) { Phase3 = true; DoScriptText(SAY_REQUEST_AID, m_creature); //here Lich King should respond to KelThuzad but I don't know which creature to make talk //so for now just make Kelthuzad says it. DoScriptText(SAY_ANSWER_REQUEST, m_creature); } if (Phase3 && (GuardiansOfIcecrown_Count < 5)) { if (GuardiansOfIcecrown_Timer < diff) { //Summon a Guardian of Icecrown in a random alcove (Creature # 16441) //uint32 TimeToWalk; Creature* pUnit = NULL; float Walk_Pos_X; float Walk_Pos_Y; float Walk_Pos_Z; switch(rand()%6) { case 0: pUnit = m_creature->SummonCreature(16441,ADDX_LEFT_FAR,ADDY_LEFT_FAR,ADDZ_LEFT_FAR,ADDO_LEFT_FAR,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,1000); //Setting walk position Walk_Pos_X = WALKX_LEFT_FAR; Walk_Pos_Y = WALKY_LEFT_FAR; Walk_Pos_Z = WALKZ_LEFT_FAR; break; case 1: pUnit = m_creature->SummonCreature(16441,ADDX_LEFT_MIDDLE,ADDY_LEFT_MIDDLE,ADDZ_LEFT_MIDDLE,ADDO_LEFT_MIDDLE,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,1000); //Start moving guardian towards the center of the room Walk_Pos_X = WALKX_LEFT_MIDDLE; Walk_Pos_Y = WALKY_LEFT_MIDDLE; Walk_Pos_Z = WALKZ_LEFT_MIDDLE; break; case 2: pUnit = m_creature->SummonCreature(16441,ADDX_LEFT_NEAR,ADDY_LEFT_NEAR,ADDZ_LEFT_NEAR,ADDO_LEFT_NEAR,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,1000); //Start moving guardian towards the center of the room Walk_Pos_X = WALKX_LEFT_NEAR; Walk_Pos_Y = WALKY_LEFT_NEAR; Walk_Pos_Z = WALKZ_LEFT_NEAR; break; case 3: pUnit = m_creature->SummonCreature(16441,ADDX_RIGHT_FAR,ADDY_RIGHT_FAR,ADDZ_RIGHT_FAR,ADDO_RIGHT_FAR,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,1000); //Start moving guardian towards the center of the room Walk_Pos_X = WALKX_RIGHT_FAR; Walk_Pos_Y = WALKY_RIGHT_FAR; Walk_Pos_Z = WALKZ_RIGHT_FAR; break; case 4: pUnit = m_creature->SummonCreature(16441,ADDX_RIGHT_MIDDLE,ADDY_RIGHT_MIDDLE,ADDZ_RIGHT_MIDDLE,ADDO_RIGHT_MIDDLE,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,1000); //Start moving guardian towards the center of the room Walk_Pos_X = WALKX_RIGHT_MIDDLE; Walk_Pos_Y = WALKY_RIGHT_MIDDLE; Walk_Pos_Z = WALKZ_RIGHT_MIDDLE; break; case 5: pUnit = m_creature->SummonCreature(16441,ADDX_RIGHT_NEAR,ADDY_RIGHT_NEAR,ADDZ_RIGHT_NEAR,ADDO_RIGHT_NEAR,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,1000); //Start moving guardian towards the center of the room Walk_Pos_X = WALKX_RIGHT_NEAR; Walk_Pos_Y = WALKY_RIGHT_NEAR; Walk_Pos_Z = WALKZ_RIGHT_NEAR; break; } if (pUnit) { //if we find no one to figth walk to the center if (!pUnit->isInCombat()) pUnit->SendMonsterMoveWithSpeed(Walk_Pos_X,Walk_Pos_Y,Walk_Pos_Z); //Safe storing of creatures GuardiansOfIcecrown[GuardiansOfIcecrown_Count] = pUnit->GetGUID(); //Update guardian count GuardiansOfIcecrown_Count++; } //5 seconds until summoning next guardian GuardiansOfIcecrown_Timer = 5000; }else GuardiansOfIcecrown_Timer -= diff; } DoMeleeAttackIfReady(); }
void KilledUnit(Unit* pVictim) { DoScriptText(urand(0, 1) ? SAY_SLAY1 : SAY_SLAY2, m_creature); }
void KilledUnit(Unit* Victim) { if(!(rand()%5)) DoScriptText(SAY_SLAY, me); }
void KilledUnit(Unit* /*victim*/) { DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me); }
void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, me); instance->SetBossState(BOSS_HEIGAN, DONE); }
void EnterCombat(Unit* /*who*/) { if (IsImage || Images75) return; DoScriptText(RAND(SAY_AGGRO1, SAY_AGGRO2, SAY_AGGRO3), me); }
void EventSharkkisDeath() { DoScriptText(SAY_GAIN_ABILITY1, me); DoCast(me, SPELL_POWER_OF_SHARKKIS); }
void UpdateAI(const uint32 uiDiff) { if (m_pInstance && !Unit::GetCreature((*me), m_pInstance->GetData64(NPC_ACIDMAW))) this->JustReachedHome(); if (!UpdateVictim()) return; switch (stage) { case 0: { bsw->timedCast(SPELL_BURNING_BITE, uiDiff); bsw->timedCast(SPELL_MOLTEN_SPEW, uiDiff); bsw->timedCast(SPELL_FIRE_SPIT, uiDiff); bsw->timedCast(SPELL_BURNING_SPRAY, uiDiff); bsw->timedCast(SPELL_SWEEP_0, uiDiff); if (m_pInstance->GetData(TYPE_NORTHREND_BEASTS) == DREADSCALE_SUBMERGED) stage = 1; break;} case 1: { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); bsw->doCast(SPELL_SUBMERGE_0); stage = 2; DoScriptText(-1713557,me); m_pInstance->SetData(TYPE_NORTHREND_BEASTS, DREADSCALE_SUBMERGED); break;} case 2: { if (bsw->timedQuery(SPELL_SLIME_POOL, uiDiff)) bsw->doCast(NPC_SLIME_POOL); if (bsw->timedQuery(SPELL_SUBMERGE_0, uiDiff) && m_pInstance->GetData(TYPE_NORTHREND_BEASTS) == DREADSCALE_SUBMERGED) stage = 3; break;} case 3: { DoScriptText(-1713559,me); bsw->doRemove(SPELL_SUBMERGE_0); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); bsw->resetTimer(SPELL_SLIME_POOL); stage = 0; m_pInstance->SetData(TYPE_NORTHREND_BEASTS, ACIDMAW_SUBMERGED); break;} } if (m_pInstance->GetData(TYPE_NORTHREND_BEASTS) == SNAKES_SPECIAL && !enraged) { DoScriptText(-1713559,me); bsw->doRemove(SPELL_SUBMERGE_0); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); bsw->doCast(SPELL_ENRAGE); enraged = true; stage = 0; DoScriptText(-1713504,me); }; DoMeleeAttackIfReady(); }
void EventTidalvessDeath() { DoScriptText(SAY_GAIN_ABILITY2, me); DoCast(me, SPELL_POWER_OF_TIDALVESS); }
void EnterCombat(Unit* pWho) { DoScriptText(SAY_AGGRO_KING, me); m_uiPhase = 1; }
void EventCaribdisDeath() { DoScriptText(SAY_GAIN_ABILITY3, me); DoCast(me, SPELL_POWER_OF_CARIBDIS); }
void UpdateAI(const uint32 uiDiff) { if (m_uiTirionSpawnTimer < uiDiff && !m_bIsTirionSpawned) { me->SummonCreature(CREATURE_TIRION_ICC, 528.552002, -2124.620117, 1040.859985, 3.183670, TEMPSUMMON_CORPSE_DESPAWN, 5000); m_bIsTirionSpawned = true; } else m_uiTirionSpawnTimer -= uiDiff; if(!UpdateVictim()) return; if(!m_bIsDeathPhase) { if (m_uiRandomSpeechTimer < uiDiff) { DoScriptText(RAND(SAY_RANDOM_1,SAY_RANDOM_2), me); m_uiRandomSpeechTimer = 33000; } else m_uiRandomSpeechTimer -= uiDiff; } if (m_uiBerserkTimer < uiDiff && !m_bIsBerserk) { DoScriptText(SAY_BERSERK, me); DoCast(me, SPELL_BERSERK); m_bIsBerserk = true; } else m_uiBerserkTimer -= uiDiff; if(m_uiPhase == 1) { if (m_uiInfestTimer < uiDiff) { DoCast(me, SPELL_INFEST); m_uiInfestTimer = 30000; } else m_uiInfestTimer -= uiDiff; if (m_uiPlagueSiphonTimer < uiDiff) { DoCast(me, SPELL_PLAGUE_SIPHON); m_uiPlagueSiphonTimer = 30000; } else m_uiPlagueSiphonTimer -= uiDiff; if (m_uiSummonDrudgeGhoulsTimer < uiDiff) { DoCast(me, SPELL_SUMMON_DRUDGE_GHOULS); m_uiSummonDrudgeGhoulsTimer = 20000; } else m_uiSummonDrudgeGhoulsTimer -= uiDiff; if (m_uiSummonShamblingHorrorTimer < uiDiff) { DoCast(me, SPELL_SUMMON_SHAMBLING_HORROR); m_uiSummonShamblingHorrorTimer = 60000; } else m_uiSummonShamblingHorrorTimer -= uiDiff; if (m_uiNecroticPlagueTimer < uiDiff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); DoCast(pTarget, SPELL_NECROTIC_PLAGUE); m_uiNecroticPlagueTimer = 5000; } else m_uiNecroticPlagueTimer -= uiDiff; } if(m_uiPhase == 2) { if (m_uiRemorselesWinterTimer < uiDiff) { DoScriptText(SAY_REMORSELESS_WINTER, me); DoCast(me, SPELL_REMORSELES_WINTER); m_uiRemorselesWinterTimer = 90000; } else m_uiRemorselesWinterTimer -= uiDiff; if (m_uiSummonSpiritTimer < uiDiff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); DoCast(pTarget, SPELL_SUMMON_RAGING_SPIRIT); m_uiSummonSpiritTimer = 16000; } else m_uiSummonSpiritTimer -= uiDiff; if (m_uiIcePulsSummonTimer < uiDiff) { DoCast(me, SPELL_SUMMON_ICE_SPEHERE); m_uiIcePulsSummonTimer = 15000; } else m_uiIcePulsSummonTimer -= uiDiff; if (m_uiPainandSufferingTimer < uiDiff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); DoCast(pTarget, SPELL_PAIN_AND_SUFFERING); m_uiPainandSufferingTimer = 2000; } else m_uiPainandSufferingTimer -= uiDiff; if (m_uiQuakeTimer < uiDiff) { DoScriptText(SAY_BROKEN_ARENA, me); DoCast(me, SPELL_QUAKE); me->SetReactState(REACT_AGGRESSIVE); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveChase(me->getVictim()); m_uiPhase = 3; } else m_uiQuakeTimer -= uiDiff; } if(m_uiPhase == 3) { if (m_uiDefileTimer < uiDiff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); DoCast(pTarget, SPELL_SPAWN_DEFILE); m_uiDefileTimer = 20000; } else m_uiDefileTimer -= uiDiff; if (m_uiSummonValkyrTimer < uiDiff) { DoScriptText(SAY_SUMMON_VALKYR, me); me->SummonCreature(CREATURE_VALKYR, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 99999999); //DoCast(me, SPELL_SUMMON_VALKYR); m_uiSummonValkyrTimer = 20000; } else m_uiSummonValkyrTimer -= uiDiff; if (m_uiSoulReaperTimer < uiDiff) { DoCast(me->getVictim(), SPELL_SOUL_REAPER); m_uiSoulReaperTimer = 20000; } else m_uiSoulReaperTimer -= uiDiff; if (m_uiInfestTimer < uiDiff) { DoCast(me, SPELL_INFEST); m_uiInfestTimer = 30000; } else m_uiInfestTimer -= uiDiff; } if(m_uiPhase == 4) { if (m_uiRemorselesWinterTimer < uiDiff) { DoScriptText(SAY_REMORSELESS_WINTER, me); DoCast(me, SPELL_REMORSELES_WINTER); m_uiRemorselesWinterTimer = 90000; } else m_uiRemorselesWinterTimer -= uiDiff; if (m_uiSummonSpiritTimer < uiDiff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); DoCast(pTarget, SPELL_SUMMON_RAGING_SPIRIT); m_uiSummonSpiritTimer = 16000; } else m_uiSummonSpiritTimer -= uiDiff; if (m_uiIcePulsSummonTimer < uiDiff) { DoCast(me, SPELL_SUMMON_ICE_SPEHERE); m_uiIcePulsSummonTimer = 15000; } else m_uiIcePulsSummonTimer -= uiDiff; if (m_uiPainandSufferingTimer < uiDiff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); DoCast(pTarget, SPELL_PAIN_AND_SUFFERING); m_uiPainandSufferingTimer = 3000; } else m_uiPainandSufferingTimer -= uiDiff; if (m_uiQuakeTimer < uiDiff) { DoScriptText(SAY_BROKEN_ARENA, me); DoCast(me, SPELL_QUAKE); me->SetReactState(REACT_AGGRESSIVE); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveChase(me->getVictim()); m_uiPhase = 5; } else m_uiQuakeTimer -= uiDiff; } if(m_uiPhase == 5) { if (m_uiSummonVileSpiritTimer < uiDiff) { DoCast(me, SPELL_SUMMON_VILE_SPIRIT); m_uiSummonVileSpiritTimer = 30000; } else m_uiSummonVileSpiritTimer -= uiDiff; if (m_uiHarvestSoulTimer < uiDiff) { DoScriptText(SAY_HARVEST_SOUL, me); Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); DoCast(pTarget, SPELL_HARVEST_SOULS); m_uiHarvestSoulTimer = 70000; } else m_uiHarvestSoulTimer -= uiDiff; } DoMeleeAttackIfReady(); if (m_uiEndingTimer <= uiDiff) EndingPhase(); else m_uiEndingTimer -= uiDiff; if (HealthBelowPct(70) && !m_bIsSwitchPhase1) { m_uiPhase = 2; Phasenswitch(); m_bIsSwitchPhase1 = true; } else if (HealthBelowPct(40) && !m_bIsSwitchPhase2) { m_uiPhase = 4; m_uiRemorselesWinterTimer = 5000; m_uiQuakeTimer = 70000; m_uiIcePulsSummonTimer = 10000; m_uiPainandSufferingTimer = 10000; m_uiSummonSpiritTimer = 18000; Phasenswitch(); m_bIsSwitchPhase2 = true; } else if (HealthBelowPct(11) && !m_bIsTriggerSpawned) { pSafeZone = me->SummonCreature(CREATURE_TRIGGER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN, 360000); pSafeZone->AI()->AttackStart(me); pSafeZone->SetDisplayId(MODEL_INVISIBLE); m_bIsTriggerSpawned = true; } else if (HealthBelowPct(10) && !m_bIsDeathPhase) { m_uiPhase = 6; m_bIsDeathPhase = true; SetEnding(); } }
void KilledUnit(Unit* victim) { if (victim->GetTypeId() == TYPEID_PLAYER) DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me); }
void Intro() { if( m_uiIntroTimer ) { switch( m_uiIntroPhase ) { case 1: if(m_pInstance) m_pInstance->SetData(DATA_LICH_KING_EVENT, IN_PROGRESS); pLichKing->SetStandState(UNIT_STAND_STATE_STAND); pLichKing->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); pLichKing->SetSpeed(MOVE_WALK, 1.2f); pLichKing->GetMotionMaster()->MovePoint(0, MovePosition); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 375); KingIntro(3000); break; case 2: pLichKing->SetUInt32Value(UNIT_NPC_EMOTESTATE, 1); DoScriptText(SAY_INTRO_1_KING, pLichKing); KingIntro(14000); break; case 3: pLichKing->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); DoScriptText(SAY_INTRO_2_TIRION, me); KingIntro(9000); break; case 4: DoScriptText(SAY_INTRO_3_KING, pLichKing); pLichKing->SetUInt32Value(UNIT_NPC_EMOTESTATE, 392); KingIntro(3000); break; case 5: pLichKing->SetUInt32Value(UNIT_NPC_EMOTESTATE, 397); KingIntro(2000); break; case 6: pLichKing->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); KingIntro(21000); break; case 7: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 397); DoScriptText(SAY_INTRO_4_TIRION, me); KingIntro(1000); break; case 8: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); me->GetMotionMaster()->MovePoint(0, MoveTirionAttack); KingIntro(4000); break; case 9: me->CastSpell(pLichKing, SPELL_ICEBLOCK_TRIGGER, false); KingIntro(2000); break; case 10: pLichKing->SetUInt32Value(UNIT_NPC_EMOTESTATE, 1); DoScriptText(SAY_INTRO_5_KING, pLichKing); KingIntro(12000); break; case 11: pLichKing->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); pLichKing->SetReactState(REACT_AGGRESSIVE); KingIntro(6000); break; } } }
void EnterCombat(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (!m_pInstance || m_pInstance->GetData(DATA_VALITHRIA_DREAMWALKER_EVENT) != IN_PROGRESS) summons.DespawnAll(); if (Phase == 1) { DoStartNoMovement(me->getVictim()); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); m_uiEndTimer = 999999999; if (m_uiSummonTimer <= diff) { if (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL || getDifficulty() == RAID_DIFFICULTY_10MAN_HEROIC) { DoSummon(CREATURE_ZOMBIE, Pos[RAND(0,4)]); DoSummon(CREATURE_SKELETON, Pos[RAND(0,4)]); DoSummon(CREATURE_ARCHMAGE, Pos[RAND(0,4)]); DoSummon(CREATURE_SUPPRESSER, Pos[RAND(0,4)]); DoSummon(CREATURE_ABOMINATION, Pos[RAND(0,4)]); } if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL || getDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC) { DoSummon(CREATURE_ZOMBIE, Pos[RAND(0,1,2,3)]); DoSummon(CREATURE_SKELETON, Pos[RAND(0,1,2,3)]); DoSummon(CREATURE_ARCHMAGE, Pos[RAND(0,1,2,3)]); DoSummon(CREATURE_SUPPRESSER, Pos[RAND(0,1,2,3)]); DoSummon(CREATURE_ABOMINATION, Pos[RAND(0,1,2,3)]); } m_uiSummonTimer = 28000; } else m_uiSummonTimer -= diff; if (m_uiPortalTimer <= diff) { DoScriptText(SAY_OPEN_PORTAL, me); me->SummonCreature(CREATURE_PORTAL, me->GetPositionX()+15, me->GetPositionY()+15, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 15000); me->SummonCreature(CREATURE_PORTAL, me->GetPositionX()+10, me->GetPositionY()+25, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 15000); me->SummonCreature(CREATURE_PORTAL, me->GetPositionX()+15, me->GetPositionY()-25, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 15000); m_uiPortalTimer = 30000; } else m_uiPortalTimer -= diff; if (!ABOVEHP && (me->GetHealth()*100 / me->GetMaxHealth()) > 75) { DoScriptText(SAY_ABOVE_75, me); ABOVEHP = true; } if (!BELOWHP && (me->GetHealth()*100 / me->GetMaxHealth()) < 25) { DoScriptText(SAY_BELOW_25, me); BELOWHP = true; } if ((me->GetHealth()*100 / me->GetMaxHealth()) > 99) { Phase = 2; me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); me->SetReactState(REACT_PASSIVE); me->RemoveAurasDueToSpell(SPELL_CORRUPTION); end = true; } } if (Phase == 2) { Phase = 3; m_uiEndTimer = 1000; m_uiEnd2Timer = 6000; DoScriptText(SAY_END, me); } if (Phase == 3) { if (m_uiEndTimer <= diff) { Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0); if(pTarget && !pTarget->IsFriendlyTo(me)) { DoScriptText(SAY_BERSERK , me); DoCast(pTarget, SPELL_RAGE); } me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_uiEndTimer = 50000; } else m_uiEndTimer -= diff; if (m_uiEnd2Timer <= diff) { combat_trigger->ForcedDespawn(); me->CastSpell(me, SPELL_DREAM_SLIP, true, 0, 0, 0); m_uiEnd2Timer = 50000; } else m_uiEnd2Timer -= diff; } if (me->HasAura(SPELL_DREAM_SLIP)) { me->ForcedDespawn(); if (m_pInstance) m_pInstance->SetData(DATA_VALITHRIA_DREAMWALKER_EVENT, DONE); } }
void UpdateAI(const uint32 diff) { if (ResetTimer) { if (ResetTimer <= diff) { ResetTimer = 0; Unit *pMidnight = Unit::GetUnit(*m_creature, Midnight); if (pMidnight) { pMidnight->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pMidnight->SetVisibility(VISIBILITY_ON); } Midnight = 0; m_creature->SetVisibility(VISIBILITY_OFF); m_creature->Kill(m_creature); } } else ResetTimer -= diff; //Return since we have no target if (!UpdateVictim()) return; if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE)) return; if (CleaveTimer <= diff) { DoCast(m_creature->getVictim(), SPELL_SHADOWCLEAVE); CleaveTimer = urand(10000,15000); } else CleaveTimer -= diff; if (CurseTimer <= diff) { DoCast(m_creature->getVictim(), SPELL_INTANGIBLE_PRESENCE); CurseTimer = 30000; } else CurseTimer -= diff; if (RandomYellTimer <= diff) { DoScriptText(RAND(SAY_RANDOM1,SAY_RANDOM2), m_creature); RandomYellTimer = urand(30000,60000); } else RandomYellTimer -= diff; if (m_creature->GetUInt32Value(UNIT_FIELD_DISPLAYID) == MOUNTED_DISPLAYID) { if (ChargeTimer <= diff) { Unit *pTarget; std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList(); std::vector<Unit *> target_list; for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (pTarget && !pTarget->IsWithinDist(m_creature, ATTACK_DISTANCE, false)) target_list.push_back(pTarget); pTarget = NULL; } if (target_list.size()) pTarget = *(target_list.begin()+rand()%target_list.size()); DoCast(pTarget, SPELL_BERSERKER_CHARGE); ChargeTimer = 20000; } else ChargeTimer -= diff; } else { if ((m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 25) { Creature *pMidnight = Unit::GetCreature(*m_creature, Midnight); if (pMidnight && pMidnight->GetTypeId() == TYPEID_UNIT) { CAST_AI(boss_midnightAI, (pMidnight->AI()))->Mount(m_creature); m_creature->SetHealth(pMidnight->GetHealth()); DoResetThreat(); } } } DoMeleeAttackIfReady(); }