コード例 #1
0
ファイル: RavinePlay.cs プロジェクト: Ejennin/Ravine
        private ForagedItem GetRandomForageCard()
        {
            Random      rand       = new Random();
            int         index      = rand.Next(_foragedItemDeck.Count);
            ForagedItem forageCard = _foragedItemDeck[index];

            return(forageCard);
        }
コード例 #2
0
ファイル: RavinePlay.cs プロジェクト: Ejennin/Ravine
        private bool AddCardToForagedItemDeck(ForagedItem _card)
        {
            int StartingCount = _foragedItemDeck.Count;

            _foragedItemDeck.Add(_card);
            bool _wasAdded = _foragedItemDeck.Count == StartingCount + 1;

            return(_wasAdded);
        }
コード例 #3
0
ファイル: RavinePlay.cs プロジェクト: Ejennin/Ravine
        private void AddForagedItem()
        {
            ForagedItem mushrooms = new ForagedItem(Forage.Mushroom, 0, "cute little psycotropic", false, true);

            _foragedItemDeck.Add(mushrooms);
            ForagedItem grub = new ForagedItem(Forage.Grub, 1, "Disgusting and Nutritous", false, false);

            _foragedItemDeck.Add(grub);
            ForagedItem waspNest = new ForagedItem(Forage.WaspNest, -1, "an agonizing discovery of a", true, false);

            _foragedItemDeck.Add(waspNest);
            ForagedItem chantrelle = new ForagedItem(Forage.Chantrelle, 2, "an agonizing discovery of a ", false, false);

            _foragedItemDeck.Add(chantrelle);
            ForagedItem rabbit = new ForagedItem(Forage.Rabbit, 3, "a hearty meal of ", false, false);

            _foragedItemDeck.Add(rabbit);
            ForagedItem hornets = new ForagedItem(Forage.Hornets, -1, "an agonizing discovery of a ", true, false);

            _foragedItemDeck.Add(hornets);
            ForagedItem taser = new ForagedItem(Forage.Taser, 1, "defends against animal attacks", false, false);

            _foragedItemDeck.Add(taser);
            ForagedItem minnows = new ForagedItem(Forage.Minnows, 2, "tiny but tasty ", false, false);

            _foragedItemDeck.Add(minnows);
            ForagedItem wildOnion = new ForagedItem(Forage.WildOnion, 1, "sweet and sticky ", false, false);

            _foragedItemDeck.Add(wildOnion);
            ForagedItem berries = new ForagedItem(Forage.Berries, 1, "seemingly edible ", false, false);

            _foragedItemDeck.Add(berries);
            ForagedItem moose = new ForagedItem(Forage.Moose, 4, "sweet and sticky ", true, false);

            _foragedItemDeck.Add(moose);
        }
コード例 #4
0
ファイル: RavinePlay.cs プロジェクト: Ejennin/Ravine
        public void Run()
        {
            introPage LoadScreen = new introPage();

            LoadScreen.Run();
            AddNightCards();
            AddForagedItem();
            _health = SetHealth();
            bool continueToRun = true;



            //game engine
            Console.Clear();
            Console.WriteLine("You have crashed on the island. Rescue will occur if you are lucky. Can you survive?");
            Console.WriteLine("Press any key to take your chances at survival.");
            Thread.Sleep(1500);
            Console.WriteLine
                ($"Your injuries leave you with {_health} health.\n" +


                "To survive you must Forage for supplies by risking hearts. \n" +


                "But beware, each day of foraging and each night brings either chance or terror!!!.\n" +


                "Press Any key to play.");


            Console.ReadKey();


            while (continueToRun && _health > 0)
            {
                Console.Clear();
                Console.WriteLine("Let's check your health.");
                Console.WriteLine($"You have {_health} to risk foraging");
                Console.WriteLine("Press any key to take your chances at survival. Risk as many health points as you dare.");
                Thread.Sleep(2500);
                Console.WriteLine("Would you like to forage? If so enter the health you want to risk.");
                string userinput = Console.ReadLine();
                _risk = Int32.Parse(userinput);
                CalculateHealthAfterRisk(_risk);
                Console.WriteLine($"You are spending {_risk} health foraging. Your remaining health is {_health} Best of luck to you Castaway!");
                if (_health >= 1 && _currentCard.CardType == CardType.Rescue)
                {
                    Console.WriteLine($"Congrats, you have been rescued. You still have {_health} left.");
                    continueToRun = false;
                }
                if (_risk == 1)
                {
                    _health -= 1;
                    Thread.Sleep(2500);
                    Console.WriteLine($"Sitting in the sand afraid will not feed you today. You now have {_health} health points.");
                }
                else
                {
                    GetRandomForageCard();
                    ForagedItem foragedItem = GetRandomForageCard();
                    Thread.Sleep(2000);
                    Console.WriteLine($"You have found a {foragedItem.TypeofForage}, they are {foragedItem.Description} it's value is {foragedItem.Value} health");
                    _health += foragedItem.Value;
                    Console.WriteLine($"You now have {_health}");
                }
                Thread.Sleep(2500);

                Console.WriteLine("Are you ready for a new night? yes or no");
                string useriInput = Console.ReadLine();
                Thread.Sleep(2500);

                Console.WriteLine("The sun goes down, Fate Takes it's turn!!!!");
                Thread.Sleep(2000);


                if (_health >= 1)
                {
                    if (useriInput == "yes")
                    {
                        GetRandomNightCard();
                        _currentCard = GetRandomNightCard();
                        Thread.Sleep(2500);
                        //_currentCard = nightCard;
                        Console.WriteLine($"{_currentCard.Description} {_currentCard.Consequence}it gives you a {_currentCard.Damage}");
                        CalculateHealth(_currentCard.Damage);
                        Thread.Sleep(2500);
                        Console.WriteLine($"Your health is now {_health}\n" +
                                          $"Press any key to continue");

                        Console.ReadKey();
                        Console.WriteLine($"Ready to forage again? You currently have {_health} If so, click any key.");
                    }
                    else
                    {
                        Console.WriteLine("Suicide makes sense, Game over sucka!");
                        continueToRun = false;
                        Console.ReadLine();
                    }
                }


                else
                {
                    Console.WriteLine("Game Over, you died without being rescued. Your body will rot and be forgotten. hahahah.... ");
                    continueToRun = false;
                    Console.ReadKey();
                }
            }
        }
コード例 #5
0
ファイル: Class1.cs プロジェクト: Ejennin/Ravine
        //deal random item from list
        // private List<CraftingTools> _craftingTools = new List<CraftingTools>();


        // deal random item from list



        public void Run()
        {
            // introPage LoadScreen = new introPage();
            // LoadScreen.Run();
            AddNightCards();
            AddForagedItem();
            _health = SetHealth();
            bool continueToRun = true;
            //game engine
            Console.Clear();
            Console.WriteLine("You have crashed on the island. Rescue will occur if you are lucky. Can you survive?");
            Console.WriteLine("Press any key to take your chances at survival");
            Thread.Sleep(1500);
            Console.WriteLine
            ("Your injuries may be major (3 hearts) or minor (6 hearts).\n",
            "To survive you must Forage for supplies by risking hearts. \n",
            "But beware, each day of foraging and each night brings either chance or terror!!!.\n",
            "Press Any key to play.");
            Console.ReadKey();
            // if (_health > 0 &&  //  == Animal|| Weather || Emotion)
            while (continueToRun && _health > 0)
            {
                Console.Clear();
                Console.WriteLine("Let's check your health.");
                Console.WriteLine($"You have {_health} to risk foraging");
                Console.WriteLine("Press any key to take your chances at survival");
                //Console.WriteLine($"The maximum you may risk foraging is {_health - 1} ");
                Thread.Sleep(2500);
                Console.WriteLine("Would you like to forage? If so press 2.");
                string userinput = Console.ReadLine();
                _risk = Int32.Parse(userinput);
                Console.WriteLine($"You are spending 2 health foraging. Your remaining health is {_health} Best of luck to you!");
                if (_risk == 1)
                {
                    _health -= 1;
                    Thread.Sleep(2500);
                    Console.WriteLine($"Sitting in the sand afraid will not feed you today. You now have {_health} health points.");
                }
                else
                {
                    Thread.Sleep(2500);
                    Console.WriteLine("Let's go foraging!!! Walking......walking.....stalk.....CATCH!!!!");
                    Thread.Sleep(2000);
                    _health -= 2;
                    GetRandomForageCard();
                    ForagedItem foragedItem = GetRandomForageCard();
                    Thread.Sleep(2000);
                    Console.WriteLine($"You have found a {foragedItem.TypeofForage}, they are {foragedItem.Description} it gives {foragedItem.Value} health");
                    _health += foragedItem.Value;
                    Console.WriteLine($"You now have {_health}");
                }
                Thread.Sleep(2500);
                Console.WriteLine("Are you ready for a new night? yes or no");
                string useriInput = Console.ReadLine();
                if (_health >= 1 && _currentCard.CardType == CardType.Rescue)
                {
                    Console.WriteLine($"Congrats, you have been rescued. You still have {_health} left.");
                    continueToRun = false;
                }
                else if (_health >= 1)
                {
                    //Console.WriteLine("Game Over, you died without being rescued. Your body will rot and be forgotten. hahahah.... ");
                    //continueToRun = false;
                    //Console.ReadKey();
                    if (useriInput == "yes")
                    {
                        GetRandomNightCard();
                        _currentCard = GetRandomNightCard();
                        Thread.Sleep(2500);
                        //_currentCard = nightCard;
                        Console.WriteLine($"Description:{_currentCard.Description} {_currentCard.Consequence} loose {_currentCard.Damage}");
                        CalculateHealth(_currentCard.Damage);
                        Console.WriteLine($"Your health is now {_health}\n" +
                            $"Press any key to continue");
                        Console.ReadKey();
                        Console.WriteLine($"Ready to forage again? You currently have {_health} If so, click any key.");
                    }
                    else
                    {
                        Console.WriteLine("Suicide makes sense, Game over sucka!");
                        continueToRun = false;
                        Console.ReadLine();
                    }
                }
                else
                {
                    Console.WriteLine("Game Over, you died without being rescued. Your body will rot and be forgotten. hahahah.... ");
                    continueToRun = false;
                    Console.ReadKey();
                }
            }
        }