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

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

Pretty self explanatory, there are 2 versions, passive AA that gives low % to twincast any spell(auras and songs like this too) and a self only buff that grants 100% to twincast for 3 ticks.

Code...
spdat.h - line 526 - add this
Code:
#define SE_Twincast					399 //cast 2 spells for every 1
spell effects.cpp - line 2816 - add this
Code:
case SE_Twincast:
spell effects.cpp - line 3859 - add this
Code:
case SE_Twincast:
		{
			if(type == focusTwincast)
			{
				value = 1;
			}
			break;
		}
spells.cpp - line 1068 - add this
Code:
TryTwincast(this, target, spell_id);
mob.h - line 90 - add this
Code:
	focusTwincast,
mob.h - line 784 - add this
Code:
void TryTwincast(Mob *caster, Mob *target, uint32 spell_id);
mob.cpp - line 3094 - add this
Code:
void Mob::TryTwincast(Mob *caster, Mob *target, uint32 spell_id)
{
	if(!IsValidSpell(spell_id))
	{
		return;
	}

	uint32 buff_count = GetMaxTotalSlots();
	for(int i = 0; i < buff_count; i++) 
	{
		if(IsEffectInSpell(buffs[i].spellid, SE_Twincast))
		{
			sint32 focus = CalcFocusEffect(focusTwincast, buffs[i].spellid, spell_id);
			if(focus == 1)
			{
				if(MakeRandomInt(0, 100) <= spells[buffs[i].spellid].base[0])
				{
					uint32 spell_mana = (spells[spell_id].mana);
					this->SetMana(GetMana() - spell_mana);
					SpellOnTarget(spell_id, target);
				}
			}
		}
	}
}
Reply With Quote
  #2  
Old 07-14-2010, 08:50 PM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 541
Default

New code for this, uses mana more accurately and also produces a message now, like live.

spdat.h
Code:
Index: spdat.h
===================================================================
--- spdat.h	(revision 1598)
+++ spdat.h	(working copy)
@@ -523,6 +523,7 @@
 #define SE_Leap						383 //used to leap forward? probably something like a small knock back reverse to push you forward
 //#define SE_Unknown384				384	//not used
 //#define SE_Unknown385				385	//not used
+#define SE_Twincast					399   //cast 2 spells for every 1
 //last effect
 
 #define DF_Permanent		50
spell effects
Code:
Index: spell_effects.cpp
===================================================================
--- spell_effects.cpp	(revision 1598)
+++ spell_effects.cpp	(working copy)
@@ -2812,6 +2812,7 @@
 			case SE_LimitCastTime:
 			case SE_NoCombatSkills:
 			case SE_TriggerOnCast:
+			case SE_Twincast:
 			{
 				break;
 			}
@@ -3860,6 +3861,14 @@
 			}
 			break;
 		}
+		case SE_Twincast:
+		{
+			if(type == focusTwincast)
+			{
+				value = 1;
+			}
+			break;
+		}
 #if EQDEBUG >= 6
 		//this spits up a lot of garbage when calculating spell focuses
 		//since they have all kinds of extra effects on them.
spells.cpp
Code:
Index: spells.cpp
===================================================================
--- spells.cpp	(revision 1598)
+++ spells.cpp	(working copy)
@@ -1065,6 +1065,8 @@
 		}
 	}
 	
+	TryTwincast(this, target, spell_id);
+	
 	// we're done casting, now try to apply the spell
 	if( !SpellFinished(spell_id, spell_target, slot, mana_used, inventory_slot) )
 	{
mob.h
Code:
Index: mob.h
===================================================================
--- mob.h	(revision 1598)
+++ mob.h	(working copy)
@@ -87,6 +87,7 @@
 	focusResistRate,
 	focusSpellHateMod,
 	focusTriggerOnCast,
+	focusTwincast,
 } focusType;
 
 enum {
@@ -778,6 +779,7 @@
 	bool TryDeathSave();
 	void DoBuffWearOffEffect(uint32 index);
 	void TryTriggerOnCast(Mob *target, uint32 spell_id);
+	void TryTwincast(Mob *caster, Mob *target, uint32 spell_id);
 
 	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 1598)
+++ mob.cpp	(working copy)
@@ -3036,4 +3036,35 @@
 			}
 		}
 	}
+}
+
+void Mob::TryTwincast(Mob *caster, Mob *target, uint32 spell_id)
+{
+	if(!IsValidSpell(spell_id))
+	{
+		return;
+	}
+
+	uint32 buff_count = GetMaxTotalSlots();
+	for(int i = 0; i < buff_count; i++) 
+	{
+		if(IsEffectInSpell(buffs[i].spellid, SE_Twincast))
+		{
+			sint32 focus = CalcFocusEffect(focusTwincast, buffs[i].spellid, spell_id);
+			if(focus == 1)
+			{
+				if(MakeRandomInt(0, 100) <= spells[buffs[i].spellid].base[0])
+				{
+					uint32 mana_cost = (spells[spell_id].mana);
+					if(this->IsClient())
+					{
+						mana_cost = GetActSpellCost(spell_id, mana_cost);
+						this->Message(MT_Spells,"You twincast %s!",spells[spell_id].name);
+					}
+					this->SetMana(GetMana() - mana_cost);
+					SpellOnTarget(spell_id, target);
+				}
+			}
+		}
+	}
 }
\ No newline at end of file
Reply With Quote
  #3  
Old 07-14-2010, 10:24 PM
steve
Discordant
 
Join Date: Jan 2002
Posts: 305
Default

I am in awe of you, sir. Quality work coming from you!

Keep up the awesome work!
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 09:23 AM.


 

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