From d9cfc3a858940eb7385d62c6396372f7d1317890 Mon Sep 17 00:00:00 2001 From: Fryguy Date: Sun, 7 Jan 2024 12:34:43 -0500 Subject: [PATCH] [Feature] Legacy Manaburn Rule (#3872) * [Feature] Legacy Manaburn Rule Enabling this rule allows the legacy style Manaburn and LifeBurn early 2003 and earlier. * Requested Changes * Requested Change --- common/ruletypes.h | 1 + zone/spell_effects.cpp | 54 ++++++++++++++++++++++++++---------------- zone/spells.cpp | 3 +++ 3 files changed, 37 insertions(+), 21 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index e887b14c1..3dac99657 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -470,6 +470,7 @@ RULE_REAL(Spells, DefensiveProcPenaltyLevelGapModifier, 10.0f, "Defensive Proc P RULE_BOOL(Spells, DOTBonusDamageSplitOverDuration, true, "Disable to have Damage Over Time total bonus damage added to each tick instead of divided across duration") RULE_BOOL(Spells, HOTBonusHealingSplitOverDuration, true, "Disable to have Heal Over Time total bonus healing added to each tick instead of divided across duration") RULE_BOOL(Spells, UseLegacyFizzleCode, false, "Enable will turn on the legacy fizzle code which is far stricter and more accurate to 2001/2002 testing.") +RULE_BOOL(Spells, LegacyManaburn, false, "Enable to have the legacy manaburn system from 2003 and earlier.") RULE_CATEGORY_END() RULE_CATEGORY(Combat) diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 849e10a63..cb6076e58 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -326,32 +326,44 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove // hack fix for client health not reflecting server value last_hp = 0; - int64 dmg = effect_value; //hardcoded for manaburn and life burn - if (spell_id == SPELL_MANA_BURN || spell_id == SPELL_LIFE_BURN) - { - if (spell_id == SPELL_MANA_BURN && caster) //Manaburn - { - dmg = caster->GetMana()*-3; - caster->SetMana(0); - } - else if (spell_id == SPELL_LIFE_BURN && caster) //Lifeburn - { - dmg = caster->GetHP(); // just your current HP - caster->SetHP(dmg / 4); // 2003 patch notes say ~ 1/4 HP. Should this be 1/4 your current HP or do 3/4 max HP dmg? Can it kill you? - dmg = -dmg; - } + if (spell_id == SPELL_MANA_BURN || spell_id == SPELL_LIFE_BURN) { + if (RuleB(Spells, LegacyManaburn)) { + if (spell_id == SPELL_MANA_BURN && caster) { //Manaburn + int manaburn_multiplier = zone->random.Int(150, 200); //Manaburn deals 150-200% of mana + dmg = caster->GetMana() * manaburn_multiplier / 100; + dmg *= -1; //Damage should be negative + dmg = caster->GetActSpellDamage(spell_id, dmg, this); // Spell can crit, so need this. Damage cap handled in this function. + LogSpellsDetail("manaburn_multiplier [{}], Mana [{}], Damage [{}]", manaburn_multiplier, caster->GetMana(), dmg); + caster->SetMana(0); + } else if (spell_id == SPELL_LIFE_BURN && caster) { //Lifeburn + dmg = caster->GetHP() * -1; + caster->SetHP(1); + if (caster->IsClient()) { + caster->CastToClient()->SetFeigned(true); + caster->SendAppearancePacket(AppearanceType::Die, Animation::Lying); + } + } + } else { + if (spell_id == SPELL_MANA_BURN && caster) { //Manaburn + dmg = caster->GetMana() * -3; + caster->SetMana(0); + } else if (spell_id == SPELL_LIFE_BURN && caster) { //Lifeburn + dmg = caster->GetHP(); // just your current HP + caster->SetHP(dmg / 4); // 2003 patch notes say ~ 1/4 HP. Should this be 1/4 your current HP or do 3/4 max HP dmg? Can it kill you? + dmg = -dmg; + } - if (dmg < 0) { - dmg = -dmg; - Damage(caster, dmg, spell_id, spell.skill, false, buffslot, false); + if (dmg < 0) { + dmg = -dmg; + Damage(caster, dmg, spell_id, spell.skill, false, buffslot, false); + } else { + HealDamage(dmg, caster); + } + break; } - else { - HealDamage(dmg, caster); - } - break; } //normal effects else { diff --git a/zone/spells.cpp b/zone/spells.cpp index 25b96d97d..c72d79783 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -4413,6 +4413,9 @@ bool Mob::SpellOnTarget( LogSpells("Spell [{}] could not apply its effects [{}] -> [{}]\n", spell_id, GetName(), spelltar->GetName()); if (casting_spell_aa_id) { MessageString(Chat::SpellFailure, SPELL_NO_HOLD); + if (RuleB(Spells, LegacyManaburn) && IsClient() && casting_spell_aa_id == aaManaBurn) { + StopCasting(); + } } safe_delete(action_packet); return false;