From 3b0fa015a73fc6ac7b36258493849f2e8ae4c706 Mon Sep 17 00:00:00 2001 From: Fryguy Date: Mon, 22 Jul 2024 06:26:40 -0400 Subject: [PATCH] [Bug Fix] Corpse Call removing Resurrection Effects (#4410) * [Bug Fix] Corpse Call removing Rez Effects When calling a corpse, it should not remove rez effects. * Update client_process.cpp --------- Co-authored-by: Kinglykrab --- zone/client_process.cpp | 58 +++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 73236536c..532669476 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1032,32 +1032,62 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I name, (uint16)spells[SpellID].base_value[0], SpellID, ZoneID, InstanceID); - if (RuleB(Spells, BuffsFadeOnDeath)) { - BuffFadeNonPersistDeath(); - } + const bool use_old_resurrection = ( + RuleB(Character, UseOldRaceRezEffects) && + ( + GetRace() == Race::Barbarian || + GetRace() == Race::Dwarf || + GetRace() == Race::Troll || + GetRace() == Race::Ogre + ) + ); + + const uint16 resurrection_sickness_spell_id = ( + use_old_resurrection ? + RuleI(Character, OldResurrectionSicknessSpellID) : + RuleI(Character, ResurrectionSicknessSpellID) + ); int SpellEffectDescNum = GetSpellEffectDescriptionNumber(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) { SetHP(GetMaxHP() / 5); SetMana(0); - int resurrection_sickness_spell_id = ( - RuleB(Character, UseOldRaceRezEffects) && - ( - GetRace() == BARBARIAN || - GetRace() == DWARF || - GetRace() == TROLL || - GetRace() == OGRE - ) ? - RuleI(Character, OldResurrectionSicknessSpellID) : - RuleI(Character, ResurrectionSicknessSpellID) - ); + + if (RuleB(Spells, BuffsFadeOnDeath)) { + BuffFadeNonPersistDeath(); + } + SpellOnTarget(resurrection_sickness_spell_id, this); } else if (SpellID == SPELL_DIVINE_REZ) { + if (RuleB(Spells, BuffsFadeOnDeath)) { + BuffFadeNonPersistDeath(); + } + RestoreHealth(); RestoreMana(); RestoreEndurance(); } else { + if (RuleB(Character, UseResurrectionSickness)) { + bool has_resurrection_sickness = false; + + for (int slot = 0; slot < GetMaxTotalSlots(); slot++) { + if (IsValidSpell(buffs[slot].spellid) && IsResurrectionSicknessSpell(buffs[slot].spellid)){ + has_resurrection_sickness = true; + break; + } + } + + // Need to wipe buffs after checking if client had rez effects. + if (RuleB(Spells, BuffsFadeOnDeath)) { + BuffFadeNonPersistDeath(); + } + + if (has_resurrection_sickness) { + SpellOnTarget(resurrection_sickness_spell_id, this); + } + } + SetHP(GetMaxHP() / 20); SetMana(GetMaxMana() / 20); SetEndurance(GetMaxEndurance() / 20);