[Rules] Add optional rules for HealAmt and SpellAmt to scale DoTs/HoTs. (#1661)

* Add optional rules for itembonuses HealAmt and SpellAmt to scale for DoTs/HoTs

* Fix typo

* Only 1 rulecheck

* Apply +healingitems and +dmgitems after focus effects so they scale properly

* Fix dots / hots to not always use PVPScaling for extra_dmg / extra_healing

Adjust +healamt and +spelldmg to scale over the full duration of the spell, Thanks Kayen
This commit is contained in:
Natedog2012 2021-11-02 15:12:07 -05:00 committed by GitHub
parent 4ac525afc2
commit e4138b871b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 3 deletions

View File

@ -382,6 +382,8 @@ RULE_BOOL(Spells, AllowDoubleInvis, false, "Allows you to cast invisibility spel
RULE_BOOL(Spells, AllowSpellMemorizeFromItem, false, "Allows players to memorize spells by right-clicking spell scrolls")
RULE_BOOL(Spells, InvisRequiresGroup, false, "Invis requires the the target to be in group.")
RULE_INT(Spells, ClericInnateHealFocus, 5, "Clerics on live get a 5 pct innate heal focus")
RULE_BOOL(Spells, DOTsScaleWithSpellDmg, false, "Allow SpellDmg stat to affect DoT spells")
RULE_BOOL(Spells, HOTsScaleWithHealAmt, false, "Allow HealAmt stat to affect HoT spells")
RULE_CATEGORY_END()
RULE_CATEGORY(Combat)

View File

@ -196,7 +196,7 @@ int32 Mob::GetActDoTDamage(uint16 spell_id, int32 value, Mob* target) {
if (target == nullptr)
return value;
if (IsNPC()) {
value += value * CastToNPC()->GetSpellFocusDMG() / 100;
}
@ -226,9 +226,18 @@ int32 Mob::GetActDoTDamage(uint16 spell_id, int32 value, Mob* target) {
GetFocusEffect(focusFcDamageAmt, spell_id) +
GetFocusEffect(focusFcDamageAmt2, spell_id) +
GetFocusEffect(focusFcAmplifyAmt, spell_id);
if (RuleB(Spells, DOTsScaleWithSpellDmg)) {
if (RuleB(Spells, IgnoreSpellDmgLvlRestriction) && !spells[spell_id].no_heal_damage_item_mod && itembonuses.SpellDmg) {
extra_dmg += GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, base_value)*ratio/100;
}
else if(!spells[spell_id].no_heal_damage_item_mod && itembonuses.SpellDmg && spells[spell_id].classes[(GetClass() % 17) - 1] >= GetLevel() - 5) {
extra_dmg += GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, base_value)*ratio/100;
}
}
if (extra_dmg) {
int duration = CalcBuffDuration(this, this, spell_id);
int duration = CalcBuffDuration(this, target, spell_id);
if (duration > 0)
extra_dmg /= duration;
}
@ -248,9 +257,18 @@ int32 Mob::GetActDoTDamage(uint16 spell_id, int32 value, Mob* target) {
GetFocusEffect(focusFcDamageAmt, spell_id) +
GetFocusEffect(focusFcDamageAmt2, spell_id) +
GetFocusEffect(focusFcAmplifyAmt, spell_id);
if (RuleB(Spells, DOTsScaleWithSpellDmg)) {
if (RuleB(Spells, IgnoreSpellDmgLvlRestriction) && !spells[spell_id].no_heal_damage_item_mod && itembonuses.SpellDmg) {
extra_dmg += GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, base_value);
}
else if(!spells[spell_id].no_heal_damage_item_mod && itembonuses.SpellDmg && spells[spell_id].classes[(GetClass() % 17) - 1] >= GetLevel() - 5) {
extra_dmg += GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, base_value);
}
}
if (extra_dmg) {
int duration = CalcBuffDuration(this, this, spell_id);
int duration = CalcBuffDuration(this, target, spell_id);
if (duration > 0)
extra_dmg /= duration;
}
@ -383,6 +401,25 @@ int32 Mob::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) {
//Heal over time spells. [Heal Rate and Additional Healing effects do not increase this value]
else {
//Using IgnoreSpellDmgLvlRestriction to also allow healing to scale
int32 extra_heal = 0;
if (RuleB(Spells, HOTsScaleWithHealAmt)) {
if (RuleB(Spells, IgnoreSpellDmgLvlRestriction) && !spells[spell_id].no_heal_damage_item_mod && itembonuses.HealAmt) {
extra_heal += GetExtraSpellAmt(spell_id, itembonuses.HealAmt, base_value);
}
else if(!spells[spell_id].no_heal_damage_item_mod && itembonuses.HealAmt && spells[spell_id].classes[(GetClass() % 17) - 1] >= GetLevel() - 5) {
extra_heal += GetExtraSpellAmt(spell_id, itembonuses.HealAmt, base_value);
}
}
if (extra_heal) {
int duration = CalcBuffDuration(this, target, spell_id);
if (duration > 0) {
extra_heal /= duration;
value += extra_heal;
}
}
if (critical_chance && zone->random.Roll(critical_chance))
value *= critical_modifier;
}