[BugFix] Fix for bard song instrument mod formula from recent update (#1654)

* Update spell_effects.cpp

* Update spell_effects.cpp

* Update spell_effects.cpp
This commit is contained in:
KayenEQ 2021-10-30 08:50:15 -04:00 committed by GitHub
parent f9855fd097
commit 4389f84ea5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3329,14 +3329,14 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
int Mob::CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level, uint32 instrument_mod, Mob *caster,
int ticsremaining, uint16 caster_id)
{
int formula, base, max, effect_value, oval;
if (!IsValidSpell(spell_id) || effect_id < 0 || effect_id >= EFFECT_COUNT)
return 0;
formula = spells[spell_id].formula[effect_id];
base = spells[spell_id].base[effect_id];
max = spells[spell_id].max[effect_id];
int formula = spells[spell_id].formula[effect_id];
int base = spells[spell_id].base[effect_id];
int max = spells[spell_id].max[effect_id];
int effect_value = 0;
int oval = 0;
if (IsBlankSpellEffect(spell_id, effect_id))
return 0;
@ -3345,32 +3345,31 @@ int Mob::CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level,
// this doesn't actually need to be a song to get mods, just the right skill
if (EQ::skills::IsBardInstrumentSkill(spells[spell_id].skill)
&& IsInstrumentModAppliedToSpellEffect(spell_id, spells[spell_id].effectid[effect_id])){
&& IsInstrumentModAppliedToSpellEffect(spell_id, spells[spell_id].effectid[effect_id])) {
oval = effect_value;
effect_value = effect_value * instrument_mod / 10;
LogSpells("Effect value [{}] altered with bard modifier of [{}] to yeild [{}]",
oval, instrument_mod, effect_value);
oval = effect_value;
effect_value = effect_value * static_cast<int>(instrument_mod) / 10;
LogSpells("Effect value [{}] altered with bard modifier of [{}] to yeild [{}]",
oval, instrument_mod, effect_value);
}
/*
SPA 413 SE_FcBaseEffects, modifies base value of a spell effect after formula calcultion, but before other focuses.
This is applied to non-Bards in Mob::GetInstrumentMod
Like bard modifiers, this is sent in the action_struct using action->instrument_mod (which is a base effect modifier)
Issue: value sent with action->instrument_mod needs to be 10 or higher. Therefore lowest possible percent chance would be 11 (calculated to 10%)
there are modern spells that use less than 10% but we send as a uint where lowest value has to be 10, where it should be a float for current clients.
there are modern spells that use less than 10% but we send as a uint where lowest value has to be 10, where it should be a float for current clients.
Though not ideal, at the moment for spells that are instant effects, the action packet doesn't matter and we will calculate the actual percent here correctly.
Logic here is, caster_id is only sent from ApplySpellBonuses. Thus if it is a buff a long as the base effects is set to over 10% and at +10% intervals
it will focus the base value correctly.
*/
if (GetClass() != BARD) {
if (caster_id && instrument_mod > 10) {
//This is checked from Mob::ApplySpellBonuses, applied to buffs that receive bonuses. See above, must be in 10% intervals to work.
oval = effect_value;
effect_value = effect_value * instrument_mod / 10;
effect_value = effect_value * static_cast<int>(instrument_mod) / 10;
LogSpells("Bonus Effect value [{}] altered with base effects modifier of [{}] to yeild [{}]",
oval, instrument_mod, effect_value);
@ -3389,7 +3388,7 @@ int Mob::CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level,
}
effect_value = mod_effect_value(effect_value, spell_id, spells[spell_id].effectid[effect_id], caster, caster_id);
return effect_value;
}