public override void OnCast() { /* The magic reflection spell decreases the caster's physical resistance, while increasing the caster's elemental resistances. * Physical decrease = 25 - (Inscription/20). * Elemental resistance = +10 (-20 physical, +10 elemental at GM Inscription) * The magic reflection 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. */ if (CheckSequence()) { Mobile targ = Caster; var context = GetContext(targ); targ.PlaySound(0x1E9); targ.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist); if (context == null) { int physiMod = 20 - (int)(targ.Skills[SkillName.Inscribe].Value / 20); int otherMod = 10; var mods = new[] { new ResistanceMod(ResistanceType.Physical, -physiMod), new ResistanceMod(ResistanceType.Fire, otherMod), new ResistanceMod(ResistanceType.Cold, otherMod), new ResistanceMod(ResistanceType.Poison, otherMod), new ResistanceMod(ResistanceType.Energy, otherMod) }; context = new MagicReflectContext(Caster, mods); m_Table.Add(context); for (int i = 0; i < mods.Length; ++i) { targ.AddResistanceMod(mods[i]); } string buffFormat = string.Format("-{0}\t+{1}\t+{1}\t+{1}\t+{1}\t{2}\t{3}", physiMod, otherMod, "-5", context.ReflectPool); BuffInfo.AddBuff(targ, new BuffInfo(BuffIcon.MagicReflection, 1015197, 1149979, buffFormat, true)); } else if (CooldownTimer.InCooldown(Caster)) { Caster.SendLocalizedMessage(1150073, CooldownTimer.GetRemaining(Caster)); // You must wait ~1_seconds~ seconds to tap into your magic reflection pool. } else if (context.NextReplenish > DateTime.UtcNow || !context.TryReplenish()) { Expire(context); } } FinishSequence(); }
public MagicReflectContext(Mobile caster, ResistanceMod[] mods) { Caster = caster; Mods = mods; if (CooldownTimer.InCooldown(caster)) { caster.SendLocalizedMessage(1150073, CooldownTimer.GetRemaining(caster)); // You must wait ~1_seconds~ seconds to tap into your magic reflection pool. } else { ReflectPool = CalculateReflectPool(); } }