Skip to content

Commit

Permalink
Dmg loot fix (#145)
Browse files Browse the repository at this point in the history
* Update AutoBalance.cpp

Scale DmgRequired similarly to Creature HP

* Update AutoBalance.cpp

Fix typo

* Update AutoBalance.cpp

I blame python

* Update AutoBalance.cpp

Fix Math
  • Loading branch information
OverlordQ authored Aug 15, 2023
1 parent db19dfc commit c7693f7
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/AutoBalance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2847,7 +2847,10 @@ class AutoBalance_AllCreatureScript : public AllCreatureScript
uint32 prevMaxPower = creature->GetMaxPower(POWER_MANA);
uint32 prevHealth = creature->GetHealth();
uint32 prevPower = creature->GetPower(POWER_MANA);


uint32 prevPlayerDamageRequired = creature->GetPlayerDamageReq();
uint32 prevCreateHealth = creature->GetCreateHealth();

Powers pType= creature->getPowerType();

creature->SetArmor(newBaseArmor);
Expand All @@ -2873,6 +2876,20 @@ class AutoBalance_AllCreatureScript : public AllCreatureScript
else
creature->setPowerType(pType); // fix creatures with different power types

uint32 playerDamageRequired = creature->GetPlayerDamageReq();
if(prevPlayerDamageRequired == 0)
{
// If already reached damage threshold for loot, drop to zero again
creature->LowerPlayerDamageReq(playerDamageRequired, true);
}
else
{
// Scale the damage requirements similar to creature HP scaling
uint32 scaledPlayerDmgReq = float(prevPlayerDamageRequired) * float(scaledHealth) / float(prevCreateHealth);
// Do some math
creature->LowerPlayerDamageReq(playerDamageRequired - scaledPlayerDmgReq, true);
}

//
// Reward Scaling
//
Expand Down

0 comments on commit c7693f7

Please sign in to comment.