aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/CoreAI/CombatAI.cpp2
-rw-r--r--src/server/game/AI/CoreAI/PetAI.cpp10
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp2
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp2
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp2
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp10
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp8
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp6
-rw-r--r--src/server/game/Entities/Unit/Unit.h6
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp2
-rw-r--r--src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp2
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp2
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp2
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp2
-rw-r--r--src/server/scripts/Kalimdor/zone_tanaris.cpp2
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp2
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp2
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp2
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp4
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_illidan.cpp10
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp6
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp2
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp4
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp2
-rw-r--r--src/server/scripts/Pet/pet_hunter.cpp2
36 files changed, 67 insertions, 61 deletions
diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp
index 943919451a9..32b229a5ea8 100644
--- a/src/server/game/AI/CoreAI/CombatAI.cpp
+++ b/src/server/game/AI/CoreAI/CombatAI.cpp
@@ -151,7 +151,7 @@ void CasterAI::UpdateAI(uint32 diff)
events.Update(diff);
- if (me->GetVictim()->HasBreakableByDamageCrowdControlAura(me))
+ if (me->EnsureVictim()->HasBreakableByDamageCrowdControlAura(me))
{
me->InterruptNonMeleeSpells(false);
return;
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index d6e749b942a..e2eeaf880ad 100644
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -86,10 +86,10 @@ void PetAI::UpdateAI(uint32 diff)
else
m_updateAlliesTimer -= diff;
- if (me->GetVictim() && me->GetVictim()->IsAlive())
+ if (me->GetVictim() && me->EnsureVictim()->IsAlive())
{
// is only necessary to stop casting, the pet must not exit combat
- if (me->GetVictim()->HasBreakableByDamageCrowdControlAura(me))
+ if (me->EnsureVictim()->HasBreakableByDamageCrowdControlAura(me))
{
me->InterruptNonMeleeSpells(false);
return;
@@ -345,7 +345,7 @@ void PetAI::OwnerAttackedBy(Unit* attacker)
return;
// Prevent pet from disengaging from current target
- if (me->GetVictim() && me->GetVictim()->IsAlive())
+ if (me->GetVictim() && me->EnsureVictim()->IsAlive())
return;
// Continue to evaluate and attack if necessary
@@ -366,7 +366,7 @@ void PetAI::OwnerAttacked(Unit* target)
return;
// Prevent pet from disengaging from current target
- if (me->GetVictim() && me->GetVictim()->IsAlive())
+ if (me->GetVictim() && me->EnsureVictim()->IsAlive())
return;
// Continue to evaluate and attack if necessary
@@ -627,7 +627,7 @@ void PetAI::AttackedBy(Unit* attacker)
return;
// Prevent pet from disengaging from current target
- if (me->GetVictim() && me->GetVictim()->IsAlive())
+ if (me->GetVictim() && me->EnsureVictim()->IsAlive())
return;
// Continue to evaluate and attack if necessary
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index dcf5bd56fa6..43596ffb4cb 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -77,7 +77,7 @@ bool npc_escortAI::AssistPlayerInCombat(Unit* who)
return false;
//not a player
- if (!who->GetVictim()->GetCharmerOrOwnerPlayerOrPlayerItself())
+ if (!who->EnsureVictim()->GetCharmerOrOwnerPlayerOrPlayerItself())
return false;
//never attack friendly
diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
index 0fbfc2cebac..df6bee51642 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
@@ -74,7 +74,7 @@ bool FollowerAI::AssistPlayerInCombat(Unit* who)
return false;
//not a player
- if (!who->GetVictim()->GetCharmerOrOwnerPlayerOrPlayerItself())
+ if (!who->EnsureVictim()->GetCharmerOrOwnerPlayerOrPlayerItself())
return false;
//never attack friendly
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 23dea877776..3b055cabbfa 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -499,7 +499,7 @@ bool SmartAI::AssistPlayerInCombat(Unit* who)
return false;
//not a player
- if (!who->GetVictim()->GetCharmerOrOwnerPlayerOrPlayerItself())
+ if (!who->EnsureVictim()->GetCharmerOrOwnerPlayerOrPlayerItself())
return false;
//never attack friendly
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 006ee4b69ad..d2562459522 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -2690,9 +2690,9 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
}
case SMART_EVENT_TARGET_HEALTH_PCT:
{
- if (!me || !me->IsInCombat() || !me->GetVictim() || !me->GetVictim()->GetMaxHealth())
+ if (!me || !me->IsInCombat() || !me->GetVictim() || !me->EnsureVictim()->GetMaxHealth())
return;
- uint32 perc = (uint32)me->GetVictim()->GetHealthPct();
+ uint32 perc = (uint32)me->EnsureVictim()->GetHealthPct();
if (perc > e.event.minMaxRepeat.max || perc < e.event.minMaxRepeat.min)
return;
ProcessTimedAction(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax, me->GetVictim());
@@ -2710,9 +2710,9 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
}
case SMART_EVENT_TARGET_MANA_PCT:
{
- if (!me || !me->IsInCombat() || !me->GetVictim() || !me->GetVictim()->GetMaxPower(POWER_MANA))
+ if (!me || !me->IsInCombat() || !me->GetVictim() || !me->EnsureVictim()->GetMaxPower(POWER_MANA))
return;
- uint32 perc = uint32(100.0f * me->GetVictim()->GetPower(POWER_MANA) / me->GetVictim()->GetMaxPower(POWER_MANA));
+ uint32 perc = uint32(100.0f * me->EnsureVictim()->GetPower(POWER_MANA) / me->EnsureVictim()->GetMaxPower(POWER_MANA));
if (perc > e.event.minMaxRepeat.max || perc < e.event.minMaxRepeat.min)
return;
ProcessTimedAction(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax, me->GetVictim());
@@ -2792,7 +2792,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
{
if (!me || !me->GetVictim())
return;
- uint32 count = me->GetVictim()->GetAuraCount(e.event.aura.spell);
+ uint32 count = me->EnsureVictim()->GetAuraCount(e.event.aura.spell);
if (count < e.event.aura.count)
return;
ProcessTimedAction(e, e.event.aura.repeatMin, e.event.aura.repeatMax);
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 40a09114935..926527e2bd9 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -563,8 +563,8 @@ void Creature::Update(uint32 diff)
break;
bool bInCombat = IsInCombat() && (!GetVictim() || // if IsInCombat() is true and this has no victim
- !GetVictim()->GetCharmerOrOwnerPlayerOrPlayerItself() || // or the victim/owner/charmer is not a player
- !GetVictim()->GetCharmerOrOwnerPlayerOrPlayerItself()->IsGameMaster()); // or the victim/owner/charmer is not a GameMaster
+ !EnsureVictim()->GetCharmerOrOwnerPlayerOrPlayerItself() || // or the victim/owner/charmer is not a player
+ !EnsureVictim()->GetCharmerOrOwnerPlayerOrPlayerItself()->IsGameMaster()); // or the victim/owner/charmer is not a GameMaster
/*if (m_regenTimer <= diff)
{*/
@@ -691,7 +691,7 @@ void Creature::DoFleeToGetAssistance()
UpdateSpeed(MOVE_RUN, false);
if (!creature)
- //SetFeared(true, GetVictim()->GetGUID(), 0, sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY));
+ //SetFeared(true, EnsureVictim()->GetGUID(), 0, sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY));
/// @todo use 31365
SetControlled(true, UNIT_STATE_FLEEING);
else
@@ -1852,7 +1852,7 @@ void Creature::CallAssistance()
if (!assistList.empty())
{
- AssistDelayEvent* e = new AssistDelayEvent(GetVictim()->GetGUID(), *this);
+ AssistDelayEvent* e = new AssistDelayEvent(EnsureVictim()->GetGUID(), *this);
while (!assistList.empty())
{
// Pushing guids because in delay can happen some creature gets despawned => invalid pointer
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index a00a9596f91..6b017d8dc9d 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -13894,7 +13894,7 @@ void Unit::SetStunned(bool apply)
else
{
if (IsAlive() && GetVictim())
- SetTarget(GetVictim()->GetGUID());
+ SetTarget(EnsureVictim()->GetGUID());
// don't remove UNIT_FLAG_STUNNED for pet when owner is mounted (disabled pet's interface)
Unit* owner = GetOwner();
@@ -13949,7 +13949,7 @@ void Unit::SetFeared(bool apply)
if (GetMotionMaster()->GetCurrentMovementGeneratorType() == FLEEING_MOTION_TYPE)
GetMotionMaster()->MovementExpired();
if (GetVictim())
- SetTarget(GetVictim()->GetGUID());
+ SetTarget(EnsureVictim()->GetGUID());
}
}
@@ -13971,7 +13971,7 @@ void Unit::SetConfused(bool apply)
if (GetMotionMaster()->GetCurrentMovementGeneratorType() == CONFUSED_MOTION_TYPE)
GetMotionMaster()->MovementExpired();
if (GetVictim())
- SetTarget(GetVictim()->GetGUID());
+ SetTarget(EnsureVictim()->GetGUID());
}
}
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 0225975223a..886295d1f1d 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1345,6 +1345,12 @@ class Unit : public WorldObject
AttackerSet const& getAttackers() const { return m_attackers; }
bool isAttackingPlayer() const;
Unit* GetVictim() const { return m_attacking; }
+ // Use this only when 100% sure there is a victim
+ Unit* EnsureVictim() const
+ {
+ ASSERT(m_attacking);
+ return m_attacking;
+ }
void CombatStop(bool includingCast = false);
void CombatStopWithPets(bool includingCast = false);
diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
index 61f3a04bc5d..2ab408965c1 100755
--- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
@@ -118,7 +118,7 @@ void ConfusedMovementGenerator<Creature>::DoFinalize(Creature* unit)
unit->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED);
unit->ClearUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_CONFUSED_MOVE);
if (unit->GetVictim())
- unit->SetTarget(unit->GetVictim()->GetGUID());
+ unit->SetTarget(unit->EnsureVictim()->GetGUID());
}
template void ConfusedMovementGenerator<Player>::DoInitialize(Player*);
diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
index 572d65b07c7..a34d09c3721 100644
--- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
@@ -141,7 +141,7 @@ void FleeingMovementGenerator<Creature>::DoFinalize(Creature* owner)
owner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
owner->ClearUnitState(UNIT_STATE_FLEEING|UNIT_STATE_FLEEING_MOVE);
if (owner->GetVictim())
- owner->SetTarget(owner->GetVictim()->GetGUID());
+ owner->SetTarget(owner->EnsureVictim()->GetGUID());
}
template<class T>
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index b958adb0d6d..a4210d2dad5 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -5338,12 +5338,12 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
{
// Feeding Frenzy Rank 1
case 53511:
- if (target->GetVictim() && target->GetVictim()->HealthBelowPct(35))
+ if (target->GetVictim() && target->EnsureVictim()->HealthBelowPct(35))
target->CastSpell(target, 60096, true, 0, this);
return;
// Feeding Frenzy Rank 2
case 53512:
- if (target->GetVictim() && target->GetVictim()->HealthBelowPct(35))
+ if (target->GetVictim() && target->EnsureVictim()->HealthBelowPct(35))
target->CastSpell(target, 60097, true, 0, this);
return;
default:
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp
index b1bc34b0437..eda2dbbcdaa 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp
@@ -138,7 +138,7 @@ public:
break;
case EVENT_CONFLAGRATION:
DoCastVictim(SPELL_CONFLAGRATION);
- if (me->GetVictim() && me->GetVictim()->HasAura(SPELL_CONFLAGRATION))
+ if (me->GetVictim() && me->EnsureVictim()->HasAura(SPELL_CONFLAGRATION))
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true))
me->TauntApply(target);
events.ScheduleEvent(EVENT_CONFLAGRATION, 30000);
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp
index 71c4a7469d9..6a2d76764be 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp
@@ -200,7 +200,7 @@ public:
break;
case EVENT_BURNINGADRENALINE_TANK:
// have the victim cast the spell on himself otherwise the third effect aura will be applied to Vael instead of the player
- me->GetVictim()->CastSpell(me->GetVictim(), SPELL_BURNINGADRENALINE, true);
+ me->EnsureVictim()->CastSpell(me->GetVictim(), SPELL_BURNINGADRENALINE, true);
events.ScheduleEvent(EVENT_BURNINGADRENALINE_TANK, 45000);
break;
}
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
index 14cc3083d59..0387d7b776b 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
@@ -191,7 +191,7 @@ public:
if (pAttumen->GetVictim())
{
pAttumen->GetMotionMaster()->MoveChase(pAttumen->GetVictim());
- pAttumen->SetTarget(pAttumen->GetVictim()->GetGUID());
+ pAttumen->SetTarget(pAttumen->EnsureVictim()->GetGUID());
}
pAttumen->SetObjectScale(1);
}
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
index bde326a5c37..209154ec5f9 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
@@ -391,8 +391,8 @@ public:
if (me->HasUnitState(UNIT_STATE_STUNNED)) // While shifting to phase 2 malchezaar stuns himself
return;
- if (me->GetUInt64Value(UNIT_FIELD_TARGET) != me->GetVictim()->GetGUID())
- me->SetTarget(me->GetVictim()->GetGUID());
+ if (me->GetUInt64Value(UNIT_FIELD_TARGET) != me->EnsureVictim()->GetGUID())
+ me->SetTarget(me->EnsureVictim()->GetGUID());
if (phase == 1)
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
index 96386462c44..1bba7f02828 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
@@ -484,10 +484,10 @@ public:
EnterEvadeMode();
return;
}
- else if (me->GetVictim()->GetTypeId() == TYPEID_PLAYER && me->GetVictim()->HealthBelowPct(10))
+ else if (me->EnsureVictim()->GetTypeId() == TYPEID_PLAYER && me->EnsureVictim()->HealthBelowPct(10))
{
- me->GetVictim()->CastSpell(me->GetVictim(), 7267, true); // beg
- me->GetVictim()->RemoveGameObject(SPELL_DUEL_FLAG, true);
+ me->EnsureVictim()->CastSpell(me->GetVictim(), 7267, true); // beg
+ me->EnsureVictim()->RemoveGameObject(SPELL_DUEL_FLAG, true);
EnterEvadeMode();
return;
}
@@ -837,7 +837,7 @@ public:
//ScriptedAI::UpdateAI(diff);
//Check if we have a current target
- if (me->GetVictim()->GetEntry() == NPC_GHOSTS)
+ if (me->EnsureVictim()->GetEntry() == NPC_GHOSTS)
{
if (me->isAttackReady())
{
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
index 46bd5bcbfdc..a03455f6213 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
@@ -298,7 +298,7 @@ public:
Unit* target = (*itr)->getTarget();
if (target
&& target->GetTypeId() == TYPEID_PLAYER
- && target->GetGUID() != me->GetVictim()->GetGUID()
+ && target->GetGUID() != me->EnsureVictim()->GetGUID()
&& target->GetPositionZ() > me->GetPositionZ() - 5
&& !target->HasAura(AURA_SPECTRAL_EXHAUSTION))
{
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
index e8b112aa1cd..5a2c23d1c0f 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
@@ -1255,7 +1255,7 @@ public:
if ((victimClass == 0) && me->GetVictim())
{
- victimClass = me->GetVictim()->getClass();
+ victimClass = me->EnsureVictim()->getClass();
switch (victimClass)
{
case CLASS_DRUID:
diff --git a/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp b/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp
index 6cfef015450..8dd8d8a2c65 100644
--- a/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp
@@ -100,7 +100,7 @@ public:
if (me->IsInCombat() && me->GetVictim())
{
- if (Player* player = me->GetVictim()->ToPlayer())
+ if (Player* player = me->EnsureVictim()->ToPlayer())
{
if (player->GetTeam() == HORDE)
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
index cbace6df028..bfe4db137f3 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
@@ -1351,7 +1351,7 @@ public:
if (MoveTimer <= diff)
{
float x, y, z;
- me->GetVictim()->GetPosition(x, y, z);
+ me->EnsureVictim()->GetPosition(x, y, z);
me->GetMotionMaster()->MovePoint(0, x, y, z+Zpos);
Zpos -= 1.0f;
if (Zpos <= 0)
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp
index a12a400ea8e..0af42f5af20 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp
@@ -157,7 +157,7 @@ class boss_ayamiss : public CreatureScript
SetCombatMovement(true);
me->SetCanFly(false);
Position VictimPos;
- me->GetVictim()->GetPosition(&VictimPos);
+ me->EnsureVictim()->GetPosition(&VictimPos);
me->GetMotionMaster()->MovePoint(POINT_GROUND, VictimPos);
DoResetThreat();
events.ScheduleEvent(EVENT_LASH, urand(5000, 8000));
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
index 44c70075a94..7038dd0df46 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
@@ -272,7 +272,7 @@ class npc_glob_of_viscidus : public CreatureScript
if (Viscidus->IsAlive() && Viscidus->GetHealthPct() < 5.0f)
{
Viscidus->SetVisible(true);
- Viscidus->GetVictim()->Kill(Viscidus);
+ Viscidus->EnsureVictim()->Kill(Viscidus);
}
else
{
diff --git a/src/server/scripts/Kalimdor/zone_tanaris.cpp b/src/server/scripts/Kalimdor/zone_tanaris.cpp
index 3269bfb77db..d73c73cc2fa 100644
--- a/src/server/scripts/Kalimdor/zone_tanaris.cpp
+++ b/src/server/scripts/Kalimdor/zone_tanaris.cpp
@@ -120,7 +120,7 @@ public:
{
if (SendItemTimer <= diff)
{
- if (me->GetVictim()->GetTypeId() == TYPEID_PLAYER)
+ if (me->EnsureVictim()->GetTypeId() == TYPEID_PLAYER)
SendItem(me->GetVictim());
SendItemTimer = 5000;
} else SendItemTimer -= diff;
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
index ee27a1524f0..ef96526aa16 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
@@ -198,8 +198,8 @@ uint8 const MAX_CORPOREALITY_STATE = 11;
struct CorporealityEntry
{
- uint32 materialRealmSpell;
uint32 twilightRealmSpell;
+ uint32 materialRealmSpell;
};
CorporealityEntry const _corporealityReference[MAX_CORPOREALITY_STATE] = {
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp
index bbf3e8afc0f..197a4fc5414 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp
@@ -374,7 +374,7 @@ class boss_blood_queen_lana_thel : public CreatureScript
// both spells have SPELL_ATTR5_SINGLE_TARGET_SPELL, no manual removal needed
newOfftank->CastSpell(me->GetVictim(), SPELL_BLOOD_MIRROR_DAMAGE, true);
- me->GetVictim()->CastSpell(newOfftank, SPELL_BLOOD_MIRROR_DUMMY, true);
+ me->EnsureVictim()->CastSpell(newOfftank, SPELL_BLOOD_MIRROR_DUMMY, true);
DoCastVictim(SPELL_BLOOD_MIRROR_VISUAL);
if (Is25ManRaid() && newOfftank->GetQuestStatus(QUEST_BLOOD_INFUSION) == QUEST_STATUS_INCOMPLETE &&
newOfftank->HasAura(SPELL_UNSATED_CRAVING) && !newOfftank->HasAura(SPELL_THIRST_QUENCHED) &&
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
index bcb6d746622..10db26ccd0c 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
@@ -890,7 +890,7 @@ class npc_darnavan : public CreatureScript
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
- if (_canShatter && me->GetVictim() && me->GetVictim()->IsImmunedToDamage(SPELL_SCHOOL_MASK_NORMAL))
+ if (_canShatter && me->GetVictim() && me->EnsureVictim()->IsImmunedToDamage(SPELL_SCHOOL_MASK_NORMAL))
{
DoCastVictim(SPELL_SHATTERING_THROW);
_canShatter = false;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
index d33d218fab9..e586feb1070 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
@@ -136,7 +136,7 @@ public:
}
}
- if (me->GetVictim() && me->GetVictim()->GetEntry() == NPC_ZOMBIE)
+ if (me->GetVictim() && me->EnsureVictim()->GetEntry() == NPC_ZOMBIE)
{
if (me->IsWithinMeleeRange(me->GetVictim()))
{
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
index 8cc198a0d84..2803cccead3 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
@@ -231,7 +231,7 @@ class boss_urom : public CreatureScript
if (arcaneExplosionTimer <= diff)
{
Position pos;
- me->GetVictim()->GetPosition(&pos);
+ me->EnsureVictim()->GetPosition(&pos);
me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
me->GetMotionMaster()->MoveChase(me->GetVictim());
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
index 578a51fa1f8..c199fe9e9e3 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
@@ -199,10 +199,10 @@ class npc_flash_freeze : public CreatureScript
void UpdateAI(uint32 diff) OVERRIDE
{
- if (!UpdateVictim() || me->GetVictim()->HasAura(SPELL_BLOCK_OF_ICE) || me->GetVictim()->HasAura(SPELL_FLASH_FREEZE_HELPER))
+ if (!UpdateVictim() || me->EnsureVictim()->HasAura(SPELL_BLOCK_OF_ICE) || me->EnsureVictim()->HasAura(SPELL_FLASH_FREEZE_HELPER))
return;
- if (me->GetVictim()->GetGUID() != targetGUID || instance->GetBossState(BOSS_HODIR) != IN_PROGRESS)
+ if (me->EnsureVictim()->GetGUID() != targetGUID || instance->GetBossState(BOSS_HODIR) != IN_PROGRESS)
me->DespawnOrUnsummon();
if (checkDespawnTimer <= diff)
diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
index d74aecb9b25..957471216d8 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
@@ -2077,12 +2077,12 @@ public:
if (!UpdateVictim())
return;
- if (me->GetVictim()->GetTypeId() != TYPEID_PLAYER)
+ if (me->EnsureVictim()->GetTypeId() != TYPEID_PLAYER)
return; // Only cast the below on players.
- if (!me->GetVictim()->HasAura(SPELL_PARALYZE))
+ if (!me->EnsureVictim()->HasAura(SPELL_PARALYZE))
{
- TargetGUID = me->GetVictim()->GetGUID();
+ TargetGUID = me->EnsureVictim()->GetGUID();
me->AddThreat(me->GetVictim(), 10000000.0f);
DoCastVictim(SPELL_PURPLE_BEAM, true);
DoCastVictim(SPELL_PARALYZE, true);
@@ -2154,8 +2154,8 @@ public:
{
if (me->isAttackReady() && me->IsWithinMeleeRange(me->GetVictim()))
{
- if (!me->GetVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND)
- && !me->GetVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND2))
+ if (!me->EnsureVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND)
+ && !me->EnsureVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND2))
{
if (Creature* illidan = Unit::GetCreature((*me), IllidanGUID))// summon only in 1. phase
if (CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->Phase == PHASE_NORMAL)
diff --git a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
index d92d8aaf5db..d86d94088da 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
@@ -673,17 +673,17 @@ public:
if (!CheckedAggro)
{
- AggroTargetGUID = me->GetVictim()->GetGUID();
+ AggroTargetGUID = me->EnsureVictim()->GetGUID();
CheckedAggro = true;
}
if (CheckTankTimer <= diff)
{
- if (me->GetVictim()->GetGUID() != AggroTargetGUID)
+ if (me->EnsureVictim()->GetGUID() != AggroTargetGUID)
{
Talk(ANGER_SAY_BEFORE);
DoCast(me, SPELL_SELF_SEETHE, true);
- AggroTargetGUID = me->GetVictim()->GetGUID();
+ AggroTargetGUID = me->EnsureVictim()->GetGUID();
}
CheckTankTimer = 2000;
} else CheckTankTimer -= diff;
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
index 9055bb1862d..490bfaa16fc 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
@@ -626,7 +626,7 @@ public:
{
DoCastVictim(SPELL_TIDAL_SURGE);
// Hacky way to do it - won't trigger elseways
- me->GetVictim()->CastSpell(me->GetVictim(), SPELL_TIDAL_SURGE_FREEZE, true);
+ me->EnsureVictim()->CastSpell(me->GetVictim(), SPELL_TIDAL_SURGE_FREEZE, true);
TidalSurge_Timer = 15000+rand()%5000;
} else TidalSurge_Timer -= diff;
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp
index f9370b44c20..73da4f62a23 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp
@@ -138,7 +138,7 @@ public:
if (!UpdateVictim())
return;
- if (me->GetVictim()->GetGUID() != victimGUID)
+ if (me->EnsureVictim()->GetGUID() != victimGUID)
{
DoModifyThreatPercent(me->GetVictim(), -100);
Unit* owner = Unit::GetUnit(*me, victimGUID);
@@ -519,7 +519,7 @@ public:
for (ThreatContainer::StorageType::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr)
{
Unit* tempTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid());
- if (tempTarget && tempTarget->GetTypeId() == TYPEID_PLAYER && tempTarget->GetGUID() != me->GetVictim()->GetGUID() && TargetList.size()<5)
+ if (tempTarget && tempTarget->GetTypeId() == TYPEID_PLAYER && tempTarget->GetGUID() != me->EnsureVictim()->GetGUID() && TargetList.size()<5)
TargetList.push_back(tempTarget);
}
//SpellInfo* spell = GET_SPELL(SPELL_INSIDIOUS_WHISPER);
diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
index 7b83fa7009d..500bcd1ed8f 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
@@ -115,7 +115,7 @@ class npc_warp_splinter_treant : public CreatureScript
return;
}
- if (me->GetVictim()->GetGUID() != WarpGuid)
+ if (me->EnsureVictim()->GetGUID() != WarpGuid)
DoMeleeAttackIfReady();
}
};
diff --git a/src/server/scripts/Pet/pet_hunter.cpp b/src/server/scripts/Pet/pet_hunter.cpp
index 8a0b78b5478..c8dfc582bb7 100644
--- a/src/server/scripts/Pet/pet_hunter.cpp
+++ b/src/server/scripts/Pet/pet_hunter.cpp
@@ -96,7 +96,7 @@ class npc_pet_hunter_snake_trap : public CreatureScript
if (!UpdateVictim())
return;
- if (me->GetVictim()->HasBreakableByDamageCrowdControlAura(me))
+ if (me->EnsureVictim()->HasBreakableByDamageCrowdControlAura(me))
{
me->InterruptNonMeleeSpells(false);
return;