Beispiel #1
0
        //selects which shop you want to visit: Potion, Weapon or Inn
        public static void SelectShop(Entity player)
        {
            string shopChoice = CheckTown();

            if (shopChoice.Contains("potion"))
            {
                PotionShop.VisitPotionShop(player);
            }
            else if (shopChoice.Contains("weapon"))
            {
                WeaponShop.VisitWeaponShop(player);
            }
            else if (shopChoice.Contains("inn"))
            {
                Inn.VisitInn(player);
            }
            else if (shopChoice.Contains("leave"))
            {
                ConsoleEffects.TypeLine("Good luck out there!\r\n");
                ConsoleEffects.PressEnter();
                return;
            }
            else
            {
                SelectShop(player);
            }
        }
Beispiel #2
0
        //Battle Process
        public static void Fight(Entity enemy, Entity player)
        {
            do
            {
                bool wrongAnswer;
                do
                {
                    wrongAnswer = false;
                    string selectBattlePlan = Actions.SelectBattlePlan(player);
                    if (selectBattlePlan.Contains("attack"))
                    {
                        AttackEnemy(enemy, player);
                    }
                    //uses magic if magic
                    else if (selectBattlePlan.Contains("magic") && player.IsMage())
                    {
                        UseMagicFire((Mage)player, enemy);
                    }
                    else if (selectBattlePlan.Contains("potion"))
                    {
                        if (Entity.CheckInventory(player, "potion"))
                        {
                            Item potion = Entity.GetItemFromInventory(player, "potion");
                            Entity.UsePotion(player, potion);
                        }
                        else
                        {
                            ConsoleEffects.TypeLine("I am afraid you do not have any potions.\r\n");
                            wrongAnswer = true;
                        }
                    }
                    else
                    {
                        ConsoleEffects.TypeLine("\r\nI'm afraid that isn't an option.\r\n");
                        wrongAnswer = true;
                    }
                } while (wrongAnswer);

                if (enemy.Health > 0 && player.Health > 0)
                {
                    AttackPlayer(enemy, player);
                }
            } while (enemy.Health > 0 && player.Health > 0);

            if (enemy.Health <= 0)
            {
                ConsoleEffects.TypeLine(player.Name + " wins!\r\n");
                LootEnemy(player, enemy);
            }
            else if (player.Health <= 0)
            {
                ConsoleEffects.TypeLine(player.Name + " has fainted.\r\n");
                Inn.Sleep(player);
            }
        }