Core/Misc: Remove unneeded ToCreature() casts
Remove some ToCreature() casts not needed anymore after 1ee90e1022 changes that moved IsPet(), IsTotem(), IsSummon(), IsGuardian(), IsHunterPet() and IsVehicle() from Creature to Unit
This commit is contained in:
1 parent
d243630acf
commit
ea4d9c0d9e
7 files changed
+23
-23
No files matched your search
@@ -2705,7 +2705,7 @@ float Unit::GetUnitDodgeChance() const
|
||||
return GetFloatValue(PLAYER_DODGE_PERCENTAGE);
|
||||
else
|
||||
{
|
||||
if (ToCreature()->IsTotem())
|
||||
if (IsTotem())
|
||||
return 0.0f;
|
||||
else
|
||||
{
|
||||
@@ -2780,7 +2780,7 @@ float Unit::GetUnitBlockChance() const
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ToCreature()->IsTotem())
|
||||
if (IsTotem())
|
||||
return 0.0f;
|
||||
else
|
||||
{
|
||||
@@ -3485,7 +3485,7 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMo
|
||||
ASSERT(!aurApp->GetEffectMask());
|
||||
|
||||
// Remove totem at next update if totem loses its aura
|
||||
if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE && GetTypeId() == TYPEID_UNIT && ToCreature()->IsTotem())
|
||||
if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE && GetTypeId() == TYPEID_UNIT && IsTotem())
|
||||
{
|
||||
if (ToTotem()->GetSpell() == aura->GetId() && ToTotem()->GetTotemType() == TOTEM_PASSIVE)
|
||||
ToTotem()->setDeathState(JUST_DIED);
|
||||
@@ -9473,7 +9473,7 @@ void Unit::GetAllMinionsByEntry(std::list<Creature*>& Minions, uint32 entry)
|
||||
Unit* unit = *itr;
|
||||
++itr;
|
||||
if (unit->GetEntry() == entry && unit->GetTypeId() == TYPEID_UNIT
|
||||
&& unit->ToCreature()->IsSummon()) // minion, actually
|
||||
&& unit->IsSummon()) // minion, actually
|
||||
Minions.push_back(unit->ToCreature());
|
||||
}
|
||||
}
|
||||
@@ -9485,7 +9485,7 @@ void Unit::RemoveAllMinionsByEntry(uint32 entry)
|
||||
Unit* unit = *itr;
|
||||
++itr;
|
||||
if (unit->GetEntry() == entry && unit->GetTypeId() == TYPEID_UNIT
|
||||
&& unit->ToCreature()->IsSummon()) // minion, actually
|
||||
&& unit->IsSummon()) // minion, actually
|
||||
unit->ToTempSummon()->UnSummon();
|
||||
// i think this is safe because i have never heard that a despawned minion will trigger a same minion
|
||||
}
|
||||
@@ -9585,7 +9585,7 @@ int32 Unit::DealHeal(Unit* victim, uint32 addhealth)
|
||||
|
||||
Unit* unit = this;
|
||||
|
||||
if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsTotem())
|
||||
if (GetTypeId() == TYPEID_UNIT && IsTotem())
|
||||
unit = GetOwner();
|
||||
|
||||
if (Player* player = unit->ToPlayer())
|
||||
@@ -9876,7 +9876,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
|
||||
return pdamage;
|
||||
|
||||
// For totems get damage bonus from owner
|
||||
if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsTotem())
|
||||
if (GetTypeId() == TYPEID_UNIT && IsTotem())
|
||||
if (Unit* owner = GetOwner())
|
||||
return owner->SpellDamageBonusDone(victim, spellProto, pdamage, damagetype);
|
||||
|
||||
@@ -10007,7 +10007,7 @@ float Unit::SpellDamagePctDone(Unit* victim, SpellInfo const* spellProto, Damage
|
||||
return 1.0f;
|
||||
|
||||
// For totems pct done mods are calculated when its calculation is run on the player in SpellDamageBonusDone.
|
||||
if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsTotem())
|
||||
if (GetTypeId() == TYPEID_UNIT && IsTotem())
|
||||
return 1.0f;
|
||||
|
||||
// Done total percent damage auras
|
||||
@@ -12570,7 +12570,7 @@ bool Unit::CanHaveThreatList(bool skipAliveCheck) const
|
||||
return false;
|
||||
|
||||
// totems can not have threat list
|
||||
if (ToCreature()->IsTotem())
|
||||
if (IsTotem())
|
||||
return false;
|
||||
|
||||
// vehicles can not have threat list
|
||||
@@ -14518,7 +14518,7 @@ Player* Unit::GetSpellModOwner() const
|
||||
if (Player* player = const_cast<Unit*>(this)->ToPlayer())
|
||||
return player;
|
||||
|
||||
if (IsPet() || ToCreature()->IsTotem())
|
||||
if (IsPet() || IsTotem())
|
||||
{
|
||||
if (Unit* owner = GetOwner())
|
||||
if (Player* player = owner->ToPlayer())
|
||||
@@ -16057,7 +16057,7 @@ void Unit::RemoveCharmedBy(Unit* charmer)
|
||||
// a guardian should always have charminfo
|
||||
if (playerCharmer && this != charmer->GetFirstControlled())
|
||||
playerCharmer->SendRemoveControlBar();
|
||||
else if (GetTypeId() == TYPEID_PLAYER || (GetTypeId() == TYPEID_UNIT && !ToCreature()->IsGuardian()))
|
||||
else if (GetTypeId() == TYPEID_PLAYER || (GetTypeId() == TYPEID_UNIT && !IsGuardian()))
|
||||
DeleteCharmInfo();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user