public static void Toggle( Mobile caster, Mobile target )
{
/* Players under the protection spell effect can no longer have their spells "disrupted" when hit.
* Players under the protection spell have decreased physical resistance stat value (-15 + (Inscription/20),
* a decreased "resisting spells" skill value by -35 + (Inscription/20),
* and a slower casting speed modifier (technically, a negative "faster cast speed") of 2 points.
* The protection spell has an indefinite duration, becoming active when cast, and deactivated when re-cast.
* Reactive Armor, Protection, and Magic Reflection will stay on—even after logging out,
* even after dying—until you “turn them off” by casting them again.
*/
object[] mods = (object[])m_Table[target];
if ( mods == null )
{
target.PlaySound( 0x1E9 );
target.FixedParticles( 0x375A, 9, 20, 5016, EffectLayer.Waist );
mods = new object[1]
{
new DefaultSkillMod( SkillName.MagicResist, true, -35 + Math.Min( (int)(caster.Skills[SkillName.Inscribe].Value / 20), 35 ) )
};
m_Table[target] = mods;
Registry[target] = 100.0;
target.AddSkillMod( (SkillMod)mods[1] );
int physloss = -15 + (int) (caster.Skills[SkillName.Inscribe].Value / 20);
int resistloss = -35 + (int) (caster.Skills[SkillName.Inscribe].Value / 20);
string args = String.Format("{0}\t{1}", physloss, resistloss);
BuffInfo.AddBuff(target, new BuffInfo(BuffIcon.Protection, 1075814, 1075815, args.ToString()));
}
else
{
target.PlaySound( 0x1ED );
target.FixedParticles( 0x375A, 9, 20, 5016, EffectLayer.Waist );
m_Table.Remove( target );
Registry.Remove( target );
target.RemoveSkillMod( (SkillMod)mods[1] );
BuffInfo.RemoveBuff(target, BuffIcon.Protection);
}
}