Beispiel #1
0
 public void Chop(Mobile from)
 {
     if (from.InRange(this.GetWorldLocation(), 1))
     {
         if (from == m_sower)
         {
             from.Direction = from.GetDirectionTo(this);
             double lumberValue = from.Skills[SkillName.Lumberjacking].Value / 100;
             if ((lumberValue > .5) && (Utility.RandomDouble() <= lumberValue))
             {
                 Almond fruit = new Almond(Utility.Random(m_yield + 2));
                 from.AddToBackpack(fruit);
                 int cnt  = Utility.Random(20) + 1;
                 Log logs = new Log(cnt);
                 from.AddToBackpack(logs);
             }
             this.Delete();
             from.SendMessage("You chop the plant up");
         }
         else
         {
             from.SendMessage("You do not own this plant !!!");
         }
     }
     else
     {
         from.SendLocalizedMessage(500446);
     }
 }
        public static void Main()
        {
            Appetizer almonds = new Almond();
            Appetizer cashew  = new Cashew();
            Appetizer peanuts = new Peanut();

            Drink whiskey = new Whiskey("Johny Walker", 50, cashew);

            Console.WriteLine("--------- Drink with cashew appetizer:");
            whiskey.DisplayInformation();
            Console.WriteLine();

            whiskey.Appetizer = almonds;
            Console.WriteLine("--------- Drink with almonds appetizer:");
            whiskey.DisplayInformation();
            Console.WriteLine();

            whiskey.Appetizer = peanuts;
            Console.WriteLine("--------- Drink with peanuts appetizer:");
            whiskey.DisplayInformation();
            Console.WriteLine();
        }
        public IceCreamBase Addon(int toppings, IceCreamBase icecream)
        {
            switch (toppings)
            {
            case (int)Toppings.Chocochips:
                icecream = new Chocochips(icecream);
                break;

            case (int)Toppings.Cookies:
                icecream = new Cookies(icecream);
                break;

            case (int)Toppings.Jelly:
                icecream = new Jelly(icecream);
                break;

            case (int)Toppings.Fruits:
                icecream = new Fruits(icecream);
                break;

            case (int)Toppings.Almonnd:
                icecream = new Almond(icecream);
                break;

            case (int)Toppings.Cashew:
                icecream = new Cashew(icecream);
                break;

            case (int)Toppings.Pistachio:
                icecream = new Pistachio(icecream);
                break;

            default:
                break;
            }

            return(icecream);
        }
Beispiel #4
0
 public static bool isAlmond(Almond almond)
 {
     return(almond.getWeight() > 10 && almond.getSize() < 10);
 }
Beispiel #5
0
        public override void OnDoubleClick(Mobile from)
        {
            if (m_sower == null || m_sower.Deleted)
            {
                m_sower = from;
            }
            if (from != m_sower)
            {
                from.SendMessage("You do not own this plant !!!"); return;
            }

            if (from.Mounted && !CropHelper.CanWorkMounted)
            {
                from.SendMessage("You cannot harvest a crop while mounted."); return;
            }
            if (DateTime.UtcNow > lastpicked.AddSeconds(3))
            {
                lastpicked = DateTime.UtcNow;
                int cookValue = (int)from.Skills[SkillName.Cooking].Value / 20;
                if (cookValue == 0)
                {
                    from.SendMessage("You have no idea how to harvest this crop."); return;
                }
                if (from.InRange(this.GetWorldLocation(), 1))
                {
                    if (m_yield < 1)
                    {
                        from.SendMessage("There is nothing here to harvest.");
                    }
                    else
                    {
                        from.Direction = from.GetDirectionTo(this);
                        from.Animate(from.Mounted ? 29:32, 5, 1, true, false, 0);
                        m_lastvisit = DateTime.UtcNow;
                        if (cookValue > m_yield)
                        {
                            cookValue = m_yield + 1;
                        }
                        int pick = Utility.RandomMinMax(cookValue - 4, cookValue);
                        if (pick < 0)
                        {
                            pick = 0;
                        }
                        if (pick == 0)
                        {
                            from.SendMessage("You do not manage to harvest any crops."); return;
                        }
                        m_yield -= pick;
                        from.SendMessage("You harvest {0} crop{1}!", pick, (pick == 1 ? "" : "s"));
                        if (m_yield < 1)
                        {
                            ((Item)this).ItemID = pickedGraphic;
                        }
                        Almond crop = new Almond(pick);
                        from.AddToBackpack(crop);
                        if (!regrowTimer.Running)
                        {
                            regrowTimer.Start();
                        }
                    }
                }
                else
                {
                    from.SendMessage("You are too far away to harvest anything.");
                }
            }
        }
Beispiel #6
0
        public static void PrintOptions()
        {
            Console.WriteLine("What theme do you want for your gift basket?");
            Console.WriteLine("1. Fruit");
            Console.WriteLine("2. Nut");
            Console.WriteLine("3. Candy");



            string userInput = Console.ReadLine();

            if (userInput == "1")
            {
                Console.WriteLine("Preparing your fruit gift basket...");

                // To do: create a gift basket class and give it a list of fruit items

                // To do: create some instances of each item and add them to the gift basket.


                Console.WriteLine("All done! Press any key to exit.");
                Console.ReadKey();
            }
            else if (userInput == "2")
            {
                Console.WriteLine("Preparing your nut gift basket...");
                Almond newAlmond = new Almond()
                {
                    Salted             = true,
                    Name               = "Salted Almond",
                    DryRoasted         = false,
                    Shelled            = true,
                    TreeNut            = true,
                    CaloriesPerServing = 100,
                    ServingSize        = "100g",
                    isOrganic          = true
                };

                Cashew newCashew = new Cashew()
                {
                    Salted             = false,
                    Name               = "Whole Cashew",
                    DryRoasted         = false,
                    Shelled            = true,
                    TreeNut            = true,
                    CaloriesPerServing = 150,
                    ServingSize        = "100g",
                    isWhole            = true
                };

                GiftBasket nutGiftBasket = new GiftBasket()
                {
                    Name  = "Lots o' Nuts",
                    Price = 10.99,
                    GiftBasketInventory = new List <Food>()
                    {
                        newAlmond, newCashew
                    }
                };

                nutGiftBasket.GiftBasketInventory.ForEach(singleNut => Console.WriteLine(singleNut.Name));

                Console.WriteLine("All done! Press any key to continue.");
                Console.ReadKey();
            }
            else if (userInput == "3")
            {
                Console.WriteLine("Preparing your candy gift basket...");

                Console.WriteLine("All done! Press any key to exit.");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("Please enter either 1 or 2 to select an option."); Console.WriteLine("Press any key to continue.");
                Console.ReadKey();
            }
        }