private Spell CheckCastHealingSpell()
{
// If I'm poisoned, always attempt to cure.
if( m_Mobile.Poisoned )
return new CureSpell( m_Mobile, null );
// Summoned creatures never heal themselves.
if( m_Mobile.Summoned )
return null;
if( m_Mobile.Controlled )
{
if( DateTime.Now < m_NextHealTime )
return null;
}
if( !SmartAI )
{
if( ScaleBySkill( HealChance, SkillName.Magery ) < Utility.RandomDouble() )
return null;
}
else
{
if( Utility.Random( 0, 4 + ( m_Mobile.Hits == 0 ? m_Mobile.HitsMax : ( m_Mobile.HitsMax / m_Mobile.Hits ) ) ) < 3 )
return null;
}
Spell spell = null;
if( m_Mobile.Hits < ( m_Mobile.HitsMax - 50 ) )
{
spell = new GreaterHealSpell(m_Mobile, null);
if (spell == null)
spell = new HealSpell(m_Mobile, null);
}
else if( m_Mobile.Hits < ( m_Mobile.HitsMax - 10 ) )
{
spell = new HealSpell( m_Mobile, null );
}
double delay;
if( m_Mobile.Int >= 500 )
delay = Utility.RandomMinMax( 7, 10 );
else
delay = Math.Sqrt( 600 - m_Mobile.Int );
m_NextHealTime = DateTime.Now + TimeSpan.FromSeconds( delay );
return spell;
}