View Single Post
  #15  
Old 07-29-2015, 01:25 PM
image
Demi-God
 
Join Date: Jan 2002
Posts: 1,290
Default

Edit: guess eqemu current might use 'instrument_mod' in the buff struct, demonstar can enlighten us to the changes as all I saw was 'update' :P









The problem is the instrument calculation should be done and saved for the duration of the spell, not requiring the instrument each tic. The instrument does not 'save' on the buff in eqemu code.

I have this on my server, but I am on a slightly older code base. Pretty much you have to create an array in the buff structure for the bardMod value.

eg in Buffs_Struct
int bardMod[EFFECT_COUNT];

the setting of the bardMod was handled in spell_effects.cpp Mob::CalcSpellEffectValue


Code:
int Mob::CalcSpellEffectValue(int16 spell_id, int buffID, int effect_id, int caster_level, Mob *caster, int ticsremaining)
{
	int formula, base, max, effect_value;

	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];

	if(IsBlankSpellEffect(spell_id, effect_id))
		return 0;

	effect_value = CalcSpellEffectValue_formula(formula, base, max, caster_level, spell_id, ticsremaining);

	if(caster && IsBardSong(spell_id) &&
		(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) //&& 
		// Kings & Bandits - EQEmu revision 1883 - The mana regen portion of bard songs is no longer affected by instrument mods.
		/*(spells[spell_id].effectid[effect_id] != SE_CurrentMana)*/) {
			int oval = effect_value;
			if ( buffID > -1 && buffID < BUFF_COUNT )
			{
				if ( buffs[buffID].bardMod[effect_id] == 0 )
				{
					int mod = caster->GetInstrumentMod(spell_id);
					effect_value = effect_value * mod / 10;
					mlog(SPELLS__BARDS, "Effect value %d altered with bard modifier of %d to yield %d with buffid %i", oval, mod, effect_value, buffID);
					buffs[buffID].bardMod[effect_id] = mod;
				}
				else
				{
					int mod = caster->GetInstrumentMod(spell_id);
					if ( mod > buffs[buffID].bardMod[effect_id] )
						buffs[buffID].bardMod[effect_id] = mod;

					effect_value = effect_value * buffs[buffID].bardMod[effect_id] / 10;
					mlog(SPELLS__BARDS, "Effect value altered %d with existing bard modifier of %d to yield %d with buffid %i", oval, buffs[buffID].bardMod[effect_id], effect_value, buffID);
				}
			}
			else
			{
					int mod = caster->GetInstrumentMod(spell_id);
					effect_value = effect_value * mod / 10;
					mlog(SPELLS__BARDS, "Effect value %d altered with bard modifier of %d to yield %d", oval, mod, effect_value);
			}
	}

	return(effect_value);
}
in the initialize of the buffs you have to zero the array out of course..eg Client::InitializeBuffSlots in the for loop add

for(int i=0;i<EFFECT_COUNT;i++)
buffs[x].bardMod[i] = 0;

there are probably multiple other places where we 'nullify' out buffs as well that varies on the code base (current/past).
__________________
www.eq2emu.com
EQ2Emu Developer
Former EQEMu Developer / GuildWars / Zek Seasons Servers
Member of the "I hate devn00b" club.
Reply With Quote