public static void GainStat( Mobile from, Stat stat )
{
switch( stat )
{
case Stat.Str:
{
if ( from is BaseCreature && ((BaseCreature)from).Controlled ) {
if ( (from.LastStrGain + m_PetStatGainDelay) >= DateTime.Now )
return;
}
else if( (from.LastStrGain + m_StatGainDelay) >= DateTime.Now )
return;
from.LastStrGain = DateTime.Now;
break;
}
case Stat.Dex:
{
if ( from is BaseCreature && ((BaseCreature)from).Controlled ) {
if ( (from.LastDexGain + m_PetStatGainDelay) >= DateTime.Now )
return;
}
else if( (from.LastDexGain + m_StatGainDelay) >= DateTime.Now )
return;
from.LastDexGain = DateTime.Now;
break;
}
case Stat.Int:
{
if ( from is BaseCreature && ((BaseCreature)from).Controlled ) {
if ( (from.LastIntGain + m_PetStatGainDelay) >= DateTime.Now )
return;
}
else if( (from.LastIntGain + m_StatGainDelay) >= DateTime.Now )
return;
from.LastIntGain = DateTime.Now;
break;
}
}
bool atrophy = ( (from.RawStatTotal / (double)from.StatCap) >= Utility.RandomDouble() );
IncreaseStat( from, stat, atrophy );
}
}