Ejemplo n.º 1
0
        // Add two Chronic type's together into one.
        public IChronic Add(ref IChronic toAdd)
        {
            THC = ((THC * Yield) + (toAdd.THC * toAdd.Yield)) / (Yield + toAdd.Yield);
            CBD = ((CBD * Yield) + (toAdd.CBD * toAdd.Yield)) / (Yield + toAdd.Yield);

            Yield += toAdd.Yield;

            toAdd.ImproveYield(0);
            toAdd.ImproveTHC(0);
            toAdd.ImproveCBD(0);
            toAdd.SetStage(Stage.Dead);

            return(this);
        }
        // What to do when harvesting the plant.
        public HarvestResult Harvest()
        {
            IChronic harvest   = null;
            IChronic trimmings = null;

            if (Stage == Stage.Flowering)
            {
                if (Age >= (FloweringAge - 5) && Age <= FloweringAge + 5)
                {
                    // Check if plant has reached optimal flowering age.
                    if (Age == FloweringAge)
                    {
                        Yield *= 1.05;
                    }
                    // Check the health of the plant and give bonus accordingly.
                    else if (Health >= 0 && Health <= 50)
                    {
                        Yield *= 1.01;
                    }
                    else if (Health > 50 && Health <= 90)
                    {
                        Yield *= 1.02;
                    }
                    else if (Health > 90 && Health <= 100)
                    {
                        Yield *= 1.05;
                    }
                }

                // Causes a lot of stress for the plant.
                // Also since we cut the plant, set height to 10 cm.
                Health = 0;
                Age    = 0;
                Height = 0;

                trimmings = (IChronic)Clone();
                trimmings.SetStage(Stage.Harvesting);
                // Trimmings has lower THC % compared to the real harvest.
                trimmings.ImproveTHC(0.2);
                // Trimmings has lower CBD % compared to the real harvest.
                trimmings.ImproveCBD(0.2);
                // Trimmings yield is higher, with a far lower THC percentage.
                trimmings.ImproveYield(3);

                // Actually harvest the buds, without yield modifier.
                harvest = (IChronic)Clone();
                // Different stage and height for the harvest.
                harvest.SetStage(Stage.Harvesting);

                // After cloning reduce the yield and trimmings.
                Yield = 0;

                // Cutting does not kill, set to clone stage.
                SetStage(Stage.Clone);
                // The plant that has been cut no longer has a THC or Yield.
                THC = 0;
                CBD = 0;
                // The regrowable clone wasn't destroyed, so add some height.
                Height = 10;
            }

            return(new HarvestResult(harvest, trimmings));
        }
Ejemplo n.º 3
0
        // Add two Chronic type's together into one.
        public IChronic Add(ref IChronic toAdd)
        {
            THC = ((THC * Yield) + (toAdd.THC * toAdd.Yield)) / (Yield + toAdd.Yield);
            CBD = ((CBD * Yield) + (toAdd.CBD * toAdd.Yield)) / (Yield + toAdd.Yield);

            Yield += toAdd.Yield;

            toAdd.ImproveYield(0);
            toAdd.ImproveTHC(0);
            toAdd.ImproveCBD(0);
            toAdd.SetStage(Stage.Dead);

            return this;
        }