Skip to content

Commit

Permalink
Creature: Roll back stamina usage until more is known
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed May 13, 2024
1 parent e073f1d commit c161407
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/game/Entities/Creature.h
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,8 @@ class Creature : public Unit
void UpdateAttackPowerAndDamage(bool ranged = false) override;
void UpdateDamagePhysical(WeaponAttackType attType) override;
virtual float GetConditionalTotalPhysicalDamageModifier(WeaponAttackType type) const;
float GetHealthBonusFromStamina() const override;

uint32 GetCurrentEquipmentId() const { return m_equipmentId; }

static float _GetHealthMod(int32 Rank); ///< Get custom factor to scale health (default 1, CONFIG_FLOAT_RATE_CREATURE_*_HP)
Expand Down
7 changes: 7 additions & 0 deletions src/game/Entities/StatSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,13 @@ float Creature::GetConditionalTotalPhysicalDamageModifier(WeaponAttackType attTy
return result;
}

float Creature::GetHealthBonusFromStamina() const
{
// only use diff until stamina per level coefficient for npcs is known
float stamina = GetStat(STAT_STAMINA);
return Unit::GetHealthBonusFromStamina(stamina) - Unit::GetHealthBonusFromStamina(GetCreateStat(STAT_STAMINA));
}

/*#######################################
######## ########
######## PETS STAT SYSTEM ########
Expand Down
2 changes: 1 addition & 1 deletion src/game/Entities/Unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -2054,7 +2054,7 @@ class Unit : public WorldObject
void SetCanModifyStats(bool modifyStats) { m_canModifyStats = modifyStats; }

static float GetHealthBonusFromStamina(float stamina);
float GetHealthBonusFromStamina() const;
virtual float GetHealthBonusFromStamina() const;
static float GetManaBonusFromIntellect(float intellect);
float GetManaBonusFromIntellect() const;

Expand Down
3 changes: 2 additions & 1 deletion src/game/Globals/ObjectMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,8 @@ void ObjectMgr::LoadCreatureClassLvlStats()
// should ensure old data does not need change (not wanting to recalculate to avoid losing data)
// if any mistake is made, it will be in these formulae that make asumptions about the new calculations
// AP, RAP, HP, Mana and armor should stay the same pre-change and post-change when using multipliers == 1
cCLS.BaseHealth -= std::min(cCLS.BaseHealth, std::max(0u, (uint32)Unit::GetHealthBonusFromStamina(cCLS.Stamina)));
// stamina seems to have scaling formula for npcs - so for now does not impact base health
// cCLS.BaseHealth -= std::min(cCLS.BaseHealth, std::max(0u, (uint32)Unit::GetHealthBonusFromStamina(cCLS.Stamina)));
cCLS.BaseMana -= std::min(cCLS.BaseMana, std::max(0u, (uint32)Unit::GetManaBonusFromIntellect(cCLS.Intellect)));
cCLS.BaseMeleeAttackPower -= std::min(cCLS.BaseMeleeAttackPower, std::max(0.f, float(cCLS.Strength >= 10 ? (cCLS.Strength - 10) * 2 : 0)));
cCLS.BaseRangedAttackPower -= std::min(cCLS.BaseRangedAttackPower, std::max(0.f, float(cCLS.Agility >= 10 ? (cCLS.Agility - 10) : 0)));
Expand Down

0 comments on commit c161407

Please sign in to comment.