Yea actually, I needed to fix it as it was easy to get working for single effect spells like Ice Comet(DD) or Horror(DoT) but for spells like
Ikaav Venom which have a DD and a DoT component, that was my problem. Then I noticed we have access to the bufftic so it was easy to seperate out those effects and now it is working 100%(as far as I can see), with the added support for SE_SpellVulnerability(or Increase Incoming Spell Damage). This also truly fixes the spell runes being used on DoT ticks as well.
edit... spoke too soon, SpellVulnerability works on clients but doesnt affect nukes cast on NPCs it seems. maybe I can fix it before my edit timer runs out...
... looks like the problem is with the focus code as it only increases spells you can cast on yourself, will have to look into alternative way of limiting what spells are affected by the vulnerability.
Ignore the previous code...
spell effects.cpp - line 2810 - add this
Code:
case SE_SpellVulnerability:
spell effects.cpp - line 3853 - add this
Code:
case SE_SpellVulnerability:
{
if(type == focusSpellVulnerability)
{
value = 1;
}
break;
}
mob.h - line 90 - add this
Code:
focusSpellVulnerability,
mob.h - line 843 - alter this
Code:
sint32 ReduceMagicalDamage(sint32 damage);
to this:
Code:
sint32 AffectMagicalDamage(sint32 damage, int16 spell_id, const bool iBuffTic);
attack.ccp - line 3189 - alter this
Code:
damage = ReduceMagicalDamage(damage);
to this:
Code:
damage = AffectMagicalDamage(damage, spell_id, iBuffTic);
attack.cpp - line 2932 - replace this function
Code:
sint32 Mob::ReduceMagicalDamage(sint32 damage)
{
...
}
with this:
Code:
sint32 Mob::AffectMagicalDamage(sint32 damage, int16 spell_id, const bool iBuffTic)
{
if(damage <= 0)
{
return damage;
}
// Increase magical damage before runes
uint32 buff_count = GetMaxTotalSlots();
for(int i = 0; i < buff_count; i++)
{
if(IsEffectInSpell(buffs[i].spellid, SE_SpellVulnerability))
{
sint32 focus = CalcFocusEffect(focusSpellVulnerability, buffs[i].spellid, spell_id);
if(focus == 1)
{
damage += damage * spells[buffs[i].spellid].base[0] / 100;
}
}
}
// If this is a DoT, use DoT Shielding...
if(iBuffTic)
{
damage -= (damage * this->itembonuses.DoTShielding / 100);
}
// This must be a DD then so lets apply Spell Shielding and all the various runes that can block or negate DD spells.
else
{
// See if we block the spell outright first
int slot = GetBuffSlotFromType(SE_NegateAttacks);
if(slot >= 0 && buffs[slot].magic_rune > 0)
{
if(--buffs[slot].melee_rune == 0)
{
BuffFadeBySlot(slot);
UpdateRuneFlags();
}
return -6;
}
// Reduce damage by the Spell Shielding first so that the runes don't take the raw damage.
damage -= (damage * this->itembonuses.SpellDamageShield / 100);
// Do runes now.
slot = GetBuffSlotFromType(SE_MitigateSpellDamage);
if(slot >= 0)
{
int damage_to_reduce = damage * GetPartialMagicRuneReduction(buffs[slot].spellid) / 100;
if(damage_to_reduce > buffs[slot].magic_rune)
{
mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MitigateSpellDamage %d damage negated, %d"
" damage remaining, fading buff.", damage_to_reduce, buffs[slot].magic_rune);
damage -= damage_to_reduce;
BuffFadeBySlot(slot);
UpdateRuneFlags();
}
else
{
mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d"
" damage remaining.", damage_to_reduce, buffs[slot].magic_rune);
buffs[slot].magic_rune = (buffs[slot].magic_rune - damage_to_reduce);
damage -= damage_to_reduce;
}
}
if(damage < 1)
{
return -6;
}
slot = GetBuffSlotFromType(SE_AbsorbMagicAtt);
while(slot >= 0)
{
int16 magic_rune_left = buffs[slot].magic_rune;
if(magic_rune_left >= damage)
{
magic_rune_left -= damage;
damage = 0;
buffs[slot].magic_rune = magic_rune_left;
break;
}
else
{
if(magic_rune_left > 0)
damage -= magic_rune_left;
BuffFadeBySlot(slot);
slot = GetBuffSlotFromType(SE_AbsorbMagicAtt);
UpdateRuneFlags();
}
}
}
return damage;
}