From 41d9a15c74c2a0bebd4aa3cabee6eda2f29ab756 Mon Sep 17 00:00:00 2001 From: Fryguy Date: Sun, 7 Jan 2024 12:12:15 -0500 Subject: [PATCH] [Bug Fix] Vampiric Embrace Fixes (#3873) * [Bug Fix] Vampiric Embrace Fixes Fixed the difference of procs for Vampiric Embrace between Necros and Shadow Knights. * Space * Cleanup * Update spdat.h --------- Co-authored-by: Kinglykrab --- common/spdat.h | 2 ++ zone/spell_effects.cpp | 23 +++++++++++++++++------ zone/spells.cpp | 17 ++++++++++++++--- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/common/spdat.h b/common/spdat.h index b8d2619de..a427a1126 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -202,6 +202,8 @@ #define SPELL_GUIDE_LEVITATION 39852 #define SPELL_GUIDE_SPELL_HASTE 39853 #define SPELL_GUIDE_HASTE 39854 +#define SPELL_VAMPIRIC_EMBRACE 821 +#define SPELL_VAMPIRIC_EMBRACE_OF_SHADOW 822 //spellgroup ids #define SPELLGROUP_FRENZIED_BURNOUT 2754 diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index a43ea8479..849e10a63 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -1877,11 +1877,16 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove case SE_AddMeleeProc: case SE_WeaponProc: { - uint16 procid = GetProcID(spell_id, i); + uint16 proc_id = GetProcID(spell_id, i); #ifdef SPELL_EFFECT_SPAM snprintf(effect_desc, _EDLEN, "Weapon Proc: %s (id %d)", spells[effect_value].name, procid); #endif - AddProcToWeapon(procid, false, 100 + spells[spell_id].limit_value[i], spell_id, caster_level, GetSpellProcLimitTimer(spell_id, ProcType::MELEE_PROC)); + // Special case for Vampiric Embrace. If this is a Shadow Knight, the proc is different. + if (proc_id == SPELL_VAMPIRIC_EMBRACE && GetClass() == Class::ShadowKnight) { + proc_id = SPELL_VAMPIRIC_EMBRACE_OF_SHADOW; + } + + AddProcToWeapon(proc_id, false, 100 + spells[spell_id].limit_value[i], spell_id, caster_level, GetSpellProcLimitTimer(spell_id, ProcType::MELEE_PROC)); break; } @@ -3721,7 +3726,7 @@ snare has both of them negative, yet their range should work the same: case 144: // Level 40+ Harm Touch result = ubase + (caster_level * 10) + (caster_level - 40) * 20; break; - + //these are used in stacking effects... formula unknown case 201: case 203: @@ -4246,8 +4251,14 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses) case SE_AddMeleeProc: case SE_WeaponProc: { - uint16 procid = GetProcID(buffs[slot].spellid, i); - RemoveProcFromWeapon(procid, false); + uint16 proc_id = GetProcID(buffs[slot].spellid, i); + + // Special case for Vampiric Embrace. If this is a Shadow Knight, the proc is different. + if (proc_id == SPELL_VAMPIRIC_EMBRACE && GetClass() == Class::ShadowKnight) { + proc_id = SPELL_VAMPIRIC_EMBRACE_OF_SHADOW; + } + + RemoveProcFromWeapon(proc_id, false); break; } @@ -7099,7 +7110,7 @@ bool Mob::TryDeathSave() { } else { entity_list.MessageCloseString(this, false, 200, Chat::MeleeCrit, DEATH_PACT, GetCleanName()); } - + SendHPUpdate(); BuffFadeBySlot(buffSlot); return true; diff --git a/zone/spells.cpp b/zone/spells.cpp index c1fc75166..612aae0d3 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -316,7 +316,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot, Mob* pMob = nullptr; int32 orgcasttime; - if(!IsValidSpell(spell_id)) { + if (!IsValidSpell(spell_id)) { InterruptSpell(); return(false); } @@ -6168,8 +6168,14 @@ bool Mob::IsCombatProc(uint16 spell_id) { } bool Mob::AddProcToWeapon(uint16 spell_id, bool bPerma, uint16 iChance, uint16 base_spell_id, int level_override, uint32 proc_reuse_time) { - if(!IsValidSpell(spell_id)) - return(false); + if(!IsValidSpell(spell_id)) { + return false; + } + + // Special case for Vampiric Embrace. If this is a Shadow Knight, the proc is different. + if (spell_id == SPELL_VAMPIRIC_EMBRACE && GetClass() == Class::ShadowKnight) { + spell_id = SPELL_VAMPIRIC_EMBRACE_OF_SHADOW; + } int i; if (bPerma) { @@ -6222,6 +6228,11 @@ bool Mob::AddProcToWeapon(uint16 spell_id, bool bPerma, uint16 iChance, uint16 b } bool Mob::RemoveProcFromWeapon(uint16 spell_id, bool bAll) { + // Special case for Vampiric Embrace. If this is a Shadow Knight, the proc is different. + if (spell_id == SPELL_VAMPIRIC_EMBRACE && GetClass() == Class::ShadowKnight) { + spell_id = SPELL_VAMPIRIC_EMBRACE_OF_SHADOW; + } + for (int i = 0; i < m_max_procs; i++) { if (bAll || SpellProcs[i].spellID == spell_id) { SpellProcs[i].spellID = SPELL_UNKNOWN;