Beispiel #1
0
        public virtual void Evaluate()
        {
            if (this.m_VacationLeft > 0)
            {
                this.m_VacationLeft -= 1;
            }
            else if (this.m_EvaluateDay)
            {
                // reset events
                this.m_Events = new List<int>();

                // food events
                if (
                    (this.m_Food.Added < this.m_Food.Maintain && this.m_Food.State != (int)FoodState.Overfed && this.m_Food.State != (int)FoodState.Dead) ||
                    (this.m_Food.Added >= this.m_Food.Improve && this.m_Food.State == (int)FoodState.Full)
                )
                    this.m_Events.Add(1074368); // The tank looks worse than it did yesterday.

                if (
                    (this.m_Food.Added >= this.m_Food.Improve && this.m_Food.State != (int)FoodState.Full && this.m_Food.State != (int)FoodState.Overfed) ||
                    (this.m_Food.Added < this.m_Food.Maintain && this.m_Food.State == (int)FoodState.Overfed)
                )
                    this.m_Events.Add(1074367); // The tank looks healthier today.

                // water events
                if (this.m_Water.Added < this.m_Water.Maintain && this.m_Water.State != (int)WaterState.Dead)
                    this.m_Events.Add(1074370); // This tank can use more water.

                if (this.m_Water.Added >= this.m_Water.Improve && this.m_Water.State != (int)WaterState.Strong)
                    this.m_Events.Add(1074369); // The water looks clearer today.

                this.UpdateFoodState();
                this.UpdateWaterState();

                // reward
                if (this.m_LiveCreatures > 0)
                    this.m_RewardAvailable = true;
            }
            else
            {
                // new fish
                if (this.OptimalState && this.m_LiveCreatures < this.MaxLiveCreatures)
                {
                    if (Utility.RandomDouble() < 0.005 * this.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 (this.AddFish(fish))
                            this.m_Events.Add(message);
                        else
                            fish.Delete();
                    }
                }

                // kill fish *grins*
                if (this.m_LiveCreatures < this.MaxLiveCreatures)
                {
                    if (Utility.RandomDouble() < 0.01)
                        this.KillFish(1);
                }
                else
                {
                    this.KillFish(this.m_LiveCreatures - this.MaxLiveCreatures);
                }
            }

            this.m_EvaluateDay = !this.m_EvaluateDay;
            this.InvalidateProperties();
        }
Beispiel #2
0
        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();
        }