From 62b5f8a48871925b338cd81c22f90520e90a22b9 Mon Sep 17 00:00:00 2001 From: Fryguy Date: Tue, 9 Jan 2024 05:49:10 -0500 Subject: [PATCH] [Rules] Classic Spell Data SPA Calc variability (#3931) * [Rules] Classic Spell Data SPA Calc variability When using lucy imports of older more classic data, they lack the limit values which provides Focus Random Effectiveness. Example: Bazu Plauge (6472) went from a 40 limit to 0 limit on the 2006 lucy import. Lucy does have limit value data, but it appears the affected SPAs sony handled in source vs in spell data. * Requested Changes --- common/ruletypes.h | 1 + zone/spell_effects.cpp | 61 +++++++++++++++++++++++++++++------------- 2 files changed, 44 insertions(+), 18 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 67d6ea4a8..21fdb5f92 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -482,6 +482,7 @@ RULE_BOOL(Spells, RequireMnemonicRetention, true, "Enabling will require spell s RULE_BOOL(Spells, EvacClearCharmPet, false, "Enable to have evac in zone clear charm from charm pets and detach buffs.") RULE_BOOL(Spells, ManaTapsRequireNPCMana, false, "Enabling will require target to have mana to tap. Default off as many npc's are caster class with 0 mana and need fixed.") RULE_INT(Spells, HarmTouchCritRatio, 200, "Harmtouch crit bonus, on top of BaseCritRatio") +RULE_BOOL(Spells, UseClassicSpellFocus, false, "Enabling will tell the server to handle random focus damage as classic spell imports lack the limit values.") RULE_CATEGORY_END() RULE_CATEGORY(Combat) diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 9a5e84661..4cef42be2 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -5892,16 +5892,19 @@ int64 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo // handle effects case SE_ImprovedDamage: - if (type == focusImprovedDamage) { - value = GetFocusRandomEffectivenessValue(focus_spell.base_value[i], focus_spell.limit_value[i], best_focus); - } - break; - case SE_ImprovedDamage2: - if (type == focusImprovedDamage2) { - value = GetFocusRandomEffectivenessValue(focus_spell.base_value[i], focus_spell.limit_value[i], best_focus); + if (!RuleB(Spells, UseClassicSpellFocus)) { + if (type == focusImprovedDamage || type == focusImprovedDamage2) { + value = GetFocusRandomEffectivenessValue(focus_spell.base_value[i], focus_spell.limit_value[i], best_focus); + } + break; + } else { + if (best_focus) { + value = focus_spell.base_value[i]; + } else { + value = zone->random.Int(1, focus_spell.base_value[i]); + } } - break; case SE_Fc_Amplify_Mod: if (type == focusFcAmplifyMod && focus_spell.base_value[i] > value) { @@ -5910,14 +5913,18 @@ int64 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo break; case SE_ImprovedHeal: - if (type == focusImprovedHeal) { - value = GetFocusRandomEffectivenessValue(focus_spell.base_value[i], focus_spell.limit_value[i], best_focus); - } - break; - case SE_ReduceManaCost: - if (type == focusManaCost) { - value = GetFocusRandomEffectivenessValue(focus_spell.base_value[i], focus_spell.limit_value[i], best_focus); + if (!RuleB(Spells, UseClassicSpellFocus)) { + if (type == focusImprovedHeal || type == focusManaCost) { + value = GetFocusRandomEffectivenessValue(focus_spell.base_value[i], focus_spell.limit_value[i], best_focus); + } + break; + } + + if (best_focus) { + value = focus_spell.base_value[i]; + } else { + value = zone->random.Int(1, focus_spell.base_value[i]); } break; @@ -5967,8 +5974,15 @@ int64 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo break; case SE_ReduceReagentCost: - if (type == focusReagentCost) { - value = GetFocusRandomEffectivenessValue(focus_spell.base_value[i], focus_spell.limit_value[i], best_focus); + if (!RuleB(Spells, UseClassicSpellFocus)) { + if (type == focusReagentCost) { + value = GetFocusRandomEffectivenessValue(focus_spell.base_value[i], focus_spell.limit_value[i], best_focus); + } + break; + } + + if (type == focusReagentCost && focus_spell.base_value[i] > value) { + value = focus_spell.base_value[i]; } break; @@ -5991,8 +6005,19 @@ int64 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo break; case SE_SpellHateMod: + if (!RuleB(Spells, UseClassicSpellFocus)) { + if (type == focusSpellHateMod) { + value = GetFocusRandomEffectivenessValue(focus_spell.base_value[i], focus_spell.limit_value[i], best_focus); + } + break; + } + if (type == focusSpellHateMod) { - value = GetFocusRandomEffectivenessValue(focus_spell.base_value[i], focus_spell.limit_value[i], best_focus); + if (best_focus) { + value = focus_spell.base_value[i]; + } else { + value = zone->random.Int(1, focus_spell.base_value[i]); + } } break;