Skip to content

Commit

Permalink
Only do expansion-level HP/damage adjustments if Level Scaling is ena…
Browse files Browse the repository at this point in the history
…bled (#138)

- closes #137
  • Loading branch information
kjack9 authored Jun 27, 2023
1 parent 74bb9e6 commit 34bdfc6
Showing 1 changed file with 84 additions and 76 deletions.
160 changes: 84 additions & 76 deletions src/AutoBalance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2651,56 +2651,60 @@ class AutoBalance_AllCreatureScript : public AllCreatureScript

// The database holds multiple values for base health, one for each expansion
// This code will smooth transition between the different expansions based on the highest player level in the instance
// Only do this if level scaling is enabled

float vanillaHealth = creatureStats->BaseHealth[0];
float bcHealth = creatureStats->BaseHealth[1];
float wotlkHealth = creatureStats->BaseHealth[2];

// vanilla health
if (mapABInfo->highestPlayerLevel <= 60)
{
newBaseHealth = vanillaHealth;
}
// transition from vanilla to BC health
else if (mapABInfo->highestPlayerLevel < 63)
if (LevelScaling)
{
float vanillaMultiplier = (63 - mapABInfo->highestPlayerLevel) / 3.0f;
float bcMultiplier = 1.0f - vanillaMultiplier;
float vanillaHealth = creatureStats->BaseHealth[0];
float bcHealth = creatureStats->BaseHealth[1];
float wotlkHealth = creatureStats->BaseHealth[2];

newBaseHealth = (vanillaHealth * vanillaMultiplier) + (bcHealth * bcMultiplier);
}
// BC health
else if (mapABInfo->highestPlayerLevel <= 70)
{
newBaseHealth = bcHealth;
}
// transition from BC to WotLK health
else if (mapABInfo->highestPlayerLevel < 73)
{
float bcMultiplier = (73 - mapABInfo->highestPlayerLevel) / 3.0f;
float wotlkMultiplier = 1.0f - bcMultiplier;
// vanilla health
if (mapABInfo->highestPlayerLevel <= 60)
{
newBaseHealth = vanillaHealth;
}
// transition from vanilla to BC health
else if (mapABInfo->highestPlayerLevel < 63)
{
float vanillaMultiplier = (63 - mapABInfo->highestPlayerLevel) / 3.0f;
float bcMultiplier = 1.0f - vanillaMultiplier;

newBaseHealth = (bcHealth * bcMultiplier) + (wotlkHealth * wotlkMultiplier);
}
// WotLK health
else
{
newBaseHealth = wotlkHealth;
newBaseHealth = (vanillaHealth * vanillaMultiplier) + (bcHealth * bcMultiplier);
}
// BC health
else if (mapABInfo->highestPlayerLevel <= 70)
{
newBaseHealth = bcHealth;
}
// transition from BC to WotLK health
else if (mapABInfo->highestPlayerLevel < 73)
{
float bcMultiplier = (73 - mapABInfo->highestPlayerLevel) / 3.0f;
float wotlkMultiplier = 1.0f - bcMultiplier;

// special increase for end-game content
if (LevelScalingEndGameBoost)
if (mapABInfo->highestPlayerLevel >= 75 && creatureABInfo->UnmodifiedLevel < 75)
{
newBaseHealth *= (float)(mapABInfo->highestPlayerLevel-70) * 0.3f;
}
}
newBaseHealth = (bcHealth * bcMultiplier) + (wotlkHealth * wotlkMultiplier);
}
// WotLK health
else
{
newBaseHealth = wotlkHealth;

float newHealth = newBaseHealth * creatureTemplate->ModHealth;
hpStatsRate = newHealth / originalHealth;
// special increase for end-game content
if (LevelScalingEndGameBoost)
if (mapABInfo->highestPlayerLevel >= 75 && creatureABInfo->UnmodifiedLevel < 75)
{
newBaseHealth *= (float)(mapABInfo->highestPlayerLevel-70) * 0.3f;
}
}

healthMultiplier *= hpStatsRate;
creatureABInfo->HealthMultiplier = healthMultiplier;
float newHealth = newBaseHealth * creatureTemplate->ModHealth;
hpStatsRate = newHealth / originalHealth;

healthMultiplier *= hpStatsRate;
}

creatureABInfo->HealthMultiplier = healthMultiplier;
scaledHealth = round(originalHealth * creatureABInfo->HealthMultiplier);

//
Expand Down Expand Up @@ -2754,46 +2758,50 @@ class AutoBalance_AllCreatureScript : public AllCreatureScript

// The database holds multiple values for base damage, one for each expansion
// This code will smooth transition between the different expansions based on the highest player level in the instance
// Only do this if level scaling is enabled

// vanilla damage
if (mapABInfo->highestPlayerLevel <= 60)
{
newDmgBase=vanillaDamage;
}
// transition from vanilla to BC damage
else if (mapABInfo->highestPlayerLevel < 63)
{
float vanillaMultiplier = (63 - mapABInfo->highestPlayerLevel) / 3.0;
float bcMultiplier = 1.0f - vanillaMultiplier;
if (LevelScaling)
{
// vanilla damage
if (mapABInfo->highestPlayerLevel <= 60)
{
newDmgBase=vanillaDamage;
}
// transition from vanilla to BC damage
else if (mapABInfo->highestPlayerLevel < 63)
{
float vanillaMultiplier = (63 - mapABInfo->highestPlayerLevel) / 3.0;
float bcMultiplier = 1.0f - vanillaMultiplier;

newDmgBase=(vanillaDamage * vanillaMultiplier) + (bcDamage * bcMultiplier);
}
// BC damage
else if (mapABInfo->highestPlayerLevel <= 70)
{
newDmgBase=bcDamage;
}
// transition from BC to WotLK damage
else if (mapABInfo->highestPlayerLevel < 73)
{
float bcMultiplier = (73 - mapABInfo->highestPlayerLevel) / 3.0;
float wotlkMultiplier = 1.0f - bcMultiplier;
newDmgBase=(vanillaDamage * vanillaMultiplier) + (bcDamage * bcMultiplier);
}
// BC damage
else if (mapABInfo->highestPlayerLevel <= 70)
{
newDmgBase=bcDamage;
}
// transition from BC to WotLK damage
else if (mapABInfo->highestPlayerLevel < 73)
{
float bcMultiplier = (73 - mapABInfo->highestPlayerLevel) / 3.0;
float wotlkMultiplier = 1.0f - bcMultiplier;

newDmgBase=(bcDamage * bcMultiplier) + (wotlkDamage * wotlkMultiplier);
}
// WotLK damage
else
{
newDmgBase=wotlkDamage;
newDmgBase=(bcDamage * bcMultiplier) + (wotlkDamage * wotlkMultiplier);
}
// WotLK damage
else
{
newDmgBase=wotlkDamage;

// special increase for end-game content
if (LevelScalingEndGameBoost && maxNumberOfPlayers <= 5) {
if (mapABInfo->highestPlayerLevel >= 75 && creatureABInfo->UnmodifiedLevel < 75)
newDmgBase *= float(mapABInfo->highestPlayerLevel-70) * 0.3f;
// special increase for end-game content
if (LevelScalingEndGameBoost && maxNumberOfPlayers <= 5) {
if (mapABInfo->highestPlayerLevel >= 75 && creatureABInfo->UnmodifiedLevel < 75)
newDmgBase *= float(mapABInfo->highestPlayerLevel-70) * 0.3f;
}
}
}

damageMul *= newDmgBase/origDmgBase;
damageMul *= newDmgBase/origDmgBase;
}

//
// Crowd Control Debuff Duration Scaling
Expand Down

0 comments on commit 34bdfc6

Please sign in to comment.