mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-30 21:57:01 +01:00
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
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user