fix(Core/Pets) Pet scaling only being applied to pets with DB Entry (#16401)

This commit is contained in:
AiurJordan
2023-08-02 12:51:11 -05:00
committed by GitHub
parent 90675cab30
commit f0a4612964

View File

@@ -1091,7 +1091,17 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(creature_ID, petlevel);
if (pInfo) // exist in DB
{
SetCreateHealth(pInfo->health);
// Default scale value of 1 to use if Pet.RankMod.Health = 0
float factorHealth = 1;
// If config is set to allow pets to use health modifiers, apply it to creatures with a DB entry
// Pet.RankMod.Health = 1 use the factor value based on the rank of the pet, most pets have a rank of 0 and so use
// the Elite rank which is set as the default in Creature::_GetHealthMod(int32 Rank)
if (sWorld->getBoolConfig(CONFIG_ALLOWS_RANK_MOD_FOR_PET_HEALTH))
{
factorHealth *= _GetHealthMod(cinfo->rank);
}
SetCreateHealth(pInfo->health*factorHealth);
SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, (float)pInfo->health);
if (petType != HUNTER_PET) //hunter pet use focus
{