From 0b18671e91dae712046a4ec9b021724b5804455e Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sun, 24 Oct 2021 17:07:25 -0400 Subject: [PATCH] [Spells] Update to how Bard Instrument mods are applied to spell effects (#1628) * new instrument mod spell effect checks PR split * format * Update spdat.cpp correction, all direct damage spells get modifiers. Made a mistake with the parse, was using wrong mod. * restriction changes cure effects can be modified. decided to keep a list of known effects that are not modified to return false. and will keep the default to be true for anything as to not inhibit custom bard song development * SE_ProcChance is modified * Update spdat.cpp * update * Update spell_effects.cpp --- common/spdat.cpp | 93 ++++++++++++++++++++++++++++++++++++++++++ common/spdat.h | 1 + zone/spell_effects.cpp | 13 ++---- 3 files changed, 97 insertions(+), 10 deletions(-) diff --git a/common/spdat.cpp b/common/spdat.cpp index 7c3476505..1fb54b0dd 100644 --- a/common/spdat.cpp +++ b/common/spdat.cpp @@ -1366,6 +1366,99 @@ bool SpellRequiresTarget(int spell_id) return true; } +bool IsInstrumentModAppliedToSpellEffect(int32 spell_id, int effect) +{ + + //Effects that are verified modifiable by bard instrument/singing mods, or highly likely due to similiar type of effect. + switch (effect) { + + //Only modify instant endurance or mana effects (Ie. Mana drain, Crescendo line) + case SE_CurrentEndurance: + case SE_CurrentMana: { + if (spells[spell_id].buffduration == 0) { + return true; + } + //Mana regen is not modified. + return false; + } + + case SE_CurrentHP: + case SE_ArmorClass: + case SE_ACv2: + case SE_MovementSpeed: + case SE_ATK: + case SE_STR: + case SE_DEX: + case SE_AGI: + case SE_STA: + case SE_INT: + case SE_WIS: + case SE_CHA: + case SE_AllStats: + case SE_ResistFire: + case SE_ResistCold: + case SE_ResistPoison: + case SE_ResistDisease: + case SE_ResistMagic: + case SE_ResistAll: + case SE_ResistCorruption: + case SE_Rune: + case SE_AbsorbMagicAtt: + case SE_DamageShield: + case SE_MitigateDamageShield: + case SE_Amplification: //On live Amplification is modified by singing mods, including itself. + case SE_TripleAttackChance: + case SE_Flurry: + case SE_DamageModifier: + case SE_DamageModifier2: + case SE_MinDamageModifier: + case SE_ProcChance: + case SE_PetFlurry: // ? Need verified + case SE_DiseaseCounter: + case SE_PoisonCounter: + case SE_CurseCounter: + case SE_CorruptionCounter: + return true; + + /* + Following are confirmed NOT modifiable by instrument/singing mods. + Focus Effects, Proc Effects, Spell Triggers are not modified but handled elsewhere, not neccessary to checked here. + */ + + case SE_AttackSpeed: //(Haste AND Slow not modifiable) + case SE_AttackSpeed2: + case SE_AttackSpeed3: + case SE_Lull: + case SE_ChangeFrenzyRad: + case SE_Harmony: + case SE_AddFaction: + //case SE_CurrentMana: // duration only + case SE_ManaRegen_v2: + //case SE_CurrentEndurance: // duration only + case SE_PersistentEffect: + case SE_ReduceReuseTimer: + case SE_Stun: + case SE_Mez: + case SE_WipeHateList: //? + case SE_CancelMagic: + case SE_ManaAbsorbPercentDamage: + case SE_ResistSpellChance: + case SE_Reflect: + case SE_MitigateSpellDamage: + case SE_MitigateMeleeDamage: + case SE_AllInstrumentMod: + case SE_AddSingingMod: + case SE_SongModCap: + case SE_BardSongRange: + case SE_TemporaryPets: + case SE_SpellOnDeath: + return false; + default: + return true; + } + //Allowing anything not confirmed to be restricted / allowed to receive modifiers, as to not inhbit anyone making custom bard songs. +} + int GetSpellStatValue(uint32 spell_id, const char* stat_identifier, uint8 slot) { if (!IsValidSpell(spell_id)) diff --git a/common/spdat.h b/common/spdat.h index c6c9df888..d4b858ee0 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -1509,6 +1509,7 @@ bool IsCastWhileInvis(uint16 spell_id); bool IsEffectIgnoredInStacking(int spa); bool IsFocusLimit(int spa); bool SpellRequiresTarget(int targettype); +bool IsInstrumentModAppliedToSpellEffect(int32 spell_id, int effect); int CalcPetHp(int levelb, int classb, int STA = 75); int GetSpellEffectDescNum(uint16 spell_id); diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 68c04432b..14385dff3 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -3360,16 +3360,9 @@ int Mob::CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level, effect_value = CalcSpellEffectValue_formula(formula, base, max, caster_level, spell_id, ticsremaining); // this doesn't actually need to be a song to get mods, just the right skill - if (EQ::skills::IsBardInstrumentSkill(spells[spell_id].skill) && - spells[spell_id].effectid[effect_id] != SE_AttackSpeed && - spells[spell_id].effectid[effect_id] != SE_AttackSpeed2 && - spells[spell_id].effectid[effect_id] != SE_AttackSpeed3 && - spells[spell_id].effectid[effect_id] != SE_Lull && - spells[spell_id].effectid[effect_id] != SE_ChangeFrenzyRad && - spells[spell_id].effectid[effect_id] != SE_Harmony && - spells[spell_id].effectid[effect_id] != SE_CurrentMana && - spells[spell_id].effectid[effect_id] != SE_ManaRegen_v2 && - spells[spell_id].effectid[effect_id] != SE_AddFaction) { + if (EQ::skills::IsBardInstrumentSkill(spells[spell_id].skill) + && IsInstrumentModAppliedToSpellEffect(spell_id, spells[spell_id].effectid[effect_id])){ + int oval = effect_value; int mod = ApplySpellEffectiveness(spell_id, instrument_mod, true, caster_id);