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