public override void OnCast() { if (UnderEffect(Caster)) { PlayEffects(); // As per Pub 71, Enemy of one has now been changed to a Spell Toggle. You can remove the effect // before the duration expires by recasting the spell. RemoveEffect(Caster); } else if (CheckSequence()) { PlayEffects(); // TODO: validate formula var seconds = ComputePowerValue(1); Utility.FixMinMax(ref seconds, 67, 228); var delay = TimeSpan.FromSeconds(seconds); var timer = Timer.DelayCall(delay, RemoveEffect, Caster); var expire = DateTime.UtcNow + delay; var context = new EnemyOfOneContext(Caster, timer, expire); context.OnCast(); m_Table[Caster] = context; } FinishSequence(); }
public override void OnCast() { if (UnderEffect(Caster)) { PlayEffects(); // Recasting while the spell is in effect will not cost any Mana or casting time. RemoveEffect(Caster, true); } else if (CheckSequence()) { PlayEffects(); double seconds = (double)ComputePowerValue(1); // TODO: Should caps be applied? Utility.FixMinMax(ref seconds, 90, 210); TimeSpan delay = TimeSpan.FromSeconds(seconds); Timer timer = Timer.DelayCall(delay, delegate { RemoveEffect(Caster, true); }); DateTime expire = DateTime.UtcNow + delay; m_Table[Caster] = new EnemyOfOneContext(Caster, timer, expire); } FinishSequence(); }
public static void RemoveEffect(Mobile m) { if (m_Table.ContainsKey(m)) { EnemyOfOneContext context = m_Table[m]; m_Table.Remove(m); context.OnRemoved(); m.PlaySound(0x1F8); } }
public override void OnCast() { if ( UnderEffect( Caster ) ) { PlayEffects(); // Recasting while the spell is in effect will not cost any Mana or casting time. RemoveEffect( Caster, true ); } else if ( CheckSequence() ) { PlayEffects(); double seconds = (double) ComputePowerValue( 1 ); // TODO: Should caps be applied? Utility.FixMinMax( ref seconds, 90, 210 ); TimeSpan delay = TimeSpan.FromSeconds( seconds ); Timer timer = Timer.DelayCall( delay, delegate { RemoveEffect( Caster, true ); } ); DateTime expire = DateTime.Now + delay; m_Table[Caster] = new EnemyOfOneContext( Caster, timer, expire ); } FinishSequence(); }