Core/Pets: Fixed flashing pet attack button (#18906)

(cherrypicked from 0fa38d0ae0)
This commit is contained in:
xinef1
2017-02-04 19:38:36 +01:00
committed by Shauren
parent 2dcc2d0f05
commit d1cbd8a837
5 changed files with 35 additions and 24 deletions

View File

@@ -2046,16 +2046,9 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
// creature/player specific target checks
if (unitTarget)
{
if (HasAttribute(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;
}
// spells cannot be cast if player is in fake combat also
if (HasAttribute(SPELL_ATTR1_CANT_TARGET_IN_COMBAT) && (unitTarget->IsInCombat() || unitTarget->IsPetInCombat()))
return SPELL_FAILED_TARGET_AFFECTING_COMBAT;
// only spells with SPELL_ATTR3_ONLY_TARGET_GHOSTS can target ghosts
if (HasAttribute(SPELL_ATTR3_ONLY_TARGET_GHOSTS) != unitTarget->HasAuraType(SPELL_AURA_GHOST))