Core/Pets: use a update timer for scaling auras in order to get closer to retail behaivior

* corrected base health scaling formular for Hunter pets
This commit is contained in:
Ovahlord committed 2018-10-06 18:17:10 +02:00
1 parent 05ac6fb175
commit 556bf05050
5 files changed
+12 -11

No files matched your search

-2
View File
@@ -1962,6 +1962,4 @@ void Pet::UpdatePetScalingAuras()
if (Aura* aura = GetAura(spellId))
aura->RecalculateAmountOfEffects();
}
UpdateAllStats();
}
@@ -413,6 +413,7 @@ Player::Player(WorldSession* session): Unit(true)
m_reputationMgr = new ReputationMgr(this);
_hasValidLFGLeavePoint = false;
_archaeology = new Archaeology(this);
m_petScalingSynchTimer.Reset(1000);
}
Player::~Player()
@@ -1371,6 +1372,14 @@ void Player::Update(uint32 p_time)
//if (pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityDistance()) && (GetCharmGUID() && (pet->GetGUID() != GetCharmGUID())))
RemovePet(pet, PET_SAVE_DISMISS, true);
m_petScalingSynchTimer.Update(p_time);
if (m_petScalingSynchTimer.Passed())
{
if (pet)
pet->UpdatePetScalingAuras();
m_petScalingSynchTimer.Reset(1000);
}
if (IsAlive())
{
if (m_hostileReferenceCheckTimer <= p_time)
+2
View File
@@ -2751,6 +2751,8 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
Archaeology* _archaeology;
std::vector<PlayerPetData*> PlayerPetDataStore;
TimeTrackerSmall m_petScalingSynchTimer;
};
TC_GAME_API void AddItemsSetItem(Player* player, Item* item);
-8
View File
@@ -9772,10 +9772,6 @@ bool Unit::HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, f
break;
}
// Do not update pet stats one by one. We will update all stats in one big chunk after updating all scaling auras
if (IsPet())
return false;
if (!CanModifyStats())
return false;
@@ -9829,10 +9825,6 @@ bool Unit::HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, f
break;
}
if (Player* player = ToPlayer())
if (Pet* pet = player->GetPet())
pet->UpdatePetScalingAuras();
return true;
}
+1 -1
View File
@@ -514,7 +514,7 @@ class spell_hun_pet_scaling_01 : public AuraScript
if (Player* owner = pet->GetOwner())
{
// Base Health value for all pets at level 85 is 32,474
int32 bonus = int32(owner->GetCreateHealth() * 0.79743633f);
int32 bonus = int32(owner->GetCreateHealth() * 0.831877f);
// Apply health scaling bonuses based on pet type
float mod = 0.0f;