This also includes a fix for the spell rune effects(
Bulwark of Alendar) as they were incorrectly also reducing the damage on DoTs.
edit... this didnt fix the problem with spell runes.
edit2... also doesnt seem to apply properly to DoTs and DD, just does the highest one to both(yay for testing at cap for both stats). its late so will fix tomorrow
code...
mob.h - alter this - line 842
Code:
sint32 ReduceMagicalDamage(sint32 damage);
to this
Code:
sint32 ReduceMagicalDamage(sint32 damage, int16 spell_id);
attack.cpp - alter this - line 3177
Code:
damage = ReduceMagicalDamage(damage);
to this
Code:
damage = ReduceMagicalDamage(damage, spell_id);
attack.cpp - alter this - line 2932
Code:
sint32 Mob::ReduceMagicalDamage(sint32 damage)
{
if(damage <= 0 || (!HasSpellRune() && !HasPartialSpellRune()))
{
return damage;
}
int slot = GetBuffSlotFromType(SE_NegateAttacks);
if(slot >= 0 && buffs[slot].magic_rune > 0)
{
if(--buffs[slot].melee_rune == 0)
{
BuffFadeBySlot(slot);
UpdateRuneFlags();
}
return -6;
}
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);
}
to this
Code:
sint32 Mob::ReduceMagicalDamage(sint32 damage, int16 spell_id)
{
if(damage <= 0 || (!HasSpellRune() && !HasPartialSpellRune()) && this->itembonuses.SpellDamageShield == 0 && this->itembonuses.DoTShielding == 0)
{
return damage;
}
int slot = GetBuffSlotFromType(SE_NegateAttacks);
if(slot >= 0 && buffs[slot].magic_rune > 0)
{
if(--buffs[slot].melee_rune == 0)
{
BuffFadeBySlot(slot);
UpdateRuneFlags();
}
return -6;
}
for(int i = 0; i < EFFECT_COUNT; i++)
{
// Isolate the Direct Damage effects to be reduced by spell shielding and spell rune effects.
if ((spells[spell_id].buffduration == 0 && spells[spell_id].effectid[i] == SE_CurrentHP) || (spells[spell_id].buffduration > 0 && spells[spell_id].effectid[i] == SE_CurrentHPOnce))
{
damage -= (damage * this->itembonuses.SpellDamageShield / 100);
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);
}
// Isolate the DoT effects to be reduced by DoT shielding.
else if (spells[spell_id].buffduration > 0 && spells[spell_id].effectid[i] == SE_CurrentHP)
{
damage -= (damage * this->itembonuses.DoTShielding / 100);
return(damage);
}
}
return(damage);
}