From 7072b5721b72d3ed58fe21b4fb9c6c03da640b98 Mon Sep 17 00:00:00 2001 From: Kinglykrab <89047260+Kinglykrab@users.noreply.github.com> Date: Fri, 27 May 2022 15:00:59 -0400 Subject: [PATCH] [Rules] Add Spells:BuffsFadeOnDeath. (#2200) - Allows you to disable buffs fading on death. --- common/ruletypes.h | 1 + zone/attack.cpp | 5 ++++- zone/bot.cpp | 5 ++++- zone/client_process.cpp | 5 ++++- zone/mob.cpp | 7 +++++-- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index badbdae5e..3e347a962 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -414,6 +414,7 @@ RULE_BOOL(Spells, CompoundLifetapHeals, true, "True: Lifetap heals calculate dam RULE_BOOL(Spells, UseFadingMemoriesMaxLevel, false, "Enables to limit field in spell data to set the max level that over which an NPC will ignore fading memories effect and not lose aggro.") RULE_BOOL(Spells, FixBeaconHeading, false, "Beacon spells use casters heading to fix live bug. False: Live like heading always 0.") RULE_BOOL(Spells, UseSpellImpliedTargeting, false, "Replicates EQ2-style targeting behavior for spells. Spells will 'pass through' inappropriate targets to target's target if it is appropriate.") +RULE_BOOL(Spells, BuffsFadeOnDeath, true, "Disable to keep buffs from fading on death") RULE_BOOL(Spells, IllusionsAlwaysPersist, false, "Allows Illusions to persist beyond death and zoning always.") RULE_CATEGORY_END() diff --git a/zone/attack.cpp b/zone/attack.cpp index ba7453836..854a4b6d4 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1894,7 +1894,10 @@ bool Client::Death(Mob* killerMob, int64 damage, uint16 spell, EQ::skills::Skill int32 illusion_spell_id = spellbonuses.Illusion; //this generates a lot of 'updates' to the client that the client does not need - BuffFadeNonPersistDeath(); + if (RuleB(Spells, BuffsFadeOnDeath)) { + BuffFadeNonPersistDeath(); + } + if (RuleB(Character, UnmemSpellsOnDeath)) { if ((ClientVersionBit() & EQ::versions::maskSoFAndLater) && RuleB(Character, RespawnFromHover)) UnmemSpellAll(true); diff --git a/zone/bot.cpp b/zone/bot.cpp index 36e037b85..5e913e6ee 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -398,7 +398,10 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to current_hp = max_hp; if(current_hp <= 0) { - BuffFadeNonPersistDeath(); + if (RuleB(Spells, BuffsFadeOnDeath)) { + BuffFadeNonPersistDeath(); + } + if (RuleB(Bots, ResurrectionSickness)) { int resurrection_sickness_spell_id = ( RuleB(Bots, OldRaceRezEffects) && diff --git a/zone/client_process.cpp b/zone/client_process.cpp index b5c56d2e6..bcc3137a0 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1020,7 +1020,10 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I name, (uint16)spells[SpellID].base_value[0], SpellID, ZoneID, InstanceID); - BuffFadeNonPersistDeath(); + if (RuleB(Spells, BuffsFadeOnDeath)) { + BuffFadeNonPersistDeath(); + } + int SpellEffectDescNum = GetSpellEffectDescNum(SpellID); // Rez spells with Rez effects have this DescNum (first is Titanium, second is 6.2 Client) if(RuleB(Character, UseResurrectionSickness) && SpellEffectDescNum == 82 || SpellEffectDescNum == 39067) { diff --git a/zone/mob.cpp b/zone/mob.cpp index 103989e4a..07b00830a 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -5330,11 +5330,14 @@ bool Mob::TrySpellOnDeath() if(spellbonuses.SpellOnDeath[i] && IsValidSpell(spellbonuses.SpellOnDeath[i])) { if(zone->random.Roll(static_cast(spellbonuses.SpellOnDeath[i + 1]))) { SpellFinished(spellbonuses.SpellOnDeath[i], this, EQ::spells::CastingSlot::Item, 0, -1, spells[spellbonuses.SpellOnDeath[i]].resist_difficulty); - } } } + } + + if (RuleB(Spells, BuffsFadeOnDeath)) { + BuffFadeNonPersistDeath(); + } - BuffFadeNonPersistDeath(); return false; //You should not be able to use this effect and survive (ALWAYS return false), //attempting to place a heal in these effects will still result