rendered paste body private class ParalyzedTimer : Timer
{
private Mobile m_Mobile;
public ParalyzedTimer( Mobile m, TimeSpan duration )
: base( duration )
{
this.Priority = TimerPriority.TwentyFiveMS;
m_Mobile = m;
}
protected override void OnTick()
{
m_Mobile.Paralyzed = false;
}
}
private class FrozenTimer : Timer
{
private Mobile m_Mobile;
public FrozenTimer( Mobile m, TimeSpan duration )
: base( duration )
{
this.Priority = TimerPriority.TwentyFiveMS;
m_Mobile = m;
}
protected override void OnTick()
{
m_Mobile.Frozen = false;
}
}
private class CombatTimer : Timer
{
private Mobile m_Mobile;
public CombatTimer( Mobile m )
: base( TimeSpan.FromSeconds( 0.0 ), TimeSpan.FromSeconds( 0.01 ), 0 )
{
m_Mobile = m;
if ( !m_Mobile.m_Player && m_Mobile.m_Dex <= 100 )
Priority = TimerPriority.FiftyMS;
}
protected override void OnTick()
{
if ( DateTime.Now > m_Mobile.m_NextCombatTime )
{
Mobile combatant = m_Mobile.Combatant;
// If no combatant, wrong map, one of us is a ghost, or cannot see, or deleted, then stop combat
if ( combatant == null || combatant.m_Deleted || m_Mobile.m_Deleted || combatant.m_Map != m_Mobile.m_Map || !combatant.Alive || !m_Mobile.Alive || !m_Mobile.CanSee( combatant ) || combatant.IsDeadBondedPet || m_Mobile.IsDeadBondedPet )
{
m_Mobile.Combatant = null;
return;
}
IWeapon weapon = m_Mobile.Weapon;
if ( !m_Mobile.InRange( combatant, weapon.MaxRange ) )
return;
if ( m_Mobile.InLOS( combatant ) )
{
weapon.OnBeforeSwing( m_Mobile, combatant ); //OnBeforeSwing for checking in regards to being hidden and whatnot
m_Mobile.RevealingAction();
m_Mobile.m_NextCombatTime = DateTime.Now + weapon.OnSwing( m_Mobile, combatant );
}
}
}
}
private class ExpireCombatantTimer : Timer
{
private Mobile m_Mobile;
public ExpireCombatantTimer( Mobile m )
: base( TimeSpan.FromMinutes( 1.0 ) )
{
this.Priority = TimerPriority.FiveSeconds;
m_Mobile = m;
}
protected override void OnTick()
{
m_Mobile.Combatant = null;
}
}