Example #1
0
        /// <summary>
        /// Deals damage to given player
        /// </summary>
        /// <param name="aPlayer">The player the damage will be dealt upon</param>
        public void DealDamage(Player.Player aPlayer)
        {
            int
                tempWWD2 = Console.WindowWidth / 2,
                tempWHD2 = Console.WindowHeight / 2;

            aPlayer.PrintUI();
            if (myStunDuration > 0)
            {
                Console.SetCursorPosition(tempWWD2 - Language.GetEnemyCannotAttack().Length / 2, tempWHD2 - 11);
                Console.Write(Language.GetEnemyCannotAttack());
                myStunDuration--;
            }
            else
            {
                switch (myType)
                {
                case EnemyType.SKELETON:
                    Console.SetCursorPosition(tempWWD2 - Language.GetEnemySwingSword().Length / 2, tempWHD2 - 11);
                    Console.Write(Language.GetEnemySwingSword());
                    break;

                case EnemyType.ARCHER:
                    Console.SetCursorPosition(tempWWD2 - Language.GetEnemyDrawsBow().Length / 2, tempWHD2 - 11);
                    Console.Write(Language.GetEnemyDrawsBow());
                    break;

                case EnemyType.BOSS:
                    Console.SetCursorPosition(tempWWD2 - Language.GetBossWeapon().Length / 2 - (myName.Length / 2), tempWHD2 - 11);
                    Console.Write(myName + Language.GetBossWeapon());
                    break;
                }
                Thread.Sleep(1000);
                if (aPlayer.TakeDamage(myDamage, out float tempDamageDealt))
                {
                    Console.SetCursorPosition(tempWWD2 - (Language.GetTakeDamagePt1().Length + Language.GetTakeDamagePt2().Length + 5) / 2, tempWHD2 - 9);
                    Console.Write(Language.GetTakeDamagePt1());
                    Utility.PrintInColour(Math.Round(tempDamageDealt, 2).ToString(), ConsoleColor.Red);
                    Console.Write(Language.GetTakeDamagePt2());
                }
                else
                {
                    Console.SetCursorPosition(tempWWD2 - Language.GetEvadedStrike().Length / 2, tempWHD2 - 9);
                    Console.Write(Language.GetEvadedStrike());
                }
                if (aPlayer.GetHealth() <= 0)
                {
                    aPlayer.DeathSequence();
                }
            }
            Thread.Sleep(1500);
        }
Example #2
0
        /// <summary>
        /// Lets the player choose what to do after clearing a room from loot and/or enemies
        /// </summary>
        /// <param name="aPlayer">Active player</param>
        public void PostActio(Player.Player aPlayer)
        {
            int
                tempWWD2 = Console.WindowWidth / 2,
                tempWHD2 = Console.WindowHeight / 2;

            aPlayer.PrintUI();
            Console.SetCursorPosition(tempWWD2 - Language.GetPossibleActions().Length / 2, tempWHD2 - 12);
            Console.Write(Language.GetPossibleActions());
            Console.SetCursorPosition(tempWWD2 - 9, tempWHD2 - 10);
            Console.Write("[1] " + Language.GetContinueAdventure());
            Console.SetCursorPosition(tempWWD2 - 9, tempWHD2 - 9);
            Console.Write("[2] " + Language.GetOpenInventory());
            Console.SetCursorPosition(tempWWD2 - 9, tempWHD2 - 8);
            Console.Write("[3] " + Language.GetRest());
            Utility.PrintInColour("(-10 " + Language.GetGold() + ")", ConsoleColor.DarkRed);
            Console.SetCursorPosition(tempWWD2 - 9, tempWHD2 - 7);
            Console.Write("[4] " + Language.GetViewMap());
            Console.SetCursorPosition(tempWWD2 - 9, tempWHD2 - 6);
            Console.Write("[5] " + Language.GetCommitSuicide());
            switch (Utility.GetDigitInput(-1, -4, 5))
            {
            case 2:
                aPlayer.OpenInventory();
                PostActio(aPlayer);
                break;

            case 3:
                aPlayer.Rest();
                break;

            case 4:
                DungeonManager.GetActiveDungeon().ShowMap(aPlayer);
                PostActio(aPlayer);
                break;

            case 5:
                aPlayer.DeathSequence();
                break;
            }
        }
Example #3
0
        /// <summary>
        /// Opens the chest
        /// </summary>
        /// <param name="aPlayer">Active player</param>
        public void Open(Player.Player aPlayer)
        {
            int
                tempWWD2       = Console.WindowWidth / 2,
                tempWHD2       = Console.WindowHeight / 2,
                tempTextOffset = tempWHD2 - 10;

            aPlayer.PrintUI();
            Console.SetCursorPosition(tempWWD2 - Language.GetApproachChest().Length / 2, tempWHD2 - 12);
            Console.Write(Language.GetApproachChest());
            Thread.Sleep(1500);
            Console.SetCursorPosition(tempWWD2 - Language.GetItIsLocked().Length / 2, tempWHD2 - 10);
            Console.Write(Language.GetItIsLocked());
            Console.SetCursorPosition(tempWWD2 - Language.GetUnlockWish().Length / 2, tempWHD2 - 8);
            Console.Write(Language.GetUnlockWish());
            Console.SetCursorPosition(tempWWD2 - 8, tempWHD2 - 6);
            Console.Write("[1] " + Language.GetYes());
            Utility.PrintInColour("(-25 " + Language.GetGold() + ")", ConsoleColor.Red);
            Console.SetCursorPosition(tempWWD2 - 8, tempWHD2 - 5);
            Console.Write("[2] " + Language.GetNo());
            if (!myIsMimic && Utility.GetDigitInput(-7, -3, 2, 1) == 1)
            {
                aPlayer.PrintUI();
                aPlayer.SetGold(-25);
                if (myItems.Count > 0)
                {
                    Console.SetCursorPosition(tempWWD2 - Language.GetPeekLoot().Length / 2, tempWHD2 - 12);
                    Console.Write(Language.GetPeekLoot());
                    Thread.Sleep(1500);
                    for (int i = 0; i < myItems.Count; i++)
                    {
                        Console.SetCursorPosition(tempWWD2 - 20, tempTextOffset + i);
                        Console.Write("[" + (i + 3) + "] ");
                        switch (myItems[i].GetItemType())
                        {
                        case ItemType.SCROLL:
                            Utility.PrintInColour(myItems[i].GetFullName(), ConsoleColor.DarkMagenta);
                            break;

                        case ItemType.TRINKET:
                            Utility.PrintInColour(myItems[i].GetFullName(), ConsoleColor.Green);
                            break;

                        default:
                            Utility.PrintInColour("[" + myItems[i].GetRating() + "]" + myItems[i].GetFullName(), ConsoleColor.Gray);
                            break;
                        }
                        if (i == myItems.Count - 1)
                        {
                            Console.SetCursorPosition(tempWWD2 - 4, tempTextOffset + i * 2 + 1);
                            Utility.PrintInColour(Language.GetHPPotions() + ": " + myHPPotions.ToString(), ConsoleColor.Red);
                            Console.SetCursorPosition(tempWWD2 - 4, tempTextOffset + i * 2 + 2);
                            Utility.PrintInColour(Language.GetManaPotions() + ": " + myManaPotions.ToString(), ConsoleColor.Blue);
                            Console.SetCursorPosition(tempWWD2 - 4, tempTextOffset + i * 2 + 3);
                            Console.Write(Language.GetGold() + ": " + myGold);
                        }
                    }
                    Console.SetCursorPosition(tempWWD2 - 20, tempWHD2);
                    Console.Write("[1] " + Language.GetPickup() + "    [0] " + Language.GetDiscard());
                    Console.SetCursorPosition(tempWWD2 - 20, tempWHD2 + 1);
                    Console.Write("[2] " + Language.GetPickUpEquip());
                    switch (Utility.GetDigitInput(-19, 3, 2))
                    {
                    case 0:
                        myItems.Clear();
                        break;

                    case 1:
                        aPlayer.AddItemsToInventory(myItems);
                        aPlayer.SetGold(myGold);
                        aPlayer.SetHealthPotions(myHPPotions);
                        aPlayer.SetManaPotions(myManaPotions);
                        aPlayer.PrintUI();
                        Console.SetCursorPosition(tempWWD2 - 12, tempWHD2 - 12);
                        Console.Write(Language.GetLootAdded());
                        Thread.Sleep(1500);
                        break;

                    case 2:
                        aPlayer.AddItemsToInventory(myItems);
                        aPlayer.EquipBestItems();
                        aPlayer.SetGold(myGold);
                        aPlayer.SetHealthPotions(myHPPotions);
                        aPlayer.SetManaPotions(myManaPotions);
                        aPlayer.PrintUI();
                        Console.SetCursorPosition(tempWWD2 - 12, tempWHD2 - 12);
                        Console.Write(Language.GetLootAdded());
                        Thread.Sleep(1500);
                        break;
                    }
                }
                else
                {
                    Console.SetCursorPosition(tempWWD2 - Language.GetPeekNoLoot().Length / 2, tempWHD2 - 12);
                    Console.Write(Language.GetPeekNoLoot());
                    Thread.Sleep(1500);
                }
            }
            else if (myIsMimic)
            {
                aPlayer.PrintUI();
                Console.SetCursorPosition(tempWWD2 - Language.GetNoOrdinaryPt1().Length / 2, tempWHD2 - 12);
                Console.Write(Language.GetNoOrdinaryPt1());
                Console.SetCursorPosition(tempWWD2 - Language.GetNoOrdinaryPt2().Length / 2, tempWHD2 - 11);
                Console.Write(Language.GetNoOrdinaryPt2());
                Thread.Sleep(3000);
                if (aPlayer.GetAgility() / 2 > Utility.GetRNG().Next(1, 101))
                {
                    aPlayer.PrintUI();
                    Console.SetCursorPosition(tempWWD2 - Language.GetEscapeFangs().Length / 2, tempWHD2 - 12);
                    Console.Write(Language.GetEscapeFangs());
                    Thread.Sleep(1500);
                }
                else
                {
                    aPlayer.PrintUI();
                    Console.SetCursorPosition(tempWWD2 - Language.GetDecapitate().Length / 2, tempWHD2 - 12);
                    Console.Write(Language.GetDecapitate());
                    Thread.Sleep(1500);
                    aPlayer.DeathSequence();
                }
            }
        }