Core/Auras: Prevent getting negative scale with auras

Port From (https://github.com/TrinityCore/TrinityCore/commit/679e9910e09a55dd1743f236dbd99b7fa48fe9c1)
This commit is contained in:
hondacrx
2022-02-18 16:40:32 -05:00
parent e7eba5907d
commit a031530b2a
5 changed files with 39 additions and 19 deletions
+1 -13
View File
@@ -494,19 +494,7 @@ namespace Game.Entities
SetBaseAttackTime(WeaponAttackType.RangedAttack, SharedConst.BaseAttackTime);
//scale
var cFamily = CliDB.CreatureFamilyStorage.LookupByKey(cinfo.Family);
if (cFamily != null && cFamily.MinScale > 0.0f && petType == PetType.Hunter)
{
float scale;
if (GetLevel() >= cFamily.MaxScaleLevel)
scale = cFamily.MaxScale;
else if (GetLevel() <= cFamily.MinScaleLevel)
scale = cFamily.MinScale;
else
scale = cFamily.MinScale + (float)(GetLevel() - cFamily.MinScaleLevel) / cFamily.MaxScaleLevel * (cFamily.MaxScale - cFamily.MinScale);
SetObjectScale(scale);
}
SetObjectScale(GetNativeObjectScale());
// Resistance
// Hunters pet should not inherit resistances from creature_template, they have separate auras for that