aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2014-05-25 11:25:04 +0200
committerjackpoz <giacomopoz@gmail.com>2014-05-25 11:25:04 +0200
commit01b33a67726d04a2862fd079c02fb432e2b9ec9b (patch)
tree39f6fdda1e0c5c00dedc596d805b05f10d37d00c /src
parentc4497e26f34ab764ea8a0ff5f0b1bdbb9cf05b4d (diff)
parentc273f5368a4fbd8f6c42d0b45afb1028ec3b0898 (diff)
Merge pull request #12084 from Trisjdc/pet_combat_2
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))