aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2015-08-12 12:48:33 +0200
committerjackpoz <giacomopoz@gmail.com>2015-08-12 12:48:33 +0200
commitd243630acff017f5e50bf0c833a0bbac35ba6c5a (patch)
treebbb91e9d7cccb37f4a01e4315bce79187c4b2162 /src/server/game/Spells
parent5f0f152345ec7e9cc6195ba8f59f316a1cad90f7 (diff)
Core/Misc: Remove unneeded ToCreature() casts
Remove some ToCreature() casts not needed anymore after 1ee90e1022a235859316e55356ea8a3d2f456c9b changes that moved IsPet() from Creature to Unit
Diffstat (limited to 'src/server/game/Spells')
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp20
-rw-r--r--src/server/game/Spells/Spell.cpp4
-rw-r--r--src/server/game/Spells/SpellEffects.cpp4
3 files changed, 14 insertions, 14 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 2fe4b624164..9ba7a62e215 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -2799,7 +2799,7 @@ void AuraEffect::HandleModPossessPet(AuraApplication const* aurApp, uint8 mode,
// return;
Unit* target = aurApp->GetTarget();
- if (target->GetTypeId() != TYPEID_UNIT || !target->ToCreature()->IsPet())
+ if (target->GetTypeId() != TYPEID_UNIT || !target->IsPet())
return;
Pet* pet = target->ToPet();
@@ -3464,7 +3464,7 @@ void AuraEffect::HandleAuraModResistance(AuraApplication const* aurApp, uint8 mo
if (GetMiscValue() & int32(1<<x))
{
target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(GetAmount()), apply);
- if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->IsPet())
+ if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
target->ApplyResistanceBuffModsMod(SpellSchools(x), GetAmount() > 0, (float)GetAmount(), apply);
}
}
@@ -3481,7 +3481,7 @@ void AuraEffect::HandleAuraModBaseResistancePCT(AuraApplication const* aurApp, u
if (target->GetTypeId() != TYPEID_PLAYER)
{
//pets only have base armor
- if (target->ToCreature()->IsPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
+ if (target->IsPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
target->HandleStatModifier(UNIT_MOD_ARMOR, BASE_PCT, float(GetAmount()), apply);
}
else
@@ -3518,7 +3518,7 @@ void AuraEffect::HandleModResistancePercent(AuraApplication const* aurApp, uint8
}
}
target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(GetAmount()), apply);
- if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->IsPet())
+ if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
{
target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), true, (float)GetAmount(), apply);
target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), false, (float)GetAmount(), apply);
@@ -3538,7 +3538,7 @@ void AuraEffect::HandleModBaseResistance(AuraApplication const* aurApp, uint8 mo
if (target->GetTypeId() != TYPEID_PLAYER)
{
//only pets have base stats
- if (target->ToCreature()->IsPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
+ if (target->IsPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
target->HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(GetAmount()), apply);
}
else
@@ -3595,13 +3595,13 @@ void AuraEffect::HandleAuraModStat(AuraApplication const* aurApp, uint8 mode, bo
if (spellGroupVal)
{
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(spellGroupVal), !apply);
- if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->IsPet())
+ if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
target->ApplyStatBuffMod(Stats(i), float(spellGroupVal), !apply);
}
//target->ApplyStatMod(Stats(i), m_amount, apply);
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(GetAmount()), apply);
- if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->IsPet())
+ if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
target->ApplyStatBuffMod(Stats(i), (float)GetAmount(), apply);
}
}
@@ -3728,7 +3728,7 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8
if (GetMiscValue() == i || GetMiscValue() == -1) // affect the same stats
{
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(spellGroupVal), !apply);
- if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->IsPet())
+ if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
target->ApplyStatPercentBuffMod(Stats(i), float(spellGroupVal), !apply);
}
}
@@ -3749,12 +3749,12 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8
if (spellGroupVal2)
{
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(spellGroupVal2), !apply);
- if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->IsPet())
+ if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
target->ApplyStatPercentBuffMod(Stats(i), float(spellGroupVal2), !apply);
}
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(GetAmount()), apply);
- if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->IsPet())
+ if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
target->ApplyStatPercentBuffMod(Stats(i), float(GetAmount()), apply);
}
}
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index a8ff36a94b6..9edf07a4fd7 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -3773,7 +3773,7 @@ void Spell::SendSpellStart()
if (m_spellInfo->HasAttribute(SPELL_ATTR0_REQ_AMMO))
castFlags |= CAST_FLAG_AMMO;
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
- (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsPet()))
+ (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->IsPet()))
&& m_spellInfo->PowerType != POWER_HEALTH)
castFlags |= CAST_FLAG_POWER_LEFT_SELF;
@@ -3827,7 +3827,7 @@ void Spell::SendSpellGo()
castFlags |= CAST_FLAG_AMMO; // arrows/bullets visual
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
- (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsPet()))
+ (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->IsPet()))
&& m_spellInfo->PowerType != POWER_HEALTH)
castFlags |= CAST_FLAG_POWER_LEFT_SELF; // should only be sent to self, but the current messaging doesn't make that possible
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 69607b43785..2ede2657dbc 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -441,7 +441,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
// Shadow Bite
else if (m_spellInfo->SpellFamilyFlags[1] & 0x400000)
{
- if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsPet())
+ if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->IsPet())
{
if (Player* owner = m_caster->GetOwner()->ToPlayer())
{
@@ -5718,7 +5718,7 @@ void Spell::EffectRenamePet(SpellEffIndex /*effIndex*/)
return;
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT ||
- !unitTarget->ToCreature()->IsPet() || ((Pet*)unitTarget)->getPetType() != HUNTER_PET)
+ !unitTarget->IsPet() || ((Pet*)unitTarget)->getPetType() != HUNTER_PET)
return;
unitTarget->SetByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED);