new code for the following effects:
1.) SE_ImprovedSpellEffect
2.) SE_BossSpellTrigger
3.) SE_CastOnWearoff
4.) SE_EffectOnFade
1, 2, 3 - Trigger when the spells duration is over.
3 & 4 - Can also trigger when the spell fades before its duration(ie rune spell being used up).
mob.h
Code:
Index: mob.h
===================================================================
--- mob.h (revision 1597)
+++ mob.h (working copy)
@@ -778,6 +778,7 @@
bool TryDeathSave();
void DoBuffWearOffEffect(uint32 index);
void TryTriggerOnCast(Mob *target, uint32 spell_id);
+ bool TryFadeEffect(int slot);
static int32 GetAppearanceValue(EmuAppearance iAppearance);
void SendAppearancePacket(int32 type, int32 value, bool WholeZone = true, bool iIgnoreSelf = false, Client *specific_target=NULL);
mob.cpp
Code:
Index: mob.cpp
===================================================================
--- mob.cpp (revision 1597)
+++ mob.cpp (working copy)
@@ -3036,4 +3036,25 @@
}
}
}
+}
+
+bool Mob::TryFadeEffect(int slot)
+{
+ if(slot)
+ {
+ for(int i = 0; i < EFFECT_COUNT; i++)
+ {
+ if (spells[buffs[slot].spellid].effectid[i] == SE_CastOnWearoff || spells[buffs[slot].spellid].effectid[i] == SE_EffectOnFade)
+ {
+ int16 spell_id = spells[buffs[slot].spellid].base[i];
+ BuffFadeBySlot(slot);
+ if(spell_id)
+ {
+ ExecWeaponProc(spell_id, this);
+ return true;
+ }
+ }
+ }
+ }
+ return false;
}
\ No newline at end of file
attack.cpp
Code:
Index: attack.cpp
===================================================================
--- attack.cpp (revision 1597)
+++ attack.cpp (working copy)
@@ -2873,7 +2873,8 @@
{
if(--buffs[slot].melee_rune == 0)
{
- BuffFadeBySlot(slot);
+ if(!TryFadeEffect(slot))
+ BuffFadeBySlot(slot);
UpdateRuneFlags();
}
return -6;
@@ -2888,7 +2889,8 @@
mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d"
" damage remaining, fading buff.", damage_to_reduce, buffs[slot].melee_rune);
damage -= damage_to_reduce;
- BuffFadeBySlot(slot);
+ if(!TryFadeEffect(slot))
+ BuffFadeBySlot(slot);
UpdateRuneFlags();
}
else
@@ -2920,7 +2922,8 @@
{
if(melee_rune_left > 0)
damage -= melee_rune_left;
- BuffFadeBySlot(slot);
+ if(!TryFadeEffect(slot))
+ BuffFadeBySlot(slot);
slot = GetBuffSlotFromType(SE_Rune);
UpdateRuneFlags();
}
@@ -2941,7 +2944,8 @@
{
if(--buffs[slot].melee_rune == 0)
{
- BuffFadeBySlot(slot);
+ if(!TryFadeEffect(slot))
+ BuffFadeBySlot(slot);
UpdateRuneFlags();
}
return -6;
@@ -2956,7 +2960,8 @@
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);
+ if(!TryFadeEffect(slot))
+ BuffFadeBySlot(slot);
UpdateRuneFlags();
}
else
@@ -2988,7 +2993,8 @@
{
if(magic_rune_left > 0)
damage -= magic_rune_left;
- BuffFadeBySlot(slot);
+ if(!TryFadeEffect(slot))
+ BuffFadeBySlot(slot);
slot = GetBuffSlotFromType(SE_AbsorbMagicAtt);
UpdateRuneFlags();
}
spell effects
Code:
Index: spell_effects.cpp
===================================================================
--- spell_effects.cpp (revision 1597)
+++ spell_effects.cpp (working copy)
@@ -2812,6 +2812,10 @@
case SE_LimitCastTime:
case SE_NoCombatSkills:
case SE_TriggerOnCast:
+ case SE_ImprovedSpellEffect:
+ case SE_BossSpellTrigger:
+ case SE_CastOnWearoff:
+ case SE_EffectOnFade:
{
break;
}
@@ -3281,6 +3285,19 @@
Message_StringID(MT_Spells, INVIS_BEGIN_BREAK);
}
break;
+
+ // These effects always trigger when they fade.
+ case SE_ImprovedSpellEffect:
+ case SE_BossSpellTrigger:
+ case SE_CastOnWearoff:
+ {
+ if (ticsremaining == 1)
+ {
+ SpellOnTarget(spells[spell_id].base[i], this);
+ }
+ break;
+ }
+
default: {
// do we need to do anyting here?
}
@@ -3525,7 +3542,7 @@
}
break;
}
-
+
case SE_MovementSpeed:
{
if(IsClient())