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

Reply
 
Thread Tools Display Modes
  #1  
Old 07-07-2010, 11:36 PM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 541
Default COMMITTED: SE_ImprovedSpellEffect

This is a pretty huge one for alot of servers I imagine. Tons of mobs make use of this spell(Spreading Stone) alone, let alone the new cleric Promised Renewal 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
Code:
case SE_ImprovedSpellEffect:
spell effects.cpp - line 3531 - add this
Code:
			case SE_ImprovedSpellEffect:
			{
				SpellOnTarget(spells[buffs[slot].spellid].base[i], this);
				break;
			}
Reply With Quote
  #2  
Old 07-07-2010, 11:57 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

You're really making it hard for me to catch up you know that? ...but don't let that stop you =p
Reply With Quote
  #3  
Old 07-08-2010, 12:16 AM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 541
Default

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 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.
Reply With Quote
  #4  
Old 07-08-2010, 02:55 AM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 541
Default

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
Code:
		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.
Reply With Quote
  #5  
Old 07-13-2010, 03:09 AM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 541
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


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 04:20 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3