Пример #1
0
            public static void Use(string input)
            {
                Character godess = MethodStore.Godess;
                Character enemy  = MethodStore.Enemy;

                input = MethodStore.Words[1];

                GameData.Item foundItem = godess.CharacterInventory.Find(x => x.Name.ToLower().Contains(input));
                if (foundItem != null)
                {
                    switch (foundItem.Type)
                    {
                    case "gear":
                        if (foundItem.IsArmed == false)
                        {
                            if (MethodStore.IsFighting == true && enemy.Lifepoints > 0 && godess.Lifepoints > 0)
                            {
                                godess.Hitpoints = (float)(Math.Round((godess.Hitpoints + foundItem.Points), 2));
                                Console.WriteLine("You got temporarily stronger with the help of the " + foundItem.Name + ".");

                                enemy.Lifepoints = (float)(Math.Round((enemy.Lifepoints - godess.Hitpoints), 2));
                                Console.WriteLine("Ouch!!!  Golem's lifepoints: " + enemy.Lifepoints);

                                godess.Hitpoints  = (float)(Math.Round((godess.Hitpoints - foundItem.Points), 2));
                                godess.Lifepoints = (float)(Math.Round((godess.Lifepoints - enemy.Hitpoints), 2));
                                Console.WriteLine("You're getting hit!" + Environment.NewLine + "Oouuuch! Augh!!! Oh, you dirty creature! I'm gonna finish you on the spot!" + Environment.NewLine + "You've got " + godess.Lifepoints + " lifepoints left. Fight him 'till the end!");
                            }
                            else
                            {
                                Console.WriteLine("There's no enemy to fight! Try another time.");
                            }
                        }
                        else
                        {
                            Console.WriteLine("You're already equipped with " + foundItem.Name);
                        }
                        break;

                    case "health":
                        godess.Lifepoints = (float)(Math.Round((godess.Lifepoints + foundItem.Points), 2));
                        Console.WriteLine("You used the healing item, new lifepoints: " + godess.Lifepoints);
                        godess.CharacterInventory.Remove(foundItem);
                        break;
                    }
                }
                else
                {
                    Console.WriteLine("Invalid item!");
                }
            }
 public static void Drop(string input)
 {
     input = Words[1];
     GameData.Item foundItem = Godess.CharacterInventory.Find(x => x.Name.ToLower().Contains(input));
     if (foundItem != null)
     {
         Console.WriteLine("You removed " + foundItem.Name + " from your inventory...");
         AvatarCurrentRoom.RoomInventory.Add(foundItem);
         Godess.CharacterInventory.Remove(foundItem);
     }
     else
     {
         Console.WriteLine("Oh mighty one! You really can't drop this!");
     }
 }
 public static void Take(string input)
 {
     input = Words[1];
     GameData.Item foundItem = AvatarCurrentRoom.RoomInventory.Find(x => x.Name.ToLower().Contains(input));
     if (foundItem != null)
     {
         Console.WriteLine("You added " + foundItem.Name + " to your inventory...");
         Godess.CharacterInventory.Add(foundItem);
         AvatarCurrentRoom.RoomInventory.Remove(foundItem);
     }
     else
     {
         Console.WriteLine("Well, you really can't take this!");
     }
 }