Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

Reply
 
Thread Tools Display Modes
  #1  
Old 07-13-2010, 03:09 AM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 539
Default

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())
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 10:47 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3