void Reset() { m_bIsPause = false; m_bIsActiveWithBJORN = false; m_bIsActiveWithHALDOR = false; m_bIsActiveWithRANULF = false; m_bIsActiveWithTORGYN = false; kingsBane = true; m_uiFetidRot_Timer = urand(8000, 13000); m_uiBane_Timer = urand(18000, 23000); m_uiDarkSlash_Timer = urand(28000, 33000); m_uiAncestors_Vengeance_Timer = DUNGEON_MODE(60000, 45000); m_uiPause_Timer = 0; m_uiAbility_BJORN_Timer = 0; m_uiAbility_HALDOR_Timer = 0; m_uiAbility_RANULF_Timer = 0; m_uiAbility_TORGYN_Timer = 0; m_uiActivedNumber = 0; m_uiHealthAmountModifier = 1; m_uiHealthAmountMultipler = DUNGEON_MODE(20, 25); DespawnBoatGhosts(m_uiActivedCreatureGUID); DespawnBoatGhosts(m_uiOrbGUID); if (instance) instance->SetData(DATA_KING_YMIRON_EVENT, NOT_STARTED); }
void Reset() { m_bIsPause = false; m_bIsWalking = false; m_bAchievement = true; m_bIsActiveWithBJORN = false; m_bIsActiveWithHALDOR = false; m_bIsActiveWithRANULF = false; m_bIsActiveWithTORGYN = false; m_uiFetidRot_Timer = urand(5*IN_MILLISECONDS,8*IN_MILLISECONDS); m_uiBane_Timer = urand(20*IN_MILLISECONDS,22*IN_MILLISECONDS); m_uiDarkSlash_Timer = urand(10*IN_MILLISECONDS,15*IN_MILLISECONDS); m_uiPause_Timer = 0; m_uiCheckSkadiTimer = 10*IN_MILLISECONDS; m_uiAbility_BJORN_Timer = 0; m_uiAbility_HALDOR_Timer = 0; m_uiAbility_RANULF_Timer = 0; m_uiAbility_TORGYN_Timer = 0; m_uiActivedNumber = 0; m_uiHealthAmountModifier = 1; m_uiHealthAmountMultipler = DUNGEON_MODE(33,20); DespawnBoatGhosts(m_uiActivedCreatureGUID); DespawnBoatGhosts(m_uiOrbGUID); summons.DespawnAll(); if (pInstance) pInstance->SetData(DATA_KING_YMIRON_EVENT, NOT_STARTED); }
void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); DespawnBoatGhosts(m_uiActivedCreatureGUID); DespawnBoatGhosts(m_uiOrbGUID); if (instance) instance->SetData(DATA_KING_YMIRON_EVENT, DONE); }
void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, me); DespawnBoatGhosts(m_uiActivedCreatureGUID); DespawnBoatGhosts(m_uiOrbGUID); summons.DespawnAll(); if (pInstance) { if (IsHeroic() && m_bAchievement) pInstance->DoCompleteAchievement(ACHIEV_KINGS_BANE); pInstance->SetData(DATA_KING_YMIRON_EVENT, DONE); } }
void DamageTaken(Unit* /*attacker*/, uint32& damage) override { if (me->HealthBelowPctDamaged(100 - HealthAmountMultipler * HealthAmountModifier, damage) && !(damage >= me->GetHealth())) { uint8 Order = HealthAmountModifier - 1; ++HealthAmountModifier; me->InterruptNonMeleeSpells(true); DoCast(me, SPELL_SCREAMS_OF_THE_DEAD); me->AttackStop(); me->SetReactState(REACT_PASSIVE); me->GetMotionMaster()->MovePoint(POINT_BOAT, ActiveBoat[ActiveOrder[Order]].MoveX, ActiveBoat[ActiveOrder[Order]].MoveY, ActiveBoat[ActiveOrder[Order]].MoveZ); DespawnBoatGhosts(ActiveAncestorGUID); DespawnBoatGhosts(SpiritFountGUID); events.CancelEvent(ActiveBoat[ActiveOrder[ActivedNumber]].event); // Cancels the event started on the previous transition. events.DelayEvents(10000, EVENT_GROUP_BASE_SPELLS); ActivedNumber = Order; } }
void UpdateAI(const uint32 diff) { if (m_bIsWalking) { if (m_uiPause_Timer <= diff) { DoScriptText(ActiveBoat[m_uiActiveOrder[m_uiActivedNumber]].say, me); DoCast(me, SPELL_CHANNEL_YMIRON_TO_SPIRIT); // should be on spirit if (Creature* temp = me->SummonCreature(ActiveBoat[m_uiActiveOrder[m_uiActivedNumber]].npc, ActiveBoat[m_uiActiveOrder[m_uiActivedNumber]].SpawnX, ActiveBoat[m_uiActiveOrder[m_uiActivedNumber]].SpawnY, ActiveBoat[m_uiActiveOrder[m_uiActivedNumber]].SpawnZ, ActiveBoat[m_uiActiveOrder[m_uiActivedNumber]].SpawnO, TEMPSUMMON_CORPSE_DESPAWN, 0)) { m_uiActivedCreatureGUID = temp->GetGUID(); temp->CastSpell(me, SPELL_CHANNEL_SPIRIT_TO_YMIRON, true); temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); temp->AddUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY); switch (m_uiActiveOrder[m_uiActivedNumber]) { case 0: m_bIsActiveWithBJORN = true; break; case 1: m_bIsActiveWithHALDOR = true; break; case 2: m_bIsActiveWithRANULF = true; break; case 3: m_bIsActiveWithTORGYN = true; break; } } m_bIsPause = true; m_bIsWalking = false; m_uiPause_Timer = 3000; } else m_uiPause_Timer -= diff; return; } else if (m_bIsPause) { if (m_uiPause_Timer <= diff) { m_uiAbility_BJORN_Timer = 5000; m_uiAbility_HALDOR_Timer = 5000; m_uiAbility_RANULF_Timer = 5000; m_uiAbility_TORGYN_Timer = 5000; m_bIsPause = false; m_uiPause_Timer = 0; } else m_uiPause_Timer -= diff; return; } //Return since we have no target if (!UpdateVictim()) return; if (!m_bIsPause) { // Normal spells ------------------------------------------------------------------------ if (m_uiBane_Timer <= diff) { DoCast(me, SPELL_BANE); m_uiBane_Timer = urand(20000, 25000); } else m_uiBane_Timer -= diff; if (m_uiFetidRot_Timer <= diff) { DoCast(me->getVictim(), SPELL_FETID_ROT); m_uiFetidRot_Timer = urand(10000, 15000); } else m_uiFetidRot_Timer -= diff; if (m_uiDarkSlash_Timer <= diff) { DoCast(me->getVictim(), SPELL_DARK_SLASH); m_uiDarkSlash_Timer = urand(30000, 35000); } else m_uiDarkSlash_Timer -= diff; if (m_uiAncestors_Vengeance_Timer <= diff) { DoCast(me, SPELL_ANCESTORS_VENGEANCE); m_uiAncestors_Vengeance_Timer = DUNGEON_MODE(urand(60000, 65000), urand(45000, 50000)); } else m_uiAncestors_Vengeance_Timer -= diff; // Abilities ------------------------------------------------------------------------------ if (m_bIsActiveWithBJORN && m_uiAbility_BJORN_Timer <= diff) { //DoCast(me, SPELL_SUMMON_SPIRIT_FOUNT); // works fine, but using summon has better control if (Creature* temp = me->SummonCreature(CREATURE_SPIRIT_FOUNT, 385.0f + rand() % 10, -330.0f + rand() % 10, 104.756f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 180000)) { temp->SetSpeed(MOVE_RUN, 0.4f); temp->CastSpell(temp, DUNGEON_MODE(SPELL_SPIRIT_FOUNT, H_SPELL_SPIRIT_FOUNT), true); temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); temp->SetDisplayId(11686); m_uiOrbGUID = temp->GetGUID(); } m_bIsActiveWithBJORN = false; // only one orb } else m_uiAbility_BJORN_Timer -= diff; if (m_bIsActiveWithHALDOR && m_uiAbility_HALDOR_Timer <= diff) { DoCast(me->getVictim(), SPELL_SPIRIT_STRIKE); m_uiAbility_HALDOR_Timer = 5000; // overtime } else m_uiAbility_HALDOR_Timer -= diff; if (m_bIsActiveWithRANULF && m_uiAbility_RANULF_Timer <= diff) { DoCast(me, SPELL_SPIRIT_BURST); m_uiAbility_RANULF_Timer = 10000; // overtime } else m_uiAbility_RANULF_Timer -= diff; if (m_bIsActiveWithTORGYN && m_uiAbility_TORGYN_Timer <= diff) { float x, y, z; x = me->GetPositionX()-5; y = me->GetPositionY()-5; z = me->GetPositionZ(); for (uint8 i = 0; i < 4; ++i) { //DoCast(me, SPELL_SUMMON_AVENGING_SPIRIT); // works fine, but using summon has better control if (Creature* temp = me->SummonCreature(CREATURE_AVENGING_SPIRIT, x + rand() % 10, y + rand() % 10, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { temp->AddThreat(target, 0.0f); temp->AI()->AttackStart(target); } } } m_uiAbility_TORGYN_Timer = 15000; // overtime } else m_uiAbility_TORGYN_Timer -= diff; // Health check ----------------------------------------------------------------------------- if (me->HealthBelowPct(100 - m_uiHealthAmountMultipler * m_uiHealthAmountModifier)) { uint8 m_uiOrder = m_uiHealthAmountModifier - 1; ++m_uiHealthAmountModifier; me->InterruptNonMeleeSpells(true); DoCast(me, SPELL_SCREAMS_OF_THE_DEAD); me->GetMotionMaster()->Clear(); me->StopMoving(); me->AttackStop(); me->GetMotionMaster()->MovePoint(0, ActiveBoat[m_uiActiveOrder[m_uiOrder]].MoveX, ActiveBoat[m_uiActiveOrder[m_uiOrder]].MoveY, ActiveBoat[m_uiActiveOrder[m_uiOrder]].MoveZ); DespawnBoatGhosts(m_uiActivedCreatureGUID); DespawnBoatGhosts(m_uiOrbGUID); m_bIsActiveWithBJORN = false; m_bIsActiveWithHALDOR = false; m_bIsActiveWithRANULF = false; m_bIsActiveWithTORGYN = false; m_uiBane_Timer += 8000; m_uiFetidRot_Timer += 8000; m_uiDarkSlash_Timer += 8000; m_uiAncestors_Vengeance_Timer += 8000; m_uiActivedNumber = m_uiOrder; m_bIsWalking = true; m_uiPause_Timer = 2000; return; } DoMeleeAttackIfReady(); } }
void UpdateAI(const uint32 diff) { if (m_uiCheckSkadiTimer <= diff) { if (pInstance) { // try to prevent a possible exploit if ((pInstance->GetData(DATA_SKADI_THE_RUTHLESS_EVENT) < DONE) && (!me->IsVisible() || (me->getFaction() != 35))) { me->SetVisible(false); me->setFaction(35); } else if ((pInstance->GetData(DATA_SKADI_THE_RUTHLESS_EVENT) >= DONE) && (me->IsVisible() || (me->getFaction() == 35))) { me->RestoreFaction(); me->SetVisible(true); } } m_uiCheckSkadiTimer = 10*IN_MILLISECONDS; } else m_uiCheckSkadiTimer -= diff; if (m_bIsWalking) { if (m_uiPause_Timer <= diff) { DoScriptText(ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].say, me); DoCast(me, SPELL_CHANNEL_YMIRON_TO_SPIRIT); // should be on spirit if (Creature* pTemp = me->SummonCreature(ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].npc, ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].SpawnX, ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].SpawnY, ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].SpawnZ, ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].SpawnO, TEMPSUMMON_CORPSE_DESPAWN, 0)) { m_uiActivedCreatureGUID = pTemp->GetGUID(); pTemp->CastSpell(me, SPELL_CHANNEL_SPIRIT_TO_YMIRON, true); pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pTemp->SetLevitate(true); switch (m_uiActiveOrder[m_uiActivedNumber]) { case 0: m_bIsActiveWithBJORN = true; break; case 1: m_bIsActiveWithHALDOR = true; break; case 2: m_bIsActiveWithRANULF = true; break; case 3: m_bIsActiveWithTORGYN = true; break; } } m_bIsPause = true; m_bIsWalking = false; m_uiPause_Timer = 3*IN_MILLISECONDS; } else m_uiPause_Timer -= diff; return; } else if (m_bIsPause) { if (m_uiPause_Timer <= diff) { m_uiAbility_BJORN_Timer = 5*IN_MILLISECONDS; m_uiAbility_HALDOR_Timer = 5*IN_MILLISECONDS; m_uiAbility_RANULF_Timer = 5*IN_MILLISECONDS; m_uiAbility_TORGYN_Timer = 5*IN_MILLISECONDS; m_bIsPause = false; m_uiPause_Timer = 0; } else m_uiPause_Timer -= diff; return; } //Return since we have no target if (!UpdateVictim()) return; if (!m_bIsPause) { // Normal spells ------------------------------------------------------------------------ if (m_uiBane_Timer <= diff) { if(!me->IsNonMeleeSpellCasted(false)) { DoCast(me, DUNGEON_MODE(SPELL_BANE, H_SPELL_BANE)); m_uiBane_Timer = urand(20*IN_MILLISECONDS,22*IN_MILLISECONDS); } } else m_uiBane_Timer -= diff; if (m_uiFetidRot_Timer <= diff) { if(!me->IsNonMeleeSpellCasted(false)) { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true)) DoCast(pTarget, DUNGEON_MODE(SPELL_FETID_ROT, H_SPELL_FETID_ROT)); m_uiFetidRot_Timer = urand(10*IN_MILLISECONDS,15*IN_MILLISECONDS); } } else m_uiFetidRot_Timer -= diff; if (m_uiDarkSlash_Timer <= diff) { if(!me->IsNonMeleeSpellCasted(false)) { int dmg = int(me->getVictim()->GetHealth()*0.5); me->CastCustomSpell(me->getVictim(), SPELL_DARK_SLASH, &dmg, 0, 0, false); m_uiDarkSlash_Timer = urand(15*IN_MILLISECONDS,18*IN_MILLISECONDS); } } else m_uiDarkSlash_Timer -= diff; // Abilities ------------------------------------------------------------------------------ if (m_bIsActiveWithBJORN && m_uiAbility_BJORN_Timer <= diff) { //DoCast(me, SPELL_SUMMON_SPIRIT_FOUNT); // works fine, but using summon has better control if (Creature* pTemp = me->SummonCreature(CREATURE_SPIRIT_FOUNT, float(385+rand()%10), float(-330+rand()%10), 104.756f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 180*IN_MILLISECONDS)) { pTemp->SetSpeed(MOVE_RUN, 0.4f); pTemp->CastSpell(pTemp, DUNGEON_MODE(SPELL_SPIRIT_FOUNT, H_SPELL_SPIRIT_FOUNT), true); pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pTemp->SetDisplayId(11686); pTemp->GetMotionMaster()->MoveChase(me->getVictim()); m_uiOrbGUID = pTemp->GetGUID(); } m_bIsActiveWithBJORN = false; // only one orb } else m_uiAbility_BJORN_Timer -= diff; if (m_bIsActiveWithHALDOR && m_uiAbility_HALDOR_Timer <= diff) { if(!me->IsNonMeleeSpellCasted(false)) { DoCast(me->getVictim(), DUNGEON_MODE(SPELL_SPIRIT_STRIKE, H_SPELL_SPIRIT_STRIKE)); m_uiAbility_HALDOR_Timer = 5*IN_MILLISECONDS; // overtime } } else m_uiAbility_HALDOR_Timer -= diff; if (m_bIsActiveWithRANULF && m_uiAbility_RANULF_Timer <= diff) { if(!me->IsNonMeleeSpellCasted(false)) { DoCast(me, DUNGEON_MODE(SPELL_SPIRIT_BURST, H_SPELL_SPIRIT_BURST)); m_uiAbility_RANULF_Timer = 10*IN_MILLISECONDS; // overtime } } else m_uiAbility_RANULF_Timer -= diff; if (m_bIsActiveWithTORGYN && m_uiAbility_TORGYN_Timer <= diff) { float x, y, z; x = me->GetPositionX()-5; y = me->GetPositionY()-5; z = me->GetPositionZ(); for (uint8 i = 0; i < 4; ++i) { //DoCast(me, SPELL_SUMMON_AVENGING_SPIRIT); // works fine, but using summon has better control if (Creature* pTemp = me->SummonCreature(CREATURE_AVENGING_SPIRIT, x+rand()%10, y+rand()%10, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30*IN_MILLISECONDS)) { pTemp->CastSpell(pTemp, SPELL_WITHER, true); if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { pTemp->AddThreat(target, 0.0f); pTemp->AI()->AttackStart(target); } } } m_uiAbility_TORGYN_Timer = 15*IN_MILLISECONDS; // overtime } else m_uiAbility_TORGYN_Timer -= diff; DoMeleeAttackIfReady(); // Health check ----------------------------------------------------------------------------- if (me->HealthBelowPct(100 - m_uiHealthAmountMultipler * m_uiHealthAmountModifier)) { uint8 m_uiOrder = m_uiHealthAmountModifier - 1; ++m_uiHealthAmountModifier; me->InterruptNonMeleeSpells(true); DoCast(me, SPELL_SCREAMS_OF_THE_DEAD); me->GetMotionMaster()->Clear(); me->StopMoving(); me->AttackStop(); me->GetMotionMaster()->MovePoint(0, ActiveBot[m_uiActiveOrder[m_uiOrder]].MoveX, ActiveBot[m_uiActiveOrder[m_uiOrder]].MoveY, ActiveBot[m_uiActiveOrder[m_uiOrder]].MoveZ); DespawnBoatGhosts(m_uiActivedCreatureGUID); DespawnBoatGhosts(m_uiOrbGUID); m_bIsActiveWithBJORN = false; m_bIsActiveWithHALDOR = false; m_bIsActiveWithRANULF = false; m_bIsActiveWithTORGYN = false; m_uiBane_Timer = urand(20*IN_MILLISECONDS,22*IN_MILLISECONDS); m_uiFetidRot_Timer += 3*IN_MILLISECONDS; m_uiDarkSlash_Timer += 3*IN_MILLISECONDS; m_uiActivedNumber = m_uiOrder; m_bIsWalking = true; m_uiPause_Timer = 3*IN_MILLISECONDS; return; } } }