Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dmg loot fix #145

Merged
merged 4 commits into from
Aug 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading