diff --git a/src/game/AI/PetAI.cpp b/src/game/AI/PetAI.cpp index b1a1ee955..535e65083 100644 --- a/src/game/AI/PetAI.cpp +++ b/src/game/AI/PetAI.cpp @@ -563,19 +563,6 @@ void PetAI::DoAttack(Unit* target, bool chase) m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); } - - // Flag owner for PvP if owner is player and target is flagged - Unit* owner = m_creature->GetCharmerOrOwner(); - if (owner && owner->IsPlayer() && !owner->IsPvP()) - { - Player* pOwner = owner->ToPlayer(); - if ((target->IsPlayer() && target->IsPvP() && !pOwner->IsInDuelWith((Player*)target)) || // PvP flagged players - (target->IsCreature() && target->IsPvP())) // PvP flagged creatures - { - pOwner->UpdatePvP(true); - pOwner->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); - } - } } } diff --git a/src/game/Maps/GridNotifiersImpl.h b/src/game/Maps/GridNotifiersImpl.h index ef9ae10f9..d14460346 100644 --- a/src/game/Maps/GridNotifiersImpl.h +++ b/src/game/Maps/GridNotifiersImpl.h @@ -155,11 +155,6 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target) if (!i_dynobject.NeedsRefresh(target)) return; - // Negative AoE from non flagged players cannot target other players - if (Player *attackedPlayer = target->GetCharmerOrOwnerPlayerOrPlayerItself()) - if (!i_positive && i_check->IsPlayer() && !i_check->IsPvP() && !((Player*)i_check)->IsInDuelWith(attackedPlayer)) - return; - SpellEntry const *spellInfo = sSpellMgr.GetSpellEntry(i_dynobject.GetSpellId()); SpellEffectIndex eff_index = i_dynobject.GetEffIndex(); diff --git a/src/game/Maps/Map.cpp b/src/game/Maps/Map.cpp index 202e1578c..4040cff22 100644 --- a/src/game/Maps/Map.cpp +++ b/src/game/Maps/Map.cpp @@ -153,8 +153,6 @@ public: void Map::SpawnActiveObjects() { - if (MapPersistentState* state = GetPersistentState()) - state->InitPools(); ActiveObjectsGridLoader loader(this); sObjectMgr.DoGOData(loader); sObjectMgr.DoCreatureData(loader); @@ -1030,16 +1028,9 @@ void Map::Remove(Player *player, bool remove) RemoveUnitFromMovementUpdate(player); player->m_needUpdateVisibility = false; - player->m_visibleGUIDs_lock.acquire_write(); - for (ObjectGuidSet::const_iterator it = player->m_visibleGUIDs.begin(); it != player->m_visibleGUIDs.end();) + for (ObjectGuidSet::const_iterator it = player->m_visibleGUIDs.begin(); it != player->m_visibleGUIDs.end(); ++it) if (Player* other = GetPlayer(*it)) - { - other->DestroyForPlayer(player); other->m_broadcaster->RemoveListener(player); - it = player->m_visibleGUIDs.erase(it); - } - else ++it; - player->m_visibleGUIDs_lock.release(); player->ResetMap(); if (remove) diff --git a/src/game/Maps/MapPersistentStateMgr.cpp b/src/game/Maps/MapPersistentStateMgr.cpp index 492dc060b..03adb0b02 100644 --- a/src/game/Maps/MapPersistentStateMgr.cpp +++ b/src/game/Maps/MapPersistentStateMgr.cpp @@ -970,8 +970,7 @@ void MapPersistentStateManager::LoadCreatureRespawnTimes() for (int instance = beginInstance; instance < endInstance; ++instance) { - MapPersistentState* state = AddPersistentState(mapEntry, instance, - resetTime, mapEntry->IsDungeon(), true, false /*= initPools*/); + MapPersistentState* state = AddPersistentState(mapEntry, instance, resetTime, mapEntry->IsDungeon(), true); if (!state) continue; @@ -1050,8 +1049,7 @@ void MapPersistentStateManager::LoadGameobjectRespawnTimes() for (int instance = beginInstance; instance < endInstance; ++instance) { - MapPersistentState* state = AddPersistentState(mapEntry, instance, - resetTime, mapEntry->IsDungeon(), true, false /*= initPools*/); + MapPersistentState* state = AddPersistentState(mapEntry, instance, resetTime, mapEntry->IsDungeon(), true); if (!state) continue; diff --git a/src/game/Maps/Pool/PoolManager.cpp b/src/game/Maps/Pool/PoolManager.cpp index b3c363cc8..a6e6c9c60 100644 --- a/src/game/Maps/Pool/PoolManager.cpp +++ b/src/game/Maps/Pool/PoolManager.cpp @@ -360,35 +360,6 @@ void PoolGroup::SpawnObject(MapPersistentState& mapState, uint32 limit, uint3 // spawned by 1 if (triggerFrom && spawns.IsSpawnedObject(triggerFrom)) ++count; - // Instance loading : no object spawned, check if any timers have been loaded - // from the database and spawn the object at the right location - else if (count && count == limit) - { - if (!ExplicitlyChanced.empty()) - { - for (uint32 i = 0; i < ExplicitlyChanced.size(); ++i) - { - if (count && GetPoolObjectRespawnTime(mapState, ExplicitlyChanced[i].guid)) - { - spawns.AddSpawn(ExplicitlyChanced[i].guid, poolId); - Spawn1Object(mapState, &ExplicitlyChanced[i], instantly); - --count; - } - } - } - else if (!EqualChanced.empty()) - { - for (int i = 0; i < EqualChanced.size(); ++i) - { - if (count && GetPoolObjectRespawnTime(mapState, EqualChanced[i].guid)) - { - spawns.AddSpawn(EqualChanced[i].guid, poolId); - Spawn1Object(mapState, &EqualChanced[i], instantly); - --count; - } - } - } - } // This will try to spawn the rest of pool, not guaranteed for (int i = 0; i < count; ++i) @@ -421,24 +392,6 @@ void PoolGroup::SpawnObject(MapPersistentState& mapState, uint32 limit, uint3 } } -template <> -time_t PoolGroup::GetPoolObjectRespawnTime(MapPersistentState& mapState, uint32 guid) -{ - return mapState.GetCreatureRespawnTime(guid); -} - -template <> -time_t PoolGroup::GetPoolObjectRespawnTime(MapPersistentState& mapState, uint32 guid) -{ - return mapState.GetGORespawnTime(guid); -} - -template <> -time_t PoolGroup::GetPoolObjectRespawnTime(MapPersistentState& mapState, uint32 guid) -{ - return 0; -} - // Method that is actualy doing the spawn job on 1 creature template <> void PoolGroup::Spawn1Object(MapPersistentState& mapState, PoolObject* obj, bool instantly) diff --git a/src/game/Maps/Pool/PoolManager.h b/src/game/Maps/Pool/PoolManager.h index 1bd3e9195..d17269422 100644 --- a/src/game/Maps/Pool/PoolManager.h +++ b/src/game/Maps/Pool/PoolManager.h @@ -137,8 +137,6 @@ class PoolGroup void ReSpawn1Object(MapPersistentState& mapState, PoolObject* obj); void RemoveOneRelation(uint16 child_pool_id); - time_t GetPoolObjectRespawnTime(MapPersistentState& mapState, uint32 guid); - PoolObjectList const& GetExplicitlyChanced() const { return ExplicitlyChanced; } PoolObjectList const& GetEqualChanced() const { return EqualChanced; } diff --git a/src/game/Movement/WaypointMovementGenerator.cpp b/src/game/Movement/WaypointMovementGenerator.cpp index 27a56b08f..6ec7aac7a 100644 --- a/src/game/Movement/WaypointMovementGenerator.cpp +++ b/src/game/Movement/WaypointMovementGenerator.cpp @@ -277,12 +277,8 @@ void FlightPathMovementGenerator::Finalize(Player & player) if (player.m_taxi.empty()) { player.getHostileRefManager().setOnlineOfflineState(true); - if (player.pvpInfo.inHostileArea) - { + if (player.pvpInfo.inHostileArea) player.CastSpell(&player, 2479, true); - if (!player.IsPvP()) - player.UpdatePvP(true, true); - } // update z position to ground and orientation for landing point // this prevent cheating with landing point at lags diff --git a/src/game/Objects/Player.cpp b/src/game/Objects/Player.cpp index 908e1f0e8..6507eb079 100644 --- a/src/game/Objects/Player.cpp +++ b/src/game/Objects/Player.cpp @@ -1202,11 +1202,10 @@ void Player::Update(uint32 update_diff, uint32 p_time) UpdateMeleeAttackingState(); Unit *pVictim = getVictim(); - if (pVictim && !IsNonMeleeSpellCasted(false) && CanReachWithMeleeAttack(pVictim)) + if (pVictim && !IsNonMeleeSpellCasted(false)) { Player *vOwner = pVictim->GetCharmerOrOwnerPlayerOrPlayerItself(); - if ((vOwner && vOwner->IsPvP() && !IsInDuelWith(vOwner)) || // PvP flagged players - (pVictim->IsCreature() && pVictim->IsPvP())) // PvP flagged creatures + if (vOwner && vOwner->IsPvP() && !IsInDuelWith(vOwner)) { UpdatePvP(true); RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); @@ -6284,7 +6283,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea) if (pvpInfo.inHostileArea) // in hostile area { - if ((!IsPvP() && !IsTaxiFlying()) || pvpInfo.endTimer != 0) + if (!IsPvP() || pvpInfo.endTimer != 0) UpdatePvP(true, true); } else // in friendly area @@ -12341,10 +12340,6 @@ void Player::AddQuest(Quest const *pQuest, Object *questGiver) else questStatusData.m_timer = 0; - // Set PvP flag for PvP quests - if (pQuest->GetType() == QUEST_TYPE_PVP) - UpdatePvP(true, true); - SetQuestSlot(log_slot, quest_id, qtime); if (questStatusData.uState != QUEST_NEW) diff --git a/src/game/Objects/Unit.cpp b/src/game/Objects/Unit.cpp index cff928fe3..bfae69ffd 100644 --- a/src/game/Objects/Unit.cpp +++ b/src/game/Objects/Unit.cpp @@ -5384,83 +5384,68 @@ ReputationRank Unit::GetReactionTo(Unit const* target) const return *repRank; } - // Interaction between pvp flagged units - if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && - target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) + if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) { - if (selfPlayerOwner && targetPlayerOwner) + if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) { - // always friendly to other unit controlled by player, or to the player himself - if (selfPlayerOwner == targetPlayerOwner) - return REP_FRIENDLY; - - // duel - always hostile to opponent - if (selfPlayerOwner->duel && selfPlayerOwner->duel->opponent == targetPlayerOwner && selfPlayerOwner->duel->startTime != 0 && !selfPlayerOwner->duel->finished) - return REP_HOSTILE; - - // same group - checks dependant only on our faction - skip FFA_PVP for example - if (selfPlayerOwner->IsInRaidWith(targetPlayerOwner)) - return REP_FRIENDLY; // return true to allow config option AllowTwoSide.Interaction.Group to work - // however client seems to allow mixed group parties, because in 13850 client it works like: - // return GetFactionReactionTo(getFactionTemplateEntry(), target); - - // Sanctuary - if (selfPlayerOwner->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_SANCTUARY) && targetPlayerOwner->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_SANCTUARY)) - return REP_FRIENDLY; - - // Nostalrius: Hackfix because UNIT_BYTE2_FLAG_FFA_PVP is not implemented yet. - if (selfPlayerOwner->IsFFAPvP() && targetPlayerOwner->IsFFAPvP()) - return REP_HOSTILE; - } - - // check FFA_PVP - not implemented that way on MaNGOS :/ - /* - if (GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_FFA_PVP - && target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_FFA_PVP) - return REP_HOSTILE; - */ - - if (selfPlayerOwner) - { - if (FactionTemplateEntry const* targetFactionTemplateEntry = target->getFactionTemplateEntry()) + if (selfPlayerOwner && targetPlayerOwner) { - if (ReputationRank const* repRank = selfPlayerOwner->GetReputationMgr().GetForcedRankIfAny(targetFactionTemplateEntry)) - return *repRank; - if (FactionEntry const* targetFactionEntry = sFactionStore.LookupEntry(targetFactionTemplateEntry->faction)) - { - if (targetFactionEntry->CanHaveReputation()) - { - // check contested flags - if (targetFactionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_CONTESTED_GUARD - && selfPlayerOwner->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP)) - return REP_HOSTILE; + // always friendly to other unit controlled by player, or to the player himself + if (selfPlayerOwner == targetPlayerOwner) + return REP_FRIENDLY; - // if faction has reputation, hostile state depends only from AtWar state - if (FactionState const* factionState = selfPlayerOwner->GetReputationMgr().GetState(targetFactionEntry)) - if (factionState->Flags & FACTION_FLAG_AT_WAR) + // duel - always hostile to opponent + if (selfPlayerOwner->duel && selfPlayerOwner->duel->opponent == targetPlayerOwner && selfPlayerOwner->duel->startTime != 0 && !selfPlayerOwner->duel->finished) + return REP_HOSTILE; + + // same group - checks dependant only on our faction - skip FFA_PVP for example + if (selfPlayerOwner->IsInRaidWith(targetPlayerOwner)) + return REP_FRIENDLY; // return true to allow config option AllowTwoSide.Interaction.Group to work + // however client seems to allow mixed group parties, because in 13850 client it works like: + // return GetFactionReactionTo(getFactionTemplateEntry(), target); + + // Sanctuary + if (selfPlayerOwner->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_SANCTUARY) && targetPlayerOwner->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_SANCTUARY)) + return REP_FRIENDLY; + + // Nostalrius: Hackfix because UNIT_BYTE2_FLAG_FFA_PVP is not implemented yet. + if (selfPlayerOwner->IsFFAPvP() && targetPlayerOwner->IsFFAPvP()) + return REP_HOSTILE; + } + + // check FFA_PVP - not implemented that way on MaNGOS :/ + /* + if (GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_FFA_PVP + && target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_FFA_PVP) + return REP_HOSTILE; + */ + + if (selfPlayerOwner) + { + if (FactionTemplateEntry const* targetFactionTemplateEntry = target->getFactionTemplateEntry()) + { + if (ReputationRank const* repRank = selfPlayerOwner->GetReputationMgr().GetForcedRankIfAny(targetFactionTemplateEntry)) + return *repRank; + if (FactionEntry const* targetFactionEntry = sFactionStore.LookupEntry(targetFactionTemplateEntry->faction)) + { + if (targetFactionEntry->CanHaveReputation()) + { + // check contested flags + if (targetFactionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_CONTESTED_GUARD + && selfPlayerOwner->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP)) return REP_HOSTILE; - return REP_FRIENDLY; + + // if faction has reputation, hostile state depends only from AtWar state + if (FactionState const* factionState = selfPlayerOwner->GetReputationMgr().GetState(targetFactionEntry)) + if (factionState->Flags & FACTION_FLAG_AT_WAR) + return REP_HOSTILE; + return REP_FRIENDLY; + } } } } } } - - // Player reaction against Neutral faction Creature - if (selfPlayerOwner && !targetPlayerOwner) - { - if (FactionTemplateEntry const* targetFactionTemplateEntry = target->getFactionTemplateEntry()) - { - if (FactionEntry const* targetFactionEntry = sFactionStore.LookupEntry(targetFactionTemplateEntry->faction)) - { - if(targetFactionEntry->CanHaveReputation()) - { - return selfPlayerOwner->GetReputationMgr().GetRank(targetFactionEntry); - } - } - } - } - // do checks dependant only on our faction return GetFactionReactionTo(getFactionTemplateEntry(), target); } diff --git a/src/game/Spells/Spell.cpp b/src/game/Spells/Spell.cpp index e7f005cfc..479103fff 100644 --- a/src/game/Spells/Spell.cpp +++ b/src/game/Spells/Spell.cpp @@ -592,14 +592,13 @@ void Spell::FillTargetMap() break; } - if (m_caster->GetTypeId() == TYPEID_PLAYER && !(m_spellInfo->AttributesEx & SPELL_ATTR_EX_NO_THREAT)) + if (m_caster->GetTypeId() == TYPEID_PLAYER) { Player *me = (Player*)m_caster; for (UnitList::const_iterator itr = tmpUnitMap.begin(); itr != tmpUnitMap.end(); ++itr) { Player *targetOwner = (*itr)->GetCharmerOrOwnerPlayerOrPlayerItself(); - if ((targetOwner && targetOwner != me && targetOwner->IsPvP() && !me->IsInDuelWith(targetOwner)) || // PvP flagged players - ((*itr)->IsCreature() && (*itr)->IsPvP())) // PvP flagged creatures + if (targetOwner && targetOwner != me && targetOwner->IsPvP() && !me->IsInDuelWith(targetOwner)) { me->UpdatePvP(true); me->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); @@ -5024,7 +5023,7 @@ SpellCastResult Spell::CheckCast(bool strict) // Nostalrius: impossible to cast spells while banned / feared / confused ... // Except divine shields, pvp trinkets for example // TODO: This condition allows an antifear item to be used while stuned for example. - if (!m_IsTriggeredSpell && !IsSpellHaveAura(m_spellInfo, SPELL_AURA_SCHOOL_IMMUNITY) && !IsSpellHaveAura(m_spellInfo, SPELL_AURA_MECHANIC_IMMUNITY) && + if (!m_IsTriggeredSpell && !IsSpellAppliesAura(m_spellInfo, SPELL_AURA_SCHOOL_IMMUNITY) && !IsSpellAppliesAura(m_spellInfo, SPELL_AURA_MECHANIC_IMMUNITY) && m_caster->hasUnitState(UNIT_STAT_ISOLATED | UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED | UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING)) return SPELL_FAILED_DONT_REPORT; @@ -7442,11 +7441,6 @@ public: { if (!casterUnit->IsValidAttackTarget(sourceUnit)) continue; - - // Negative AoE from non flagged players cannot target other players - if (Player *attackedPlayer = sourceUnit->GetCharmerOrOwnerPlayerOrPlayerItself()) - if (casterUnit->IsPlayer() && !casterUnit->IsPvP() && !((Player*)casterUnit)->IsInDuelWith(attackedPlayer)) - continue; } else if (GameObject* gobj = i_originalCaster->ToGameObject()) { diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_victor_nefarius.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_victor_nefarius.cpp index 49a7ebdfe..e44d7ffdc 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_victor_nefarius.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_victor_nefarius.cpp @@ -1,688 +1,688 @@ -/* Copyright (C) 2006 - 2011 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Boss_Victor_Nefarius -SD%Complete: 75 -SDComment: Missing some text, Vael beginning event, and spawns Nef in wrong place -SDCategory: Blackwing Lair -EndScriptData */ - -#include "scriptPCH.h" -#include "blackwing_lair.h" - -enum -{ - SAY_GAMESBEGIN_1 = -1469004, - SAY_GAMESBEGIN_2 = -1469005, - - SAY_SCEPTER_RUN_START = -1469031, - SAY_SCEPTER_TAUNT_0 = -1469038, - SAY_SCEPTER_TAUNT_1 = -1469040, - SAY_SCEPTER_TAUNT_2 = -1469041, - SAY_SCEPTER_TAUNT_3 = -1469042, - SAY_SCEPTER_TAUNT_4 = -1469043, - MAX_SCEPTER_TAUNTS = 6, - - SAY_SCEPTER_RUN_LAUGHTER = -1469039, - - SAY_SCEPTER_FAIL_LAUGHTER = -1469044, - SAY_SCEPTER_FAIL = -1469045, - - GOSSIP_TEXT_NEFARIUS_1 = 7134, - GOSSIP_TEXT_NEFARIUS_2 = 7198, - GOSSIP_TEXT_NEFARIUS_3 = 7199, - - MAX_DRAKES = 5, - MAX_DRAKE_KILLED = 42, - NPC_BRONZE_DRAKANOID = 14263, - NPC_BLUE_DRAKANOID = 14261, - NPC_RED_DRAKANOID = 14264, - NPC_GREEN_DRAKANOID = 14262, - NPC_BLACK_DRAKANOID = 14265, - NPC_CHROMATIC_DRAKANOID = 14302, - - SPELL_NEFARIUS_BARRIER = 22663, // immunity in phase 1 - SPELL_SHADOWBOLT = 22677, - SPELL_SHADOWBOLT_VOLLEY = 22665, - SPELL_FEAR = 22678, - SPELL_SILENCE = 22666, - SPELL_SHADOW_COMMAND = 22667, // charm a player - SPELL_SHADOW_BLINK = 22664, // 22681 ? // teleport around the room, possibly random - SPELL_ROOT = 23973, - SPELL_VISUAL_EFFECT = 24180, - SPELL_HOVER = 17131, - - FACTION_BLACK_DRAGON = 103, - FACTION_FRIENDLY = 35, - - GO_DRAKONID_BONES = 179804, - - NPC_NEFARIAN = 11583, - - QUEST_NEFARIUS_CORRUPTION = 8730 -}; - -struct SpawnLocation -{ - float m_fX, m_fY, m_fZ; -}; - -static const SpawnLocation aNefarianLocs[5] = -{ - { -7599.32f, -1191.72f, 475.545f}, // opening where red/blue/black darknid spawner appear (ori 3.05433) - { -7526.27f, -1135.04f, 473.445f}, // same as above, closest to door (ori 5.75959) - { -7515.644f, -1222.698f, 534.7169f}, // nefarian spawn location (ori 1.798) - { -7592.0f, -1264.0f, 481.0f}, // hide pos (useless; remove this) - { -7502.002f, -1256.503f, 486.758f} // nefarian fly to this position -}; - -static const uint32 aPossibleDrake[MAX_DRAKES] = {NPC_BRONZE_DRAKANOID, NPC_BLUE_DRAKANOID, NPC_RED_DRAKANOID, NPC_GREEN_DRAKANOID, NPC_BLACK_DRAKANOID}; - -//This script is complicated -//Instead of morphing Victor Nefarius we will have him control phase 1 -//And then have him spawn "Nefarian" for phase 2 -//When phase 2 starts Victor Nefarius will go invisible and stop attacking -//If Nefarian reched home because nef killed the players then nef will trigger this guy to EnterEvadeMode -//and allow players to start the event over -//If nefarian dies then he will kill himself then he will be despawned in Nefarian script -//To prevent players from doing the event twice - -// Dev note: Lord Victor Nefarius should despawn completely, then ~5 seconds later Nefarian should appear. - -struct boss_victor_nefariusAI : ScriptedAI -{ - explicit boss_victor_nefariusAI(Creature* pCreature) : ScriptedAI(pCreature) - { - m_pInstance = static_cast(pCreature->GetInstanceData()); - - // Select the 2 different drakes that we are going to use until despawned - // 5 possiblities for the first drake, 4 for the second, 20 total possiblites - - // select two different numbers between 0..MAX_DRAKES-1 - if (m_pInstance) - { - const int NUM_DRAKES = sizeof(aPossibleDrake) / sizeof(aPossibleDrake[0]); - uint32 drakesType = m_pInstance->GetData64(DATA_NEF_COLOR); - m_uiDrakeTypeOne = aPossibleDrake[drakesType % NUM_DRAKES]; - int idx2 = drakesType / NUM_DRAKES; - if (idx2 == drakesType % NUM_DRAKES) - ++idx2; - m_uiDrakeTypeTwo = aPossibleDrake[idx2 % NUM_DRAKES]; - } - - boss_victor_nefariusAI::Reset(); - } - - const uint32 MAX_SCEPTER_RUN_TIME = 90 * MINUTE * IN_MILLISECONDS; - const uint32 SCEPTER_TAUNT_INTERVAL = MAX_SCEPTER_RUN_TIME / MAX_SCEPTER_TAUNTS; - const uint32 SCEPTER_TAUNT_OFFSET = SCEPTER_TAUNT_INTERVAL / 2; - - ScriptedInstance* m_pInstance; - - uint32 m_uiKilledAdds; - uint32 m_uiAddSpawnTimer; - uint32 m_uiAddChromaSpawnTimer; - uint32 m_uiShadowBoltTimer; - uint32 m_uiShadowBoltVolleyTimer; - uint32 m_uiFearTimer; - uint32 m_uiSilenceTimer; - uint32 m_uiMindControlTimer; - uint32 m_uiShadowBlinkTimer; - uint32 m_uiResetTimer; - uint32 m_uiDrakeTypeOne; - uint32 m_uiDrakeTypeTwo; - uint32 m_uiEventTimer; - uint32 blaBlaCount; - uint32 scepterRunTime; - uint32 nextScepterTauntTime; - uint32 scepterTauntID; - - bool NefaEventStart; - bool phase1; - bool phase2; - bool phase2bis; - bool Smoke; - bool scepterRun; - bool watchScepterRun; - - ObjectGuid m_uiMindControledPlayerGuid; - float m_uiMindControledPlayerAggro; - - void Reset() override - { - m_uiKilledAdds = 0; - m_uiAddSpawnTimer = 6000; - m_uiAddChromaSpawnTimer = urand(7000, 9000); - m_uiShadowBoltTimer = 5000; - m_uiShadowBoltVolleyTimer = 15000; - m_uiFearTimer = 8000; - m_uiSilenceTimer = 20000; - m_uiMindControlTimer = 25000; - m_uiShadowBlinkTimer = 1000; - m_uiResetTimer = 15 * MINUTE * IN_MILLISECONDS; - scepterRunTime = 0; - nextScepterTauntTime = 0; - scepterTauntID = 0; - - m_uiMindControledPlayerGuid.Clear(); - m_uiMindControledPlayerAggro = 0; - - m_uiEventTimer = 1000; - blaBlaCount = 0; - NefaEventStart = false; - phase1 = false; - phase2 = false; - phase2bis = false; - Smoke = false; - scepterRun = false; - watchScepterRun = false; - - m_creature->setFaction(FACTION_FRIENDLY); - - // set gossip flag to begin the event - m_creature->SetStandState(UNIT_STAND_STATE_SIT_LOW_CHAIR); - m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - - // Make visible if needed - if (m_creature->GetVisibility() != VISIBILITY_ON) - m_creature->SetVisibility(VISIBILITY_ON); - - LoadScepterRun(); - } - - void LoadScepterRun() - { - if (!m_pInstance) - return; - - if (m_pInstance->GetData(TYPE_SCEPTER_RUN) == FAIL) - return; - - watchScepterRun = true; - - if (m_pInstance->GetData(TYPE_SCEPTER_RUN) == IN_PROGRESS) - { - scepterRun = true; - scepterRunTime = m_pInstance->GetData64(DATA_SCEPTER_RUN_TIME); - - // Find elapsed time + taunt time offset - uint32 elapsedTime = MAX_SCEPTER_RUN_TIME - scepterRunTime; - elapsedTime += SCEPTER_TAUNT_OFFSET; - - // Restore next scepter taunt ID - scepterTauntID = elapsedTime / SCEPTER_TAUNT_INTERVAL; - // Restore time to next taunt - nextScepterTauntTime = SCEPTER_TAUNT_INTERVAL - (elapsedTime % SCEPTER_TAUNT_INTERVAL); - } - - } - - void StartScepterRun() - { - DoScriptText(SAY_SCEPTER_RUN_START, m_creature); - - scepterTauntID = 0; - nextScepterTauntTime = SCEPTER_TAUNT_OFFSET; - - scepterRunTime = MAX_SCEPTER_RUN_TIME; - scepterRun = true; - - m_pInstance->SetData(TYPE_SCEPTER_RUN, IN_PROGRESS); - } - - void Aggro(Unit* /*pWho*/) override - { - if (m_pInstance) - m_pInstance->SetData(TYPE_NEFARIAN, IN_PROGRESS); - - m_creature->SetInCombatWithZone(); - } - - void EnterEvadeMode() override - { - ScriptedAI::EnterEvadeMode(); - } - - void JustReachedHome() override - { - m_creature->setFaction(FACTION_FRIENDLY); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - - if (m_pInstance) - m_pInstance->SetData(TYPE_NEFARIAN, FAIL); - - std::list lGameObjects; - m_creature->GetGameObjectListWithEntryInGrid(lGameObjects, GO_DRAKONID_BONES, 250.0f); - for (auto itr = lGameObjects.begin(); itr != lGameObjects.end(); ++itr) - (*itr)->DeleteLater(); - - // @TODO: Find out why there is this reset bug !! - //m_creature->SetRespawnDelay(900); // 15mn 900 - m_creature->SetRespawnDelay(10); - m_creature->DisappearAndDie(); - } - - void JustSummoned(Creature* pSummoned) override - { - if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) - { - pSummoned->SetInCombatWithZone(); - pSummoned->AI()->AttackStart(pTarget); - } - - pSummoned->SetRespawnDelay(7 * DAY); - } - - void SummonedCreatureJustDied(Creature* pSummoned) override - { - // Despawn self when Nefarian is killed - if (pSummoned->GetEntry() == NPC_NEFARIAN) - { - if (nullptr == m_pInstance) - return; - - uint32 scepterRunResult = FAIL; - - // Check for successful Scepter Shard Run - if (scepterRun) - { - // Check if still has time left - if (Player* scepterChampion = m_creature->GetMap()->GetPlayer(m_pInstance->GetData64(DATA_SCEPTER_CHAMPION))) - if (scepterChampion->GetQuestStatus(QUEST_NEFARIUS_CORRUPTION) == QUEST_STATUS_INCOMPLETE) - scepterRunResult = DONE; - - } - - m_pInstance->SetData(TYPE_SCEPTER_RUN, scepterRunResult); - - - m_creature->SetRespawnDelay(7 * DAY); - m_creature->ForcedDespawn(); - } - else - ++m_uiKilledAdds; - } - - void UpdateAI(const uint32 uiDiff) override - { - if (NefaEventStart && !phase1) - { - if (m_uiEventTimer < uiDiff) - { - ++blaBlaCount; - switch (blaBlaCount) - { - case 1: - DoScriptText(SAY_GAMESBEGIN_1, m_creature); - m_uiEventTimer = 7000; - break; - case 2: - DoScriptText(SAY_GAMESBEGIN_2, m_creature); - m_uiEventTimer = 4000; - break; - case 3: - DoCastSpellIfCan(m_creature, SPELL_NEFARIUS_BARRIER); - m_creature->setFaction(FACTION_BLACK_DRAGON); - - Map::PlayerList const &liste = m_creature->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator i = liste.begin(); i != liste.end(); ++i) - if (i->getSource() && i->getSource()->isAlive()) - m_creature->AddThreat(i->getSource(), 10000.0f); - - DoCastSpellIfCan(m_creature, SPELL_ROOT, CAST_TRIGGERED); // root - break; - } - } - else - m_uiEventTimer -= uiDiff; - } - - if (watchScepterRun && nullptr != m_pInstance) - { - if (scepterRun) - { - HandleScepterRun(uiDiff); - } - else - { - uint32 scepterRunStatus = m_pInstance->GetData(TYPE_SCEPTER_RUN); - - if (FAIL == scepterRunStatus) - { - watchScepterRun = false; - } - else if (SPECIAL == scepterRunStatus) - { - StartScepterRun(); - } - } - } - - - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) - return; - - if (phase2bis) - return; - - if (m_uiKilledAdds >= MAX_DRAKE_KILLED) // 42 drakes killed - { - phase2bis = true; - if (phase2) - return; - } - - // Add spawning mechanism - if (m_uiAddSpawnTimer < uiDiff) - { - m_creature->SummonCreature(m_uiDrakeTypeOne, - aNefarianLocs[0].m_fX, - aNefarianLocs[0].m_fY, - aNefarianLocs[0].m_fZ, - 5.000f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10 * IN_MILLISECONDS); - m_creature->SummonCreature(m_uiDrakeTypeTwo, - aNefarianLocs[1].m_fX, - aNefarianLocs[1].m_fY, - aNefarianLocs[1].m_fZ, - 5.000f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10 * IN_MILLISECONDS); - - m_uiAddSpawnTimer = urand(6000, 7000); - } - else - m_uiAddSpawnTimer -= uiDiff; - - if (m_uiAddChromaSpawnTimer < uiDiff) - { - m_creature->SummonCreature(NPC_CHROMATIC_DRAKANOID, - aNefarianLocs[0].m_fX, - aNefarianLocs[0].m_fY, - aNefarianLocs[0].m_fZ, - 5.000f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10 * IN_MILLISECONDS); - m_creature->SummonCreature(NPC_CHROMATIC_DRAKANOID, - aNefarianLocs[1].m_fX, - aNefarianLocs[1].m_fY, - aNefarianLocs[1].m_fZ, - 5.000f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10 * IN_MILLISECONDS); - m_uiAddChromaSpawnTimer = 35000; - } - else - m_uiAddChromaSpawnTimer -= uiDiff; - - if (phase2) // 40 drakes killed - return; - - //Begin phase 2 by spawning Nefarian - if (m_uiKilledAdds >= (MAX_DRAKE_KILLED - 2)) // 40 drakes killed - { - //Inturrupt any spell casting - m_creature->InterruptNonMeleeSpells(false); - - //Root self - DoCastSpellIfCan(m_creature, SPELL_ROOT, CAST_TRIGGERED); - - //Make super invis - if (m_creature->GetVisibility() != VISIBILITY_OFF) - m_creature->SetVisibility(VISIBILITY_OFF); - - // Spawn Nefarian - // Summon as active, to be able to work proper! - if (Creature* pNefarian = m_creature->SummonCreature(NPC_NEFARIAN, - aNefarianLocs[2].m_fX, - aNefarianLocs[2].m_fY, - aNefarianLocs[2].m_fZ, - 0, TEMPSUMMON_MANUAL_DESPAWN, 0, true)) - { - pNefarian->CastSpell(pNefarian, SPELL_HOVER, true); - pNefarian->SetFly(true); - } - - // Nefarian spawn when 40 drakes are killed - // Adds will stop spawning when 42 are killed - // He flies then arrives at his spawn point staying in the air - // 10 seconds later: arise and cast shadow flame - phase2 = true; - return; - } - - // Shadowbolt Timer - if (m_uiShadowBoltTimer < uiDiff) - { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWBOLT) == CAST_OK) - m_uiShadowBoltTimer = urand(3000, 10000); - } - else - m_uiShadowBoltTimer -= uiDiff; - - // Shadowbolt Volley Timer - if (m_uiShadowBoltVolleyTimer < uiDiff) - { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWBOLT_VOLLEY) == CAST_OK) - m_uiShadowBoltVolleyTimer = 15000; - } - else - m_uiShadowBoltVolleyTimer -= uiDiff; - - // Fear Timer - if (m_uiFearTimer < uiDiff) - { - if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) - { - if (DoCastSpellIfCan(pTarget, SPELL_FEAR) == CAST_OK) - m_uiFearTimer = urand(15000, 25000); - } - } - else - m_uiFearTimer -= uiDiff; - - // Silence Timer - if (m_uiSilenceTimer < uiDiff) - { - if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) - { - if (DoCastSpellIfCan(pTarget, SPELL_SILENCE) == CAST_OK) - m_uiSilenceTimer = urand(25000, 40000); - } - } - else - m_uiSilenceTimer -= uiDiff; - - // Shadow Blink Timer - if (m_uiShadowBlinkTimer < uiDiff) - { - if (!Smoke) - { - m_creature->InterruptNonMeleeSpells(false); - m_creature->SendSpellGo(m_creature, SPELL_VISUAL_EFFECT); - m_uiShadowBlinkTimer = 1000; - Smoke = true; - } - else if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) - { - m_creature->NearTeleportTo(pTarget->GetPositionX() + float(urand(0, 8)), pTarget->GetPositionY() + float(urand(0, 8)), pTarget->GetPositionZ(), m_creature->GetOrientation()); - m_creature->SendSpellGo(m_creature, SPELL_VISUAL_EFFECT); - AttackStart(pTarget); - m_creature->SetInCombatWithZone(); - DoCastSpellIfCan(m_creature, SPELL_ROOT, CAST_TRIGGERED); // Root Self - m_uiShadowBlinkTimer = urand(20000, 25000); - m_uiShadowBoltTimer = urand(3000, 6000); - Smoke = false; - } - } - else - m_uiShadowBlinkTimer -= uiDiff; - - if (m_uiMindControledPlayerGuid) - { - if (Unit* pTarget = m_creature->GetMap()->GetPlayer(m_uiMindControledPlayerGuid)) - { - if (!pTarget->HasAura(SPELL_SHADOW_COMMAND)) - { - m_creature->getThreatManager().modifyThreatPercent(pTarget, -100); - m_creature->getThreatManager().addThreatDirectly(pTarget, m_uiMindControledPlayerAggro); - DoCastSpellIfCan(m_creature, SPELL_ROOT, CAST_TRIGGERED); // Root self - m_uiMindControledPlayerGuid.Clear(); - m_uiMindControledPlayerAggro = 0; - } - } - else - { - m_uiMindControledPlayerGuid.Clear(); - m_uiMindControledPlayerAggro = 0; - } - } - - // Mind Control Timer - if (m_uiMindControlTimer < uiDiff) - { - if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1)) - { - m_uiMindControledPlayerGuid = pTarget->GetObjectGuid(); - m_uiMindControledPlayerAggro = m_creature->getThreatManager().getThreat(pTarget); - if (DoCastSpellIfCan(pTarget, SPELL_SHADOW_COMMAND, CAST_AURA_NOT_PRESENT) == CAST_OK) - m_uiMindControlTimer = urand(25000, 40000); - } - } - else - m_uiMindControlTimer -= uiDiff; - } - - void HandleScepterRun(uint32 uiDiff) - { - if (!m_pInstance) - return; - - // Handle Nefarius' taunts throughout the run - if (nextScepterTauntTime <= uiDiff) - { - switch (scepterTauntID) - { - case 0: - DoScriptText(SAY_SCEPTER_TAUNT_0, m_creature); - DoScriptText(SAY_SCEPTER_RUN_LAUGHTER, m_creature); - break; - - case 1: - DoScriptText(SAY_SCEPTER_TAUNT_1, m_creature); - break; - - case 2: - DoScriptText(SAY_SCEPTER_TAUNT_2, m_creature); - break; - - case 3: - DoScriptText(SAY_SCEPTER_TAUNT_3, m_creature); - break; - - case 4: - DoScriptText(SAY_SCEPTER_TAUNT_4, m_creature); - break; - - } - - scepterTauntID ++; - nextScepterTauntTime = SCEPTER_TAUNT_INTERVAL; - - } - else - nextScepterTauntTime -= uiDiff; - - // Check overall Scepter Run time - if (scepterRunTime <= uiDiff) - FailScepterRun(); - else - scepterRunTime -= uiDiff; - - - m_pInstance->SetData(DATA_SCEPTER_RUN_TIME, scepterRunTime); - } - - void FailScepterRun() - { - if (nullptr == m_pInstance) - return; - - scepterRun = false; - watchScepterRun = false; - m_pInstance->SetData(TYPE_SCEPTER_RUN, FAIL); - - DoScriptText(SAY_SCEPTER_FAIL, m_creature); - DoScriptText(SAY_SCEPTER_FAIL_LAUGHTER, m_creature); - } -}; - - -CreatureAI* GetAI_boss_victor_nefarius(Creature* creature) -{ - if (creature->GetMapId() == 469) //BWL - return new boss_victor_nefariusAI(creature); - - // UBRS - creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - return new NullCreatureAI(creature); -} - -bool GossipHello_boss_victor_nefarius(Player* pPlayer, Creature* pCreature) -{ - auto m_pInstance = static_cast(pCreature->GetInstanceData()); - - if (m_pInstance && m_pInstance->GetData(TYPE_CHROMAGGUS) == DONE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I've made no mistakes." ,GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_NEFARIUS_1, pCreature->GetObjectGuid()); - - return true; -} - -bool GossipSelect_boss_victor_nefarius(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "You have lost your mind. You speak in riddles.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_NEFARIUS_2, pCreature->GetObjectGuid()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Please do.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_NEFARIUS_3, pCreature->GetObjectGuid()); - //DoScriptText(SAY_GAMESBEGIN_1, pCreature); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->CLOSE_GOSSIP_MENU(); - //DoScriptText(SAY_GAMESBEGIN_2, pCreature); - // remove gossip, set hostile and attack - pCreature->SetStandState(UNIT_STAND_STATE_STAND); - pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - - if (auto pNefarius = dynamic_cast(pCreature->AI())) - pNefarius->NefaEventStart = true; - break; - } - return true; -} - -void AddSC_boss_victor_nefarius() -{ - Script* pNewScript; - - pNewScript = new Script; - pNewScript->Name = "boss_victor_nefarius"; - pNewScript->GetAI = &GetAI_boss_victor_nefarius; - pNewScript->pGossipHello = &GossipHello_boss_victor_nefarius; - pNewScript->pGossipSelect = &GossipSelect_boss_victor_nefarius; - pNewScript->RegisterSelf(); -} +/* Copyright (C) 2006 - 2011 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Boss_Victor_Nefarius +SD%Complete: 75 +SDComment: Missing some text, Vael beginning event, and spawns Nef in wrong place +SDCategory: Blackwing Lair +EndScriptData */ + +#include "scriptPCH.h" +#include "blackwing_lair.h" + +enum +{ + SAY_GAMESBEGIN_1 = -1469004, + SAY_GAMESBEGIN_2 = -1469005, + + SAY_SCEPTER_RUN_START = -1469031, + SAY_SCEPTER_TAUNT_0 = -1469038, + SAY_SCEPTER_TAUNT_1 = -1469040, + SAY_SCEPTER_TAUNT_2 = -1469041, + SAY_SCEPTER_TAUNT_3 = -1469042, + SAY_SCEPTER_TAUNT_4 = -1469043, + MAX_SCEPTER_TAUNTS = 6, + + SAY_SCEPTER_RUN_LAUGHTER = -1469039, + + SAY_SCEPTER_FAIL_LAUGHTER = -1469044, + SAY_SCEPTER_FAIL = -1469045, + + GOSSIP_TEXT_NEFARIUS_1 = 7134, + GOSSIP_TEXT_NEFARIUS_2 = 7198, + GOSSIP_TEXT_NEFARIUS_3 = 7199, + + MAX_DRAKES = 5, + MAX_DRAKE_KILLED = 42, + NPC_BRONZE_DRAKANOID = 14263, + NPC_BLUE_DRAKANOID = 14261, + NPC_RED_DRAKANOID = 14264, + NPC_GREEN_DRAKANOID = 14262, + NPC_BLACK_DRAKANOID = 14265, + NPC_CHROMATIC_DRAKANOID = 14302, + + SPELL_NEFARIUS_BARRIER = 22663, // immunity in phase 1 + SPELL_SHADOWBOLT = 22677, + SPELL_SHADOWBOLT_VOLLEY = 22665, + SPELL_FEAR = 22678, + SPELL_SILENCE = 22666, + SPELL_SHADOW_COMMAND = 22667, // charm a player + SPELL_SHADOW_BLINK = 22664, // 22681 ? // teleport around the room, possibly random + SPELL_ROOT = 23973, + SPELL_VISUAL_EFFECT = 24180, + SPELL_HOVER = 17131, + + FACTION_BLACK_DRAGON = 103, + FACTION_FRIENDLY = 35, + + GO_DRAKONID_BONES = 179804, + + NPC_NEFARIAN = 11583, + + QUEST_NEFARIUS_CORRUPTION = 8730 +}; + +struct SpawnLocation +{ + float m_fX, m_fY, m_fZ; +}; + +static const SpawnLocation aNefarianLocs[5] = +{ + { -7599.32f, -1191.72f, 475.545f}, // opening where red/blue/black darknid spawner appear (ori 3.05433) + { -7526.27f, -1135.04f, 473.445f}, // same as above, closest to door (ori 5.75959) + { -7515.644f, -1222.698f, 534.7169f}, // nefarian spawn location (ori 1.798) + { -7592.0f, -1264.0f, 481.0f}, // hide pos (useless; remove this) + { -7502.002f, -1256.503f, 486.758f} // nefarian fly to this position +}; + +static const uint32 aPossibleDrake[MAX_DRAKES] = {NPC_BRONZE_DRAKANOID, NPC_BLUE_DRAKANOID, NPC_RED_DRAKANOID, NPC_GREEN_DRAKANOID, NPC_BLACK_DRAKANOID}; + +//This script is complicated +//Instead of morphing Victor Nefarius we will have him control phase 1 +//And then have him spawn "Nefarian" for phase 2 +//When phase 2 starts Victor Nefarius will go invisible and stop attacking +//If Nefarian reched home because nef killed the players then nef will trigger this guy to EnterEvadeMode +//and allow players to start the event over +//If nefarian dies then he will kill himself then he will be despawned in Nefarian script +//To prevent players from doing the event twice + +// Dev note: Lord Victor Nefarius should despawn completely, then ~5 seconds later Nefarian should appear. + +struct boss_victor_nefariusAI : ScriptedAI +{ + explicit boss_victor_nefariusAI(Creature* pCreature) : ScriptedAI(pCreature) + { + m_pInstance = static_cast(pCreature->GetInstanceData()); + + // Select the 2 different drakes that we are going to use until despawned + // 5 possiblities for the first drake, 4 for the second, 20 total possiblites + + // select two different numbers between 0..MAX_DRAKES-1 + if (m_pInstance) + { + const int NUM_DRAKES = sizeof(aPossibleDrake) / sizeof(aPossibleDrake[0]); + uint32 drakesType = m_pInstance->GetData64(DATA_NEF_COLOR); + m_uiDrakeTypeOne = aPossibleDrake[drakesType % NUM_DRAKES]; + int idx2 = drakesType / NUM_DRAKES; + if (idx2 == drakesType % NUM_DRAKES) + ++idx2; + m_uiDrakeTypeTwo = aPossibleDrake[idx2 % NUM_DRAKES]; + } + + boss_victor_nefariusAI::Reset(); + } + + const uint32 MAX_SCEPTER_RUN_TIME = 90 * MINUTE * IN_MILLISECONDS; + const uint32 SCEPTER_TAUNT_INTERVAL = MAX_SCEPTER_RUN_TIME / MAX_SCEPTER_TAUNTS; + const uint32 SCEPTER_TAUNT_OFFSET = SCEPTER_TAUNT_INTERVAL / 2; + + ScriptedInstance* m_pInstance; + + uint32 m_uiKilledAdds; + uint32 m_uiAddSpawnTimer; + uint32 m_uiAddChromaSpawnTimer; + uint32 m_uiShadowBoltTimer; + uint32 m_uiShadowBoltVolleyTimer; + uint32 m_uiFearTimer; + uint32 m_uiSilenceTimer; + uint32 m_uiMindControlTimer; + uint32 m_uiShadowBlinkTimer; + uint32 m_uiResetTimer; + uint32 m_uiDrakeTypeOne; + uint32 m_uiDrakeTypeTwo; + uint32 m_uiEventTimer; + uint32 blaBlaCount; + uint32 scepterRunTime; + uint32 nextScepterTauntTime; + uint32 scepterTauntID; + + bool NefaEventStart; + bool phase1; + bool phase2; + bool phase2bis; + bool Smoke; + bool scepterRun; + bool watchScepterRun; + + ObjectGuid m_uiMindControledPlayerGuid; + float m_uiMindControledPlayerAggro; + + void Reset() override + { + m_uiKilledAdds = 0; + m_uiAddSpawnTimer = 6000; + m_uiAddChromaSpawnTimer = urand(7000, 9000); + m_uiShadowBoltTimer = 5000; + m_uiShadowBoltVolleyTimer = 15000; + m_uiFearTimer = 8000; + m_uiSilenceTimer = 20000; + m_uiMindControlTimer = 25000; + m_uiShadowBlinkTimer = 1000; + m_uiResetTimer = 15 * MINUTE * IN_MILLISECONDS; + scepterRunTime = 0; + nextScepterTauntTime = 0; + scepterTauntID = 0; + + m_uiMindControledPlayerGuid.Clear(); + m_uiMindControledPlayerAggro = 0; + + m_uiEventTimer = 1000; + blaBlaCount = 0; + NefaEventStart = false; + phase1 = false; + phase2 = false; + phase2bis = false; + Smoke = false; + scepterRun = false; + watchScepterRun = false; + + m_creature->setFaction(FACTION_FRIENDLY); + + // set gossip flag to begin the event + m_creature->SetStandState(UNIT_STAND_STATE_SIT_LOW_CHAIR); + m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + + // Make visible if needed + if (m_creature->GetVisibility() != VISIBILITY_ON) + m_creature->SetVisibility(VISIBILITY_ON); + + LoadScepterRun(); + } + + void LoadScepterRun() + { + if (!m_pInstance) + return; + + if (m_pInstance->GetData(TYPE_SCEPTER_RUN) == FAIL) + return; + + watchScepterRun = true; + + if (m_pInstance->GetData(TYPE_SCEPTER_RUN) == IN_PROGRESS) + { + scepterRun = true; + scepterRunTime = m_pInstance->GetData64(DATA_SCEPTER_RUN_TIME); + + // Find elapsed time + taunt time offset + uint32 elapsedTime = MAX_SCEPTER_RUN_TIME - scepterRunTime; + elapsedTime += SCEPTER_TAUNT_OFFSET; + + // Restore next scepter taunt ID + scepterTauntID = elapsedTime / SCEPTER_TAUNT_INTERVAL; + // Restore time to next taunt + nextScepterTauntTime = SCEPTER_TAUNT_INTERVAL - (elapsedTime % SCEPTER_TAUNT_INTERVAL); + } + + } + + void StartScepterRun() + { + DoScriptText(SAY_SCEPTER_RUN_START, m_creature); + + scepterTauntID = 0; + nextScepterTauntTime = SCEPTER_TAUNT_OFFSET; + + scepterRunTime = MAX_SCEPTER_RUN_TIME; + scepterRun = true; + + m_pInstance->SetData(TYPE_SCEPTER_RUN, IN_PROGRESS); + } + + void Aggro(Unit* /*pWho*/) override + { + if (m_pInstance) + m_pInstance->SetData(TYPE_NEFARIAN, IN_PROGRESS); + + m_creature->SetInCombatWithZone(); + } + + void EnterEvadeMode() override + { + ScriptedAI::EnterEvadeMode(); + } + + void JustReachedHome() override + { + m_creature->setFaction(FACTION_FRIENDLY); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + + if (m_pInstance) + m_pInstance->SetData(TYPE_NEFARIAN, FAIL); + + std::list lGameObjects; + m_creature->GetGameObjectListWithEntryInGrid(lGameObjects, GO_DRAKONID_BONES, 250.0f); + for (auto itr = lGameObjects.begin(); itr != lGameObjects.end(); ++itr) + (*itr)->DeleteLater(); + + // @TODO: Find out why there is this reset bug !! + //m_creature->SetRespawnDelay(900); // 15mn 900 + m_creature->SetRespawnDelay(10); + m_creature->DisappearAndDie(); + } + + void JustSummoned(Creature* pSummoned) override + { + if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) + { + pSummoned->SetInCombatWithZone(); + pSummoned->AI()->AttackStart(pTarget); + } + + pSummoned->SetRespawnDelay(7 * DAY); + } + + void SummonedCreatureJustDied(Creature* pSummoned) override + { + // Despawn self when Nefarian is killed + if (pSummoned->GetEntry() == NPC_NEFARIAN) + { + if (nullptr == m_pInstance) + return; + + uint32 scepterRunResult = FAIL; + + // Check for successful Scepter Shard Run + if (scepterRun) + { + // Check if still has time left + if (Player* scepterChampion = m_creature->GetMap()->GetPlayer(m_pInstance->GetData64(DATA_SCEPTER_CHAMPION))) + if (scepterChampion->GetQuestStatus(QUEST_NEFARIUS_CORRUPTION) == QUEST_STATUS_INCOMPLETE) + scepterRunResult = DONE; + + } + + m_pInstance->SetData(TYPE_SCEPTER_RUN, scepterRunResult); + + + m_creature->SetRespawnDelay(7 * DAY); + m_creature->ForcedDespawn(); + } + else + ++m_uiKilledAdds; + } + + void UpdateAI(const uint32 uiDiff) override + { + if (NefaEventStart && !phase1) + { + if (m_uiEventTimer < uiDiff) + { + ++blaBlaCount; + switch (blaBlaCount) + { + case 1: + DoScriptText(SAY_GAMESBEGIN_1, m_creature); + m_uiEventTimer = 7000; + break; + case 2: + DoScriptText(SAY_GAMESBEGIN_2, m_creature); + m_uiEventTimer = 4000; + break; + case 3: + DoCastSpellIfCan(m_creature, SPELL_NEFARIUS_BARRIER); + m_creature->setFaction(FACTION_BLACK_DRAGON); + + Map::PlayerList const &liste = m_creature->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator i = liste.begin(); i != liste.end(); ++i) + if (i->getSource() && i->getSource()->isAlive()) + m_creature->AddThreat(i->getSource(), 10000.0f); + + DoCastSpellIfCan(m_creature, SPELL_ROOT, CAST_TRIGGERED); // root + break; + } + } + else + m_uiEventTimer -= uiDiff; + } + + if (watchScepterRun && nullptr != m_pInstance) + { + if (scepterRun) + { + HandleScepterRun(uiDiff); + } + else + { + uint32 scepterRunStatus = m_pInstance->GetData(TYPE_SCEPTER_RUN); + + if (FAIL == scepterRunStatus) + { + watchScepterRun = false; + } + else if (SPECIAL == scepterRunStatus) + { + StartScepterRun(); + } + } + } + + + if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + return; + + if (phase2bis) + return; + + if (m_uiKilledAdds >= MAX_DRAKE_KILLED) // 42 drakes killed + { + phase2bis = true; + if (phase2) + return; + } + + // Add spawning mechanism + if (m_uiAddSpawnTimer < uiDiff) + { + m_creature->SummonCreature(m_uiDrakeTypeOne, + aNefarianLocs[0].m_fX, + aNefarianLocs[0].m_fY, + aNefarianLocs[0].m_fZ, + 5.000f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10 * IN_MILLISECONDS); + m_creature->SummonCreature(m_uiDrakeTypeTwo, + aNefarianLocs[1].m_fX, + aNefarianLocs[1].m_fY, + aNefarianLocs[1].m_fZ, + 5.000f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10 * IN_MILLISECONDS); + + m_uiAddSpawnTimer = urand(6000, 7000); + } + else + m_uiAddSpawnTimer -= uiDiff; + + if (m_uiAddChromaSpawnTimer < uiDiff) + { + m_creature->SummonCreature(NPC_CHROMATIC_DRAKANOID, + aNefarianLocs[0].m_fX, + aNefarianLocs[0].m_fY, + aNefarianLocs[0].m_fZ, + 5.000f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10 * IN_MILLISECONDS); + m_creature->SummonCreature(NPC_CHROMATIC_DRAKANOID, + aNefarianLocs[1].m_fX, + aNefarianLocs[1].m_fY, + aNefarianLocs[1].m_fZ, + 5.000f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10 * IN_MILLISECONDS); + m_uiAddChromaSpawnTimer = 35000; + } + else + m_uiAddChromaSpawnTimer -= uiDiff; + + if (phase2) // 40 drakes killed + return; + + //Begin phase 2 by spawning Nefarian + if (m_uiKilledAdds >= (MAX_DRAKE_KILLED - 2)) // 40 drakes killed + { + //Inturrupt any spell casting + m_creature->InterruptNonMeleeSpells(false); + + //Root self + DoCastSpellIfCan(m_creature, SPELL_ROOT, CAST_TRIGGERED); + + //Make super invis + if (m_creature->GetVisibility() != VISIBILITY_OFF) + m_creature->SetVisibility(VISIBILITY_OFF); + + // Spawn Nefarian + // Summon as active, to be able to work proper! + if (Creature* pNefarian = m_creature->SummonCreature(NPC_NEFARIAN, + aNefarianLocs[2].m_fX, + aNefarianLocs[2].m_fY, + aNefarianLocs[2].m_fZ, + 0, TEMPSUMMON_MANUAL_DESPAWN, 0, true)) + { + pNefarian->CastSpell(pNefarian, SPELL_HOVER, true); + pNefarian->SetFly(true); + } + + // Nefarian spawn when 40 drakes are killed + // Adds will stop spawning when 42 are killed + // He flies then arrives at his spawn point staying in the air + // 10 seconds later: arise and cast shadow flame + phase2 = true; + return; + } + + // Shadowbolt Timer + if (m_uiShadowBoltTimer < uiDiff) + { + if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWBOLT) == CAST_OK) + m_uiShadowBoltTimer = urand(3000, 10000); + } + else + m_uiShadowBoltTimer -= uiDiff; + + // Shadowbolt Volley Timer + if (m_uiShadowBoltVolleyTimer < uiDiff) + { + if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWBOLT_VOLLEY) == CAST_OK) + m_uiShadowBoltVolleyTimer = 15000; + } + else + m_uiShadowBoltVolleyTimer -= uiDiff; + + // Fear Timer + if (m_uiFearTimer < uiDiff) + { + if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) + { + if (DoCastSpellIfCan(pTarget, SPELL_FEAR) == CAST_OK) + m_uiFearTimer = urand(15000, 25000); + } + } + else + m_uiFearTimer -= uiDiff; + + // Silence Timer + if (m_uiSilenceTimer < uiDiff) + { + if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) + { + if (DoCastSpellIfCan(pTarget, SPELL_SILENCE) == CAST_OK) + m_uiSilenceTimer = urand(25000, 40000); + } + } + else + m_uiSilenceTimer -= uiDiff; + + // Shadow Blink Timer + if (m_uiShadowBlinkTimer < uiDiff) + { + if (!Smoke) + { + m_creature->InterruptNonMeleeSpells(false); + m_creature->SendSpellGo(m_creature, SPELL_VISUAL_EFFECT); + m_uiShadowBlinkTimer = 1000; + Smoke = true; + } + else if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) + { + m_creature->NearTeleportTo(pTarget->GetPositionX() + float(urand(0, 8)), pTarget->GetPositionY() + float(urand(0, 8)), pTarget->GetPositionZ(), m_creature->GetOrientation()); + m_creature->SendSpellGo(m_creature, SPELL_VISUAL_EFFECT); + AttackStart(pTarget); + m_creature->SetInCombatWithZone(); + DoCastSpellIfCan(m_creature, SPELL_ROOT, CAST_TRIGGERED); // Root Self + m_uiShadowBlinkTimer = urand(20000, 25000); + m_uiShadowBoltTimer = urand(3000, 6000); + Smoke = false; + } + } + else + m_uiShadowBlinkTimer -= uiDiff; + + if (m_uiMindControledPlayerGuid) + { + if (Unit* pTarget = m_creature->GetMap()->GetPlayer(m_uiMindControledPlayerGuid)) + { + if (!pTarget->HasAura(SPELL_SHADOW_COMMAND)) + { + m_creature->getThreatManager().modifyThreatPercent(pTarget, -100); + m_creature->getThreatManager().addThreatDirectly(pTarget, m_uiMindControledPlayerAggro); + DoCastSpellIfCan(m_creature, SPELL_ROOT, CAST_TRIGGERED); // Root self + m_uiMindControledPlayerGuid.Clear(); + m_uiMindControledPlayerAggro = 0; + } + } + else + { + m_uiMindControledPlayerGuid.Clear(); + m_uiMindControledPlayerAggro = 0; + } + } + + // Mind Control Timer + if (m_uiMindControlTimer < uiDiff) + { + if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1)) + { + m_uiMindControledPlayerGuid = pTarget->GetObjectGuid(); + m_uiMindControledPlayerAggro = m_creature->getThreatManager().getThreat(pTarget); + if (DoCastSpellIfCan(pTarget, SPELL_SHADOW_COMMAND, CAST_AURA_NOT_PRESENT) == CAST_OK) + m_uiMindControlTimer = urand(25000, 40000); + } + } + else + m_uiMindControlTimer -= uiDiff; + } + + void HandleScepterRun(uint32 uiDiff) + { + if (!m_pInstance) + return; + + // Handle Nefarius' taunts throughout the run + if (nextScepterTauntTime <= uiDiff) + { + switch (scepterTauntID) + { + case 0: + DoScriptText(SAY_SCEPTER_TAUNT_0, m_creature); + DoScriptText(SAY_SCEPTER_RUN_LAUGHTER, m_creature); + break; + + case 1: + DoScriptText(SAY_SCEPTER_TAUNT_1, m_creature); + break; + + case 2: + DoScriptText(SAY_SCEPTER_TAUNT_2, m_creature); + break; + + case 3: + DoScriptText(SAY_SCEPTER_TAUNT_3, m_creature); + break; + + case 4: + DoScriptText(SAY_SCEPTER_TAUNT_4, m_creature); + break; + + } + + scepterTauntID ++; + nextScepterTauntTime = SCEPTER_TAUNT_INTERVAL; + + } + else + nextScepterTauntTime -= uiDiff; + + // Check overall Scepter Run time + if (scepterRunTime <= uiDiff) + FailScepterRun(); + else + scepterRunTime -= uiDiff; + + + m_pInstance->SetData(DATA_SCEPTER_RUN_TIME, scepterRunTime); + } + + void FailScepterRun() + { + if (nullptr == m_pInstance) + return; + + scepterRun = false; + watchScepterRun = false; + m_pInstance->SetData(TYPE_SCEPTER_RUN, FAIL); + + DoScriptText(SAY_SCEPTER_FAIL, m_creature); + DoScriptText(SAY_SCEPTER_FAIL_LAUGHTER, m_creature); + } +}; + + +CreatureAI* GetAI_boss_victor_nefarius(Creature* creature) +{ + if (creature->GetMapId() == 469) //BWL + return new boss_victor_nefariusAI(creature); + + // UBRS + creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + return new NullCreatureAI(creature); +} + +bool GossipHello_boss_victor_nefarius(Player* pPlayer, Creature* pCreature) +{ + auto m_pInstance = static_cast(pCreature->GetInstanceData()); + + if (m_pInstance && m_pInstance->GetData(TYPE_CHROMAGGUS) == DONE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I've made no mistakes." ,GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_NEFARIUS_1, pCreature->GetObjectGuid()); + + return true; +} + +bool GossipSelect_boss_victor_nefarius(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) +{ + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "You have lost your mind. You speak in riddles.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_NEFARIUS_2, pCreature->GetObjectGuid()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Please do.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_NEFARIUS_3, pCreature->GetObjectGuid()); + //DoScriptText(SAY_GAMESBEGIN_1, pCreature); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->CLOSE_GOSSIP_MENU(); + //DoScriptText(SAY_GAMESBEGIN_2, pCreature); + // remove gossip, set hostile and attack + pCreature->SetStandState(UNIT_STAND_STATE_STAND); + pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + + if (auto pNefarius = dynamic_cast(pCreature->AI())) + pNefarius->NefaEventStart = true; + break; + } + return true; +} + +void AddSC_boss_victor_nefarius() +{ + Script* pNewScript; + + pNewScript = new Script; + pNewScript->Name = "boss_victor_nefarius"; + pNewScript->GetAI = &GetAI_boss_victor_nefarius; + pNewScript->pGossipHello = &GossipHello_boss_victor_nefarius; + pNewScript->pGossipSelect = &GossipSelect_boss_victor_nefarius; + pNewScript->RegisterSelf(); +} diff --git a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_skeram.cpp b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_skeram.cpp index bfbb12ce8..76a31bf34 100644 --- a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_skeram.cpp +++ b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_skeram.cpp @@ -23,11 +23,11 @@ EndScriptData */ #define SPELL_TF_HASTE 2313 #define SPELL_TF_MOD_HEAL 26525 #define SPELL_TF_IMMUNITY 26526 -#define SPELL_TF_CANCEL 26589 +#define SPELL_TF_CANCEL 26589 -#define SPELL_BLINK_1 4801 -#define SPELL_BLINK_2 8195 -#define SPELL_BLINK_3 20449 +#define SPELL_BLINK_0 4801 +#define SPELL_BLINK_1 8195 +#define SPELL_BLINK_2 20449 #define SPELL_SUMMON_IMAGES 747 @@ -287,9 +287,9 @@ struct boss_skeramAI : public ScriptedAI // Blink to one of the three platforms switch (position) { - case 0: caster->CastSpell(caster, SPELL_BLINK_1, true); break; - case 1: caster->CastSpell(caster, SPELL_BLINK_2, true); break; - case 2: caster->CastSpell(caster, SPELL_BLINK_3, true); break; + case 0: caster->CastSpell(caster, SPELL_BLINK_0, true); break; + case 1: caster->CastSpell(caster, SPELL_BLINK_1, true); break; + case 2: caster->CastSpell(caster, SPELL_BLINK_2, true); break; } DoResetThreat();