Caryatis
07-07-2010, 11:36 PM
This is a pretty huge one for alot of servers I imagine. Tons of mobs make use of this spell(Spreading Stone (http://lucy.allakhazam.com/spell.html?id=7917&source=Live)) alone, let alone the new cleric Promised Renewal (http://lucy.allakhazam.com/spell.html?id=9755&source=Live) lines, etc.
The counterpart to this effect is SE_BossSpellTrigger(which is coming shortly), the key differences I can find are that ImprovedSpellEffects can land on any target and have single target effects while BossSpellTrigger effects can only land on clients and have PB AE effects.
code...
spell effects.cpp - line 2817 - add this
case SE_ImprovedSpellEffect:
spell effects.cpp - line 3531 - add this
case SE_ImprovedSpellEffect:
{
SpellOnTarget(spells[buffs[slot].spellid].base[i], this);
break;
}
You're really making it hard for me to catch up you know that? ...but don't let that stop you =p
Caryatis
07-08-2010, 12:16 AM
I know I'm making more work for you as you got to clean up my shoddy code but at least the groundwork is done(hopefully lol).
BTW The more I looked into SE_BossSpellTrigger, they are all single target npc on client spells which would be handled with scripting so I think its pretty safe to combine these two functions together.
edit... seems like SE_CastOnWearoff is exactly the same as well except it is for client on client/pet spells and self only spells. The only spell that doesnt fit the pattern is Temporal Lapse (http://lucy.allakhazam.com/spell.html?id=20722&source=Live) which contains none of the crazy restrictions/effects from live(cant cast if more than 90% h/e/m and it teleports you back to where you cast it) so I assume Sony did some fancy spell coding like we got recently for it. Other than that I think all 3 effects function the same.
Caryatis
07-08-2010, 02:55 AM
this was flawed as it would trigger if you cured the debuff... however I moved the code out to the dobufftic function.
spell effects.cpp - line 3297 - add this
case SE_ImprovedSpellEffect:
case SE_BossSpellTrigger:
case SE_CastOnWearoff:
{
if (ticsremaining == 1)
{
SpellOnTarget(spells[spell_id].base[i], this);
}
break;
}
Seems to work as intended now.
Caryatis
07-13-2010, 03:09 AM
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
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
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
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
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())
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.