aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTrisjdc <trisjdc@gmail.com>2014-05-18 11:36:12 +0100
committerTrisjdc <trisjdc@gmail.com>2014-05-18 11:36:12 +0100
commitc273f5368a4fbd8f6c42d0b45afb1028ec3b0898 (patch)
treef60a39f2e54f09124b88b25888291ef79561450c /src
parentfce80ffa6e0d719c2f7a3ce954dcab491b015541 (diff)
Core/Spells: Players with active pets count as if they were players in combat against spells with SPELL_ATTR1_CANT_TARGET_IN_COMBAT
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Spells/SpellInfo.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 21c36510a32..ba4c3deca85 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -24,6 +24,7 @@
#include "Player.h"
#include "Battleground.h"
#include "Vehicle.h"
+#include "Pet.h"
uint32 GetTargetFlagMask(SpellTargetObjectTypes objType)
{
@@ -1505,8 +1506,16 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
// creature/player specific target checks
if (unitTarget)
{
- if (AttributesEx & SPELL_ATTR1_CANT_TARGET_IN_COMBAT && unitTarget->IsInCombat())
- return SPELL_FAILED_TARGET_AFFECTING_COMBAT;
+ if (AttributesEx & SPELL_ATTR1_CANT_TARGET_IN_COMBAT)
+ {
+ if (unitTarget->IsInCombat())
+ return SPELL_FAILED_TARGET_AFFECTING_COMBAT;
+ // player with active pet counts as a player in combat
+ else if (Player const* player = unitTarget->ToPlayer())
+ if (Pet* pet = player->GetPet())
+ if (pet->GetVictim() && !pet->HasUnitState(UNIT_STATE_CONTROLLED))
+ return SPELL_FAILED_TARGET_AFFECTING_COMBAT;
+ }
// only spells with SPELL_ATTR3_ONLY_TARGET_GHOSTS can target ghosts
if (((AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_GHOSTS) != 0) != unitTarget->HasAuraType(SPELL_AURA_GHOST))