mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-26 15:16:24 +00:00
fix(Core/Auras): SPELL_AURA_MOD_SCALE should scale additively instead… (#14425)
...multiplicatively Co-authored-by: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
@@ -474,7 +474,7 @@ bool Creature::InitEntry(uint32 Entry, const CreatureData* data)
|
||||
SetSpeed(MOVE_FLIGHT, cinfo->speed_flight);
|
||||
|
||||
// Will set UNIT_FIELD_BOUNDINGRADIUS and UNIT_FIELD_COMBATREACH
|
||||
SetObjectScale(cinfo->scale);
|
||||
SetObjectScale(GetNativeObjectScale());
|
||||
|
||||
SetFloatValue(UNIT_FIELD_HOVERHEIGHT, cinfo->HoverHeight);
|
||||
|
||||
@@ -3350,6 +3350,11 @@ void Creature::UpdateMovementFlags()
|
||||
SetSwim(CanSwim() && Swim);
|
||||
}
|
||||
|
||||
float Creature::GetNativeObjectScale() const
|
||||
{
|
||||
return GetCreatureTemplate()->scale;
|
||||
}
|
||||
|
||||
void Creature::SetObjectScale(float scale)
|
||||
{
|
||||
Unit::SetObjectScale(scale);
|
||||
|
||||
@@ -51,6 +51,7 @@ public:
|
||||
void AddToWorld() override;
|
||||
void RemoveFromWorld() override;
|
||||
|
||||
float GetNativeObjectScale() const override;
|
||||
void SetObjectScale(float scale) override;
|
||||
void SetDisplayId(uint32 modelId) override;
|
||||
|
||||
|
||||
@@ -1073,20 +1073,8 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
|
||||
|
||||
SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f);
|
||||
|
||||
//scale
|
||||
CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cinfo->family);
|
||||
if (cFamily && cFamily->minScale > 0.0f && petType == HUNTER_PET)
|
||||
{
|
||||
float scale;
|
||||
if (GetLevel() >= cFamily->maxScaleLevel)
|
||||
scale = 1.0f;
|
||||
else if (GetLevel() <= cFamily->minScaleLevel)
|
||||
scale = 0.5f;
|
||||
else
|
||||
scale = 0.5f + 0.5f * float(GetLevel() - cFamily->minScaleLevel) / float(cFamily->maxScaleLevel - cFamily->minScaleLevel);
|
||||
|
||||
SetObjectScale(scale);
|
||||
}
|
||||
// scale
|
||||
SetObjectScale(GetNativeObjectScale());
|
||||
|
||||
// Resistance
|
||||
// xinef: hunter pets should not inherit template resistances
|
||||
@@ -2440,6 +2428,25 @@ Player* Pet::GetOwner() const
|
||||
return m_owner;
|
||||
}
|
||||
|
||||
float Pet::GetNativeObjectScale() const
|
||||
{
|
||||
CreatureFamilyEntry const* creatureFamily = sCreatureFamilyStore.LookupEntry(GetCreatureTemplate()->family);
|
||||
if (creatureFamily && creatureFamily->minScale > 0.0f && getPetType() == HUNTER_PET)
|
||||
{
|
||||
float scale;
|
||||
if (GetLevel() >= creatureFamily->maxScaleLevel)
|
||||
scale = creatureFamily->maxScale;
|
||||
else if (GetLevel() <= creatureFamily->minScaleLevel)
|
||||
scale = creatureFamily->minScale;
|
||||
else
|
||||
scale = creatureFamily->minScale + float(GetLevel() - creatureFamily->minScaleLevel) / creatureFamily->maxScaleLevel * (creatureFamily->maxScale - creatureFamily->minScale);
|
||||
|
||||
return scale;
|
||||
}
|
||||
|
||||
return Guardian::GetNativeObjectScale();
|
||||
}
|
||||
|
||||
std::string Pet::GenerateActionBarData() const
|
||||
{
|
||||
std::ostringstream oss;
|
||||
|
||||
@@ -45,6 +45,7 @@ public:
|
||||
void AddToWorld() override;
|
||||
void RemoveFromWorld() override;
|
||||
|
||||
float GetNativeObjectScale() const override;
|
||||
void SetDisplayId(uint32 modelId) override;
|
||||
|
||||
PetType getPetType() const { return m_petType; }
|
||||
|
||||
@@ -16864,6 +16864,14 @@ bool Unit::IsPolymorphed() const
|
||||
return spellInfo->GetSpellSpecific() == SPELL_SPECIFIC_MAGE_POLYMORPH;
|
||||
}
|
||||
|
||||
void Unit::RecalculateObjectScale()
|
||||
{
|
||||
int32 scaleAuras = GetTotalAuraModifier(SPELL_AURA_MOD_SCALE) + GetTotalAuraModifier(SPELL_AURA_MOD_SCALE_2);
|
||||
float scale = GetNativeObjectScale() + CalculatePct(1.0f, scaleAuras);
|
||||
float scaleMin = GetTypeId() == TYPEID_PLAYER ? 0.1f : 0.01f;
|
||||
SetObjectScale(std::max(scale, scaleMin));
|
||||
}
|
||||
|
||||
void Unit::SetDisplayId(uint32 modelId)
|
||||
{
|
||||
SetUInt32Value(UNIT_FIELD_DISPLAYID, modelId);
|
||||
|
||||
@@ -2162,6 +2162,8 @@ public:
|
||||
void AddInterruptMask(uint32 mask) { m_interruptMask |= mask; }
|
||||
void UpdateInterruptMask();
|
||||
|
||||
virtual float GetNativeObjectScale() const { return 1.0f; }
|
||||
virtual void RecalculateObjectScale();
|
||||
[[nodiscard]] uint32 GetDisplayId() const { return GetUInt32Value(UNIT_FIELD_DISPLAYID); }
|
||||
virtual void SetDisplayId(uint32 modelId);
|
||||
[[nodiscard]] uint32 GetNativeDisplayId() const { return GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID); }
|
||||
|
||||
@@ -2349,16 +2349,12 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode,
|
||||
}
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraModScale(AuraApplication const* aurApp, uint8 mode, bool apply) const
|
||||
void AuraEffect::HandleAuraModScale(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
|
||||
{
|
||||
if (!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK))
|
||||
return;
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
float scale = target->GetObjectScale();
|
||||
ApplyPercentModFloatVar(scale, float(GetAmount()), apply);
|
||||
target->SetObjectScale(scale);
|
||||
aurApp->GetTarget()->RecalculateObjectScale();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraCloneCaster(AuraApplication const* aurApp, uint8 mode, bool apply) const
|
||||
|
||||
Reference in New Issue
Block a user