diff options
| author | jackpoz <giacomopoz@gmail.com> | 2015-08-12 12:48:33 +0200 |
|---|---|---|
| committer | Carbenium <carbenium@outlook.com> | 2015-09-24 21:04:46 +0200 |
| commit | cacf1848226f69bb4bbd9f5418619b1ed1271305 (patch) | |
| tree | a9da9d0214789e02e7e6a540b54ccd2c55fc9ec5 /src/server/game/Entities/Unit | |
| parent | 6193b8a28d88428acc46dc591353614ef1f3e160 (diff) | |
Core/Misc: Remove unneeded ToCreature() casts
Remove some ToCreature() casts not needed anymore after 1ee90e1022a235859316e55356ea8a3d2f456c9b changes that moved IsPet() from Creature to Unit
(cherry picked from commit d243630acff017f5e50bf0c833a0bbac35ba6c5a)
Conflicts:
src/server/game/Entities/Player/Player.cpp
src/server/game/Spells/Spell.cpp
src/server/game/Spells/SpellEffects.cpp
Diffstat (limited to 'src/server/game/Entities/Unit')
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 30b0be54b25..8524535f58c 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -368,7 +368,7 @@ void Unit::Update(uint32 p_time) SendThreatListUpdate(); // update combat timer only for players and pets (only pets with PetAI) - if (IsInCombat() && (GetTypeId() == TYPEID_PLAYER || (ToCreature()->IsPet() && IsControlledByPlayer()))) + if (IsInCombat() && (GetTypeId() == TYPEID_PLAYER || (IsPet() && IsControlledByPlayer()))) { // Check UNIT_STATE_MELEE_ATTACKING or UNIT_STATE_CHASE (without UNIT_STATE_FOLLOW in this case) so pets can reach far away // targets without stopping half way there and running off. @@ -2047,8 +2047,8 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT // Max 40% chance to score a glancing blow against mobs that are higher level (can do only players and pets and not with ranged weapon) if (attType != RANGED_ATTACK && - (GetTypeId() == TYPEID_PLAYER || ToCreature()->IsPet()) && - victim->GetTypeId() != TYPEID_PLAYER && !victim->ToCreature()->IsPet() && + (GetTypeId() == TYPEID_PLAYER || IsPet()) && + victim->GetTypeId() != TYPEID_PLAYER && !victim->IsPet() && getLevel() < victim->getLevelForTarget(this)) { // cap possible value (with bonuses > max skill) @@ -7276,7 +7276,7 @@ bool Unit::Attack(Unit* victim, bool meleeAttack) //if (GetTypeId() == TYPEID_UNIT) // ToCreature()->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ()); - if (GetTypeId() == TYPEID_UNIT && !ToCreature()->IsPet()) + if (GetTypeId() == TYPEID_UNIT && !IsPet()) { // should not let player enter combat by right clicking target - doesn't helps SetInCombatWith(victim); @@ -8018,7 +8018,7 @@ Unit* Unit::GetNextRandomRaidMemberOrPet(float radius) if (GetTypeId() == TYPEID_PLAYER) player = ToPlayer(); // Should we enable this also for charmed units? - else if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsPet()) + else if (GetTypeId() == TYPEID_UNIT && IsPet()) player = GetOwner()->ToPlayer(); if (!player) @@ -8289,7 +8289,7 @@ float Unit::SpellDamagePctDone(Unit* victim, SpellInfo const* spellProto, Damage float DoneTotalMod = 1.0f; // Pet damage? - if (GetTypeId() == TYPEID_UNIT && !ToCreature()->IsPet()) + if (GetTypeId() == TYPEID_UNIT && !IsPet()) DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank); AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); @@ -12657,7 +12657,7 @@ Player* Unit::GetSpellModOwner() const if (Player* player = const_cast<Unit*>(this)->ToPlayer()) return player; - if (ToCreature()->IsPet() || ToCreature()->IsTotem()) + if (IsPet() || ToCreature()->IsTotem()) { if (Unit* owner = GetOwner()) if (Player* player = owner->ToPlayer()) @@ -12942,7 +12942,7 @@ void Unit::ApplyCastTimePercentMod(float val, bool apply) uint32 Unit::GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime) const { // Not apply this to creature cast spells with casttime == 0 - if (CastingTime == 0 && GetTypeId() == TYPEID_UNIT && !ToCreature()->IsPet()) + if (CastingTime == 0 && GetTypeId() == TYPEID_UNIT && !IsPet()) return 3500; if (CastingTime > 7000) CastingTime = 7000; @@ -13043,7 +13043,7 @@ void Unit::UpdateAuraForGroup(uint8 slot) if (player->GetGroup()) player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_AURAS); } - else if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsPet()) + else if (GetTypeId() == TYPEID_UNIT && IsPet()) { Pet* pet = ((Pet*)this); if (pet->isControlled()) |
