refactor(Core/Object): adds consistency in the use of type object check (#19671)

This commit is contained in:
Grimdhex
2024-08-25 14:57:37 +02:00
committed by GitHub
parent 61f3a631c3
commit 643362d697
189 changed files with 783 additions and 775 deletions

View File

@@ -360,14 +360,14 @@ class spell_dk_master_of_ghouls : public AuraScript
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
target->ToPlayer()->SetShowDKPet(true);
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
target->ToPlayer()->SetShowDKPet(false);
}
@@ -780,7 +780,7 @@ class spell_dk_pet_scaling : public AuraScript
amount = CalculatePct(std::max<int32>(0, owner->GetTotalAttackPowerValue(BASE_ATTACK)), modifier);
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
if (owner->IsPlayer())
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
}
@@ -1014,7 +1014,7 @@ class spell_dk_blood_boil : public SpellScript
bool Load() override
{
_executed = false;
return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCaster()->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_ABILITY);
return GetCaster()->IsPlayer() && GetCaster()->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_ABILITY);
}
void HandleAfterHit()
@@ -1291,7 +1291,7 @@ class spell_dk_death_grip : public SpellScript
Unit* caster = GetCaster();
Unit* target = GetExplTargetUnit();
if (target->GetTypeId() == TYPEID_PLAYER && caster->GetExactDist(target) < 8.0f) // xinef: should be 8.0f, but we have to add target size (1.5f)
if (target->IsPlayer() && caster->GetExactDist(target) < 8.0f) // xinef: should be 8.0f, but we have to add target size (1.5f)
return SPELL_FAILED_TOO_CLOSE;
if (caster->HasUnitState(UNIT_STATE_JUMPING) || caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING))
@@ -1569,7 +1569,7 @@ class spell_dk_icebound_fortitude : public AuraScript
bool Load() override
{
Unit* caster = GetCaster();
return caster && caster->GetTypeId() == TYPEID_PLAYER;
return caster && caster->IsPlayer();
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
@@ -1881,7 +1881,7 @@ class spell_dk_raise_dead : public SpellScript
{
_result = SPELL_CAST_OK;
_corpse = false;
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
SpellCastResult CheckCast()