public virtual void Evaluate()
{
if ( m_VacationLeft > 0 )
{
m_VacationLeft -= 1;
}
else if ( m_EvaluateDay )
{
// reset events
m_Events = new List<int>();
// food events
if (
( m_Food.Added < m_Food.Maintain && m_Food.State != (int) FoodState.Overfed && m_Food.State != (int) FoodState.Dead ) ||
( m_Food.Added >= m_Food.Improve && m_Food.State == (int) FoodState.Full )
)
m_Events.Add( 1074368 ); // The tank looks worse than it did yesterday.
if (
( m_Food.Added >= m_Food.Improve && m_Food.State != (int) FoodState.Full && m_Food.State != (int) FoodState.Overfed ) ||
( m_Food.Added < m_Food.Maintain && m_Food.State == (int) FoodState.Overfed )
)
m_Events.Add( 1074367 ); // The tank looks healthier today.
// water events
if ( m_Water.Added < m_Water.Maintain && m_Water.State != (int) WaterState.Dead )
m_Events.Add( 1074370 ); // This tank can use more water.
if ( m_Water.Added >= m_Water.Improve && m_Water.State != (int) WaterState.Strong )
m_Events.Add( 1074369 ); // The water looks clearer today.
UpdateFoodState();
UpdateWaterState();
// reward
if ( m_LiveCreatures > 0 )
m_RewardAvailable = true;
}
else
{
// new fish
if ( OptimalState && m_LiveCreatures < MaxLiveCreatures )
{
if ( Utility.RandomDouble() < 0.005 * m_LiveCreatures )
{
BaseFish fish = null;
int message = 0;
switch ( Utility.Random( 6 ) )
{
case 0:
{
message = 1074371; // Brine shrimp have hatched overnight in the tank.
fish = new BrineShrimp();
break;
}
case 1:
{
message = 1074365; // A new creature has hatched overnight in the tank.
fish = new Coral();
break;
}
case 2:
{
message = 1074365; // A new creature has hatched overnight in the tank.
fish = new FullMoonFish();
break;
}
case 3:
{
message = 1074373; // A sea horse has hatched overnight in the tank.
fish = new SeaHorseFish();
break;
}
case 4:
{
message = 1074365; // A new creature has hatched overnight in the tank.
fish = new StrippedFlakeFish();
break;
}
case 5:
{
message = 1074365; // A new creature has hatched overnight in the tank.
fish = new StrippedSosarianSwill();
break;
}
}
if ( Utility.RandomDouble() < 0.05 )
fish.Hue = m_FishHues[ Utility.Random( m_FishHues.Length ) ];
else if ( Utility.RandomDouble() < 0.5 )
fish.Hue = Utility.RandomMinMax( 0x100, 0x3E5 );
if ( AddFish( fish ) )
m_Events.Add( message );
else
fish.Delete();
}
}
// kill fish *grins*
if ( m_LiveCreatures < MaxLiveCreatures )
{
if ( Utility.RandomDouble() < 0.01 )
KillFish( 1 );
}
else
{
KillFish( m_LiveCreatures - MaxLiveCreatures );
}
}
m_EvaluateDay = !m_EvaluateDay;
InvalidateProperties();
}