예제 #1
0
        public static void NewPlayer()
        {
            //get the user input
            string usersInput;
            //always false until user adds input
            bool validAnswer = false;

            while (validAnswer == false)
            {
                Console.WriteLine("Are you new to Avalon?");
                Console.Write("> ");
                usersInput = Console.ReadLine();

                if (usersInput.ToLower() == "no") //Get save data info
                {
                    validAnswer = true;
                    Console.WriteLine("What is your name?");
                    usersInput = CapWords.FirstCharToUpper(Console.ReadLine());
                    LoadPlayer.LoadGame(usersInput.ToLower());
                }
                else if (usersInput.ToLower() == "yes") // Move on to create the player
                {
                    validAnswer = true;
                    CreatePlayer.CreateAPlayer();
                }
                else
                {
                    Console.WriteLine("Enter a valid answer.");
                }
            }
        }
예제 #2
0
        public void Attacking(Monster monsterNamed, Player player)
        {
            #region . Dice Prop
            RollDie attack  = new RollDie(1, 20);
            RollDie pDamage = new RollDie(player.Equipt.DamageMax);
            RollDie mDamage = new RollDie(monsterNamed.DamageMax);
            #endregion

            #region Check if Attackable
            if (monsterNamed.Attackable == false)
            {
                Console.WriteLine("Can't be attacked for whatever reason");
                return;
            }
            #endregion

            #region Attack
            while (monsterNamed.IsDead != true && player.IsDead != true)
            {
                AttResults = attack.Roll();

                Console.WriteLine("You attack with your " + player.Equipt.Name.ToString() + ": " + AttResults);

                #region player attack
                if (AttResults >= monsterNamed.Armor)
                {
                    Console.WriteLine("You hit " + monsterNamed.Name);

                    DamageResults = pDamage.Roll();
                    Console.WriteLine("You did " + DamageResults + " points of damage.");

                    monsterNamed.HpCurrent -= DamageResults;
                    Console.WriteLine(monsterNamed.Name + " has " + monsterNamed.HpCurrent + " hitpoints left");

                    #region Monster Dead
                    if (monsterNamed.HpCurrent <= 0)
                    {
                        Console.WriteLine(monsterNamed.Name + " is dead!");
                        monsterNamed.IsDead = true;
                        Console.WriteLine("The fight took " + Iteration + " rounds to finish.");
                        Player.CurrentLocation.MonsterRoom.Remove(monsterNamed);
                        player.XP   += monsterNamed.XpReward;
                        player.Gold += monsterNamed.GoldReward;
                        break;
                    }
                    #endregion
                }
                else
                {
                    Console.WriteLine("You missed your attack");
                }
                #endregion


                #region Monster Attack
                AttResults = attack.Roll();
                Console.WriteLine(monsterNamed.Name + " attacks you: " + AttResults);

                if (AttResults > player.Armor)
                {
                    Console.WriteLine(monsterNamed.Name + " hits you!");

                    DamageResults = mDamage.Roll();
                    Console.WriteLine(monsterNamed.Name + " did " + DamageResults + " points of damage.");

                    player.HpCurrent -= DamageResults;

                    #region player dead
                    // going to add in an option to check if the player wished to tryonce more
                    if (player.HpCurrent <= 0)
                    {
                        Console.WriteLine("You are dead!");
                        player.IsDead = true;
                        Console.WriteLine("The fight took " + Iteration + " rounds to finish.\n");
                        LoadPlayer.LoadGame(player.NamePlayer);
                        //LocationCurrent.CurrentLocation();
                    }
                    #endregion
                }
                else
                {
                    Console.WriteLine(monsterNamed.Name + " Missed its attack");
                }
                #endregion

                Iteration++;
            }
            #endregion

            #region Load Contiune Menu
            if (player.IsDead == true)
            {
                //player.NamePlayer += " Dead";
                PlayerContinue.PContinue(player);
            }
            #endregion
        }