mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 19:05:42 +00:00
refactor(Core/Object): adds consistency in the use of type object check (#19671)
This commit is contained in:
@@ -1784,7 +1784,7 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
|
||||
|
||||
if (caster != unitTarget)
|
||||
{
|
||||
if (caster->GetTypeId() == TYPEID_PLAYER)
|
||||
if (caster->IsPlayer())
|
||||
{
|
||||
// Do not allow these spells to target creatures not tapped by us (Banish, Polymorph, many quest spells)
|
||||
if (AttributesEx2 & SPELL_ATTR2_CANNOT_CAST_ON_TAPPED)
|
||||
@@ -1880,14 +1880,14 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
|
||||
|
||||
if (!CheckTargetCreatureType(unitTarget))
|
||||
{
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
if (target->IsPlayer())
|
||||
return SPELL_FAILED_TARGET_IS_PLAYER;
|
||||
else
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
}
|
||||
|
||||
// check GM mode and GM invisibility - only for player casts (npc casts are controlled by AI) and negative spells
|
||||
if (unitTarget != caster && (caster->IsControlledByPlayer() || !IsPositive()) && unitTarget->GetTypeId() == TYPEID_PLAYER)
|
||||
if (unitTarget != caster && (caster->IsControlledByPlayer() || !IsPositive()) && unitTarget->IsPlayer())
|
||||
{
|
||||
if (!unitTarget->ToPlayer()->IsVisible())
|
||||
return SPELL_FAILED_BM_OR_INVISGOD;
|
||||
@@ -1974,7 +1974,7 @@ bool SpellInfo::CheckTargetCreatureType(Unit const* target) const
|
||||
if (SpellFamilyName == SPELLFAMILY_WARLOCK && GetCategory() == 1179)
|
||||
{
|
||||
// not allow cast at player
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
if (target->IsPlayer())
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user