diff --git a/conf/trialofstrength.conf.dist b/conf/trialofstrength.conf.dist index 7c2cb5f..f90ce13 100644 --- a/conf/trialofstrength.conf.dist +++ b/conf/trialofstrength.conf.dist @@ -68,4 +68,44 @@ TrialOfStrength.Scaling.RewardMoneyScalar = 50 # Default: 1 - Enabled # -TrialOfStrength.Scaling.RewardMoney = 1 \ No newline at end of file +TrialOfStrength.Scaling.RewardMoney = 1 + +# +# TrialOfStrength.Scaling.BaseDamage.Physical +# Description: Controls the base damage of creatures physical damage in the Trial of Strength waves. +# Note: The formula for the damage is: baseDamage * (1.0f + (float(currentWave) / float(damageDivider))); +# The damage range is calculated as: damage = urand(newDamage / 2, newDamage); +# Default: 500 +# + +TrialOfStrength.Scaling.BaseDamage.Physical = 500 + +# +# TrialOfStrength.Scaling.BaseDamage.PhysicalDivider +# Description: Controls the base damage divider of creatures physical damage in the Trial of Strength waves. +# Note: The formula for the damage is: baseDamage * (1.0f + (float(currentWave) / float(damageDivider))); +# Increasing/decreasing the value of this setting will change the difficulty between waves. +# Default: 15 +# + +TrialOfStrength.Scaling.BaseDamage.PhysicalDivider = 15 + +# +# TrialOfStrength.Scaling.BaseDamage.Spell +# Description: Controls the base damage of creatures spell damage in the Trial of Strength waves. +# Note: The formula for the damage is: baseDamage * (1.0f + (float(currentWave) / float(damageDivider))); +# The damage range is calculated as: damage = urand(newDamage / 2, newDamage); +# Default: 1000 +# + +TrialOfStrength.Scaling.BaseDamage.Spell = 1000 + +# +# TrialOfStrength.Scaling.BaseDamage.SpellDivider +# Description: Controls the base damage divider of creatures spell damage in the Trial of Strength waves. +# Note: The formula for the damage is: baseDamage * (1.0f + (float(currentWave) / float(damageDivider))); +# Increasing/decreasing the value of this setting will change the difficulty between waves. +# Default: 15 +# + +TrialOfStrength.Scaling.BaseDamage.SpellDivider = 15 \ No newline at end of file diff --git a/src/scripts/ToSUnitScript.cpp b/src/scripts/ToSUnitScript.cpp index c5d674c..d0d278e 100644 --- a/src/scripts/ToSUnitScript.cpp +++ b/src/scripts/ToSUnitScript.cpp @@ -58,8 +58,53 @@ void ToSUnitScript::ModifyMeleeDamage(Unit* /*target*/, Unit* attacker, uint32& uint32 currentWave = iScript->GetData(TOS_DATA_ENCOUNTER_CURRENT_WAVE); - uint32 baseDamage = 500; - uint32 damageDivider = 15; + uint32 baseDamage = sConfigMgr->GetOption("TrialOfStrength.Scaling.BaseDamage.Physical", 500); + uint32 damageDivider = sConfigMgr->GetOption("TrialOfStrength.Scaling.BaseDamage.PhysicalDivider", 15);; + + uint32 newDamage = baseDamage * (1.0f + (float(currentWave) / float(damageDivider))); + + damage = urand(newDamage / 2, newDamage); +} + +void ToSUnitScript::ModifySpellDamageTaken(Unit* /*target*/, Unit* attacker, int32& damage, SpellInfo const* /*spellInfo*/) +{ + if (!attacker) + { + return; + } + + if (attacker->IsPlayer()) + { + return; + } + + if (attacker->GetMapId() != TOS_MAP_ID) + { + return; + } + + auto map = attacker->GetMap(); + if (!map) + { + return; + } + + auto instance = map->ToInstanceMap(); + if (!instance) + { + return; + } + + auto iScript = instance->GetInstanceScript(); + if (!iScript) + { + return; + } + + uint32 currentWave = iScript->GetData(TOS_DATA_ENCOUNTER_CURRENT_WAVE); + + uint32 baseDamage = sConfigMgr->GetOption("TrialOfStrength.Scaling.BaseDamage.Spell", 500); + uint32 damageDivider = sConfigMgr->GetOption("TrialOfStrength.Scaling.BaseDamage.SpellDivider", 15);; uint32 newDamage = baseDamage * (1.0f + (float(currentWave) / float(damageDivider))); diff --git a/src/scripts/ToSUnitScript.h b/src/scripts/ToSUnitScript.h index 71c4a04..22b5414 100644 --- a/src/scripts/ToSUnitScript.h +++ b/src/scripts/ToSUnitScript.h @@ -13,6 +13,7 @@ class ToSUnitScript : public UnitScript void OnUnitDeath(Unit* /*unit*/, Unit* /*killer*/) override; void ModifyMeleeDamage(Unit* /*target*/, Unit* /*attacker*/, uint32& /*damage*/) override; + void ModifySpellDamageTaken(Unit* /*target*/, Unit* /*attacker*/, int32& /*damage*/, SpellInfo const* /*spellInfo*/) override; }; #endif // MODULE_TRIAL_OF_STRENGTH_UNIT_SCRIPT_H