Skip to content

Commit

Permalink
Creature: Fix mage class coefficient for str
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Apr 28, 2024
1 parent f3ca348 commit 48e327e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/game/Entities/StatSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,9 @@ void Creature::UpdateAttackPowerAndDamage(bool ranged)
{
switch (getClass())
{
case CLASS_MAGE:
val2 = GetStat(STAT_STRENGTH) - 10.0f;
break;
case CLASS_ROGUE:
val2 = (GetStat(STAT_STRENGTH) - 10.0f) + GetStat(STAT_AGILITY);
break;
Expand Down
15 changes: 14 additions & 1 deletion src/game/Globals/ObjectMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -980,12 +980,25 @@ void ObjectMgr::LoadCreatureClassLvlStats()
cCLS.BaseHealth = fields[11 + (i * 2)].GetUInt32();
cCLS.BaseDamage = fields[12 + (i * 2)].GetFloat();

uint32 apCoeffStr = 2;
uint32 apCoeffAgi = 0;
switch (creatureClass)
{
case CLASS_ROGUE:
apCoeffStr = 1;
apCoeffAgi = 1;
break;
case CLASS_MAGE:
apCoeffStr = 1;
break;
}

// 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)));
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.BaseMeleeAttackPower -= std::min(cCLS.BaseMeleeAttackPower, std::max(0.f, float(((std::max(cCLS.Strength, 10u) - 10) * apCoeffStr + (std::max(cCLS.Agility, 10u) - 10) * apCoeffAgi))));
cCLS.BaseRangedAttackPower -= std::min(cCLS.BaseRangedAttackPower, std::max(0.f, float(cCLS.Agility >= 10 ? (cCLS.Agility - 10) : 0)));
cCLS.BaseArmor -= std::min(cCLS.BaseArmor, std::max(0u, cCLS.Agility * 2));
}
Expand Down

0 comments on commit 48e327e

Please sign in to comment.