[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
This commit is contained in:
Fryguy 2024-01-07 12:34:43 -05:00 committed by GitHub
parent 51dc62dfb1
commit d9cfc3a858
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 21 deletions

View File

@ -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)

View File

@ -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 {

View File

@ -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;