diff --git a/zone/client.h b/zone/client.h index 3a90e87eb..533db7b04 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1268,7 +1268,7 @@ protected: bool client_data_loaded; int16 GetFocusEffect(focusType type, uint16 spell_id); - int16 GetSympatheticFocusEffect(focusType type, uint16 spell_id); + uint16 GetSympatheticFocusEffect(focusType type, uint16 spell_id); Mob* bind_sight_target; diff --git a/zone/mob.cpp b/zone/mob.cpp index b4d28c6c0..2053594be 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -3615,36 +3615,41 @@ bool Mob::TryFadeEffect(int slot) void Mob::TrySympatheticProc(Mob *target, uint32 spell_id) { - if(target == nullptr || !IsValidSpell(spell_id)) + if(target == nullptr || !IsValidSpell(spell_id) || !IsClient()) return; - int focus_spell = CastToClient()->GetSympatheticFocusEffect(focusSympatheticProc,spell_id); + uint16 focus_spell = CastToClient()->GetSympatheticFocusEffect(focusSympatheticProc,spell_id); - if(IsValidSpell(focus_spell)){ - int focus_trigger = spells[focus_spell].base2[0]; - // For beneficial spells, if the triggered spell is also beneficial then proc it on the target - // if the triggered spell is detrimental, then it will trigger on the caster(ie cursed items) - if(IsBeneficialSpell(spell_id)) - { - if(IsBeneficialSpell(focus_trigger)) - SpellFinished(focus_trigger, target); + if(!IsValidSpell(focus_spell)) + return; - else - SpellFinished(focus_trigger, this, 10, 0, -1, spells[focus_trigger].ResistDiff); - } - // For detrimental spells, if the triggered spell is beneficial, then it will land on the caster - // if the triggered spell is also detrimental, then it will land on the target - else - { - if(IsBeneficialSpell(focus_trigger)) - SpellFinished(focus_trigger, this); + uint16 focus_trigger = GetSympatheticSpellProcID(focus_spell); - else - SpellFinished(focus_trigger, target, 10, 0, -1, spells[focus_trigger].ResistDiff); - } + if(!IsValidSpell(focus_trigger)) + return; - CheckNumHitsRemaining(NumHit::MatchingSpells, -1, focus_spell); - } + // For beneficial spells, if the triggered spell is also beneficial then proc it on the target + // if the triggered spell is detrimental, then it will trigger on the caster(ie cursed items) + if(IsBeneficialSpell(spell_id)) + { + if(IsBeneficialSpell(focus_trigger)) + SpellFinished(focus_trigger, target); + + else + SpellFinished(focus_trigger, this, 10, 0, -1, spells[focus_trigger].ResistDiff); + } + // For detrimental spells, if the triggered spell is beneficial, then it will land on the caster + // if the triggered spell is also detrimental, then it will land on the target + else + { + if(IsBeneficialSpell(focus_trigger)) + SpellFinished(focus_trigger, this); + + else + SpellFinished(focus_trigger, target, 10, 0, -1, spells[focus_trigger].ResistDiff); + } + + CheckNumHitsRemaining(NumHit::MatchingSpells, -1, focus_spell); } int32 Mob::GetItemStat(uint32 itemid, const char *identifier) diff --git a/zone/mob.h b/zone/mob.h index 6d7b386cf..979d9728a 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -1063,6 +1063,8 @@ protected: void PrintRoute(); virtual float GetSympatheticProcChances(uint16 spell_id, int16 ProcRateMod, int32 ItemProcRate = 0); + int16 GetSympatheticSpellProcRate(uint16 spell_id); + uint16 GetSympatheticSpellProcID(uint16 spell_id); enum {MAX_PROCS = 4}; tProc PermaProcs[MAX_PROCS]; diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index e03d5672a..21ba36e0a 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -5177,7 +5177,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo return(value*lvlModifier/100); } -int16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) { +uint16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) { if (IsBardSong(spell_id)) return 0; @@ -5253,7 +5253,7 @@ int16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) { if (IsValidSpell(proc_spellid)){ - ProcChance = GetSympatheticProcChances(spell_id, spells[focusspellid].base[0]); + ProcChance = GetSympatheticProcChances(spell_id, GetSympatheticSpellProcRate(spell_id)); if(zone->random.Roll(ProcChance)) SympatheticProcList.push_back(proc_spellid); } @@ -5929,6 +5929,26 @@ float Mob::GetSympatheticProcChances(uint16 spell_id, int16 ProcRateMod, int32 I return ProcChance; } +int16 Mob::GetSympatheticSpellProcRate(uint16 spell_id) +{ + for (int i = 0; i < EFFECT_COUNT; i++){ + if (spells[spell_id].effectid[i] == SE_SympatheticProc) + return spells[spell_id].base[i]; + } + + return 0; +} + +uint16 Mob::GetSympatheticSpellProcID(uint16 spell_id) +{ + for (int i = 0; i < EFFECT_COUNT; i++){ + if (spells[spell_id].effectid[i] == SE_SympatheticProc) + return spells[spell_id].base2[i]; + } + + return 0; +} + bool Mob::DoHPToManaCovert(uint16 mana_cost) { if (spellbonuses.HPToManaConvert){