public void MagicalAttack(Monster monster, string spellName)
        {
            Spell spellToCast = new Spell("You Have No Spells", 0, 0);

            foreach (Spell spell in Spells)
            {
                if (spellName == spell.Name)
                {
                    spellToCast = spell;
                }
            }
            int dealtDamage = (this.MagAttack + spellToCast.Damage) - monster.MagDefense;

            if (dealtDamage < 0)
            {
                dealtDamage = 0;
            }
            this.CurrentMP    -= spellToCast.MpCost;
            monster.CurrentHP -= dealtDamage;

            List <string> prompts = new List <string>()
            {
                $"{this.Name} Casts: {spellToCast.Name}",
                $"{this.Name} does {dealtDamage} damage",
                $"{this.Name} used {spellToCast.MpCost} mp and now has {this.CurrentMP} mp left",
                $"The {monster.Name} steps back... probably"
            };

            DisplayMethods.DisplayInformation(prompts);
            DisplayMethods.DisplayInformation("Press any key to continue...", true);
        }
示例#2
0
        public void DisplayStatus()
        {
            List <string> prompts = new List <string>
            {
                "Name: " + this.Name,
                "Level: " + this.Level,
                "Health: " + this.CurrentHP + " | " + this.MaxHP,
                "Mana: " + this.CurrentMP + " | " + this.MaxMP,
                "Stamina: " + this.CurrentStamina + " | " + this.MaxStamina,
                "Attack: " + this.Attack,
                "Defense: " + this.Defense,
                "Magic Attack: " + this.MagAttack,
                "Magic Defense: " + this.MagDefense,
                "Luck: " + this.Luck,
                "Experience Value: " + this.Exp + "xp",
                "Gold: " + this.Gold
            };

            foreach (string name in AbilityNames)
            {
                prompts.Add($"Ability: {name}");
            }
            DisplayMethods.DisplayInformation(prompts);
            DisplayMethods.DisplayWrappedInformation($"Lore: {this.Lore}");
            DisplayMethods.DisplayInformation("Press any key to continue...", true);
        }
示例#3
0
        public void RunCharacterCreation()
        {
            var song = new Playable(new MusicPlayer(), Track.Intro);

            song.Play();
            List <string> getName = new List <string>()
            {
                "Enter Name: "
            };

            this.Player = new PlayerCharacter(DisplayMethods.DisplayInformation(getName, true));

            Console.Clear();

            List <string> prompts = new List <string>()
            {
                "Welcome to a Rogue Tribute",
                "Every single playthrough will be randomized and unique",
                "There are 10 Levels...",
                "Hadrian, The Stone King, Awaits you at the End...",
                "GoodLuck...",
            };

            DisplayMethods.DisplayInformation(prompts, 500);

            DisplayMethods.DisplayInformation(this.Player.Name, 300);

            DisplayMethods.DisplayInformation("Press Any Key to Continue...", true);

            Console.Clear();

            this.Player.AwardExp(1);
            this.Player.CheckIfLevelUp();
            song.Stop();
        }
        public void PhysicalAttack(Monster monster)
        {
            this.CurrentStamina -= 1;
            if (this.CurrentStamina > -1)
            {
                int dealtDamage = this.Attack - monster.Defense;
                if (dealtDamage < 0)
                {
                    dealtDamage = 0;
                }
                monster.CurrentHP -= dealtDamage;
                List <string> prompts = new List <string>()
                {
                    $"{this.Name} Punched the {monster.Name}",
                    $"{this.Name} dealt {dealtDamage} dmg!!!",
                    $"You spent 1 stamina || Current Stamina {this.CurrentStamina}",
                    $"The {monster.Name} trembles... probably..."
                };
                DisplayMethods.DisplayInformation(prompts);
            }
            else
            {
                this.CurrentStamina = 0;
                DisplayMethods.DisplayInformation("You were too tired to attack... (Stamina too low)");
            }

            System.Threading.Thread.Sleep(1000);
        }
        internal void ViewSpells()
        {
            List <string> prompts = new List <string>();

            foreach (Spell spell in Spells)
            {
                prompts.Add($"{spell.Name} || Cost: {spell.MpCost} || Base Damage: {spell.Damage}");
            }
            DisplayMethods.DisplayInformation(prompts);
        }
        public void ViewItemInventory()
        {
            Dictionary <string, int> newPrompts = new Dictionary <string, int>();

            foreach (IItem item in Inventory)
            {
                newPrompts[item.ItemName] += 1;
            }
            DisplayMethods.DisplayInformation("Item Inventory");
            DisplayMethods.DisplayInformation(newPrompts);
        }
示例#7
0
        private void AttackPlayer(PlayerCharacter player)
        {
            int dealtDamage = this.Attack - player.Defense + player.TempDef;

            if (dealtDamage < 0)
            {
                dealtDamage = 0;
            }
            player.CurrentHP -= dealtDamage;
            List <string> prompts = new List <string>()
            {
                $"The {this.Name} attacked!!!",
                $"It dealt {dealtDamage} dmg!!!",
            };

            DisplayMethods.DisplayInformation(prompts);
            DisplayMethods.DisplayInformation("Press any key to continue...", true);
        }
示例#8
0
        static void Main(string[] args)
        {
            string headerText = "Student List";

            DisplayMethods.DisplayHeader(headerText);

            StudentList.ListStudents();

            Console.Write("Select ID to view details: ");

            string choice    = Console.ReadLine();
            int    choiceInt = 0;

            Int32.TryParse(choice, out choiceInt);

            StudentDetails.CourseDetailsView(choiceInt);


            Console.ReadLine();
        }
        public void ViewStatus()
        {
            List <string> newPrompts = new List <string>
            {
                "Name: " + this.Name,
                "Level: " + this.Level,
                "Health: " + this.CurrentHP + " | " + this.MaxHP,
                "Mana: " + this.CurrentMP + " | " + this.MaxMP,
                "Stamina: " + this.CurrentStamina + " | " + this.MaxStamina,
                "Attack: " + this.Attack,
                "Defense: " + this.Defense,
                "Magic Attack: " + this.MagAttack,
                "Magic Defense: " + this.MagDefense,
                "Luck: " + this.Luck,
                "Current Experience: " + this.Exp + "xp" + " | to next level " + (LevelingArray[this.Level] - this.Exp) + "xp",
                "Gold: " + this.Gold
            };

            DisplayMethods.DisplayInformation(newPrompts);
        }
示例#10
0
        public void DoPlayerInput(ConsoleKeyInfo input)
        {
            Console.Clear();
            switch (input.Key)
            {
            case ConsoleKey.I:
            {
                if (this.Player.Inventory != null)
                {
                    this.Player.ViewItemInventory();
                }
                else
                {
                    DisplayMethods.DisplayInformation("Your Inventory Is Empty");
                }
                break;
            }

            case ConsoleKey.V:
            {
                this.Player.ViewStatus();
                break;
            }

            case ConsoleKey.Escape:
            {
                DisplayMethods.DisplayInformation("Paused...");
                break;
            }

            case ConsoleKey.O:
            {
                this.Player.ViewSpells();
                break;
            }
            }
            DisplayMethods.DisplayInformation("Press Enter to Continue...", true);

            Console.Clear();
        }
示例#11
0
        public static void CourseDetailsView(int id)
        {
            Console.Clear();
            DisplayMethods.DisplayHeader("Details of Student");


            using (var _context = new SchoolContext())
            {
                // Display the studetns name and details
                var students = _context.Students.Where(s => s.ID == id);
                foreach (var student in students)
                {
                    Console.WriteLine("Lastname: " + student.LastName);
                    Console.WriteLine("Firstname: " + student.FirstMidName);
                    Console.WriteLine("Enrollment Date: {0}", student.EnrollmentDate.ToLongDateString());
                    Console.WriteLine();
                    Console.WriteLine("Course Title\t\tGrade");
                }

                // Display the Course Title and Grade
                var enrollments = _context.Enrollments.Where(s => s.StudentID == id);

                var courses = from c in _context.Courses
                              join e in enrollments
                              on c.CourseID equals e.CourseID
                              select new
                {
                    Title = c.Title,
                    Grade = e.Grade
                };

                foreach (var item in courses)
                {
                    Console.WriteLine("{0}\t\t{1}", item.Title, item.Grade);
                }
                Console.WriteLine("Press <Enter> to Return to List");

                _context.Dispose();
            }
        }
示例#12
0
        private void Defend(PlayerCharacter player)
        {
            List <string> prompts = new List <string>()
            {
                $"The {this.Name} hunkered down and guarded",
                $"The {this.Name} restored 1 stamina and gained {(int)(this.Level * 1.5)} defense and {(int)(this.Level * 1.5)} magic defense for the next turn"
            };

            if (this.CurrentStamina + 1 <= this.MaxStamina)
            {
                this.CurrentStamina++;
            }
            else
            {
                this.CurrentStamina = this.MaxStamina;
            }

            this.Defense    += (int)(this.Level * 1.5);
            this.MagDefense += (int)(this.Level * 1.5);
            this.IsDefend    = true;

            DisplayMethods.DisplayInformation(prompts);
            DisplayMethods.DisplayInformation("Press any key to continue...", true);
        }
        private void RunEncounterLoop(Monster newMonster, PlayerCharacter player)
        {
            var song = new Playable(new MusicPlayer(), Track.Battle);

            song.Play();

            System.Threading.Thread.Sleep(1000);

            Console.Clear();
            while (true)
            {
                bool winState     = false;
                bool loseState    = false;
                bool ranAwayState = false;
                bool restartMenu  = false;

                string        input;
                List <string> prompts = new List <string>()
                {
                    $"You face the mighty {newMonster.Name}",
                    $"HP: {newMonster.CurrentHP}",
                    $"Attack: {newMonster.Attack}",
                    "",
                    "Choose your choice...",
                    $"(1) Attack the {newMonster.Name}",
                    $"(2) Use a Spell on the {newMonster.Name}",
                    $"(R) Attempt to run away based on Luck Stat",
                    $"(I) Inspect the monster (Costs a turn)",
                    "",
                    "",
                    $"{player.Name} | HP: {player.CurrentHP} | MP: {player.CurrentMP} | Stam: {player.CurrentStamina}",
                    "Player Input (1, 2, R, I):"
                };
                while (true)
                {
                    input = DisplayMethods.DisplayInformation(prompts, true);
                    input = input.Substring(0, 1);
                    input = input.ToUpper();
                    if (input == "1" || input == "2" || input == "R" || input == "I")
                    {
                        break;
                    }
                    else
                    {
                        Console.Clear();
                    }
                }
                Console.Clear();
                switch (input)
                {
                case "1":
                    player.PhysicalAttack(newMonster);
                    break;

                case "2":
                {
                    bool doAttack = false;
                    while (!doAttack)
                    {
                        List <string> magicPrompts = new List <string>()
                        {
                            "Choose a spell to cast: "
                        };
                        for (int i = 0; i < player.Spells.Count; i++)
                        {
                            magicPrompts.Add($"({i + 1}) {player.Spells[i].Name}");
                        }
                        magicPrompts.Add("(Q) Quit Back to Select");
                        magicPrompts.Add("Player Input: ");
                        string magicInput = DisplayMethods.DisplayInformation(magicPrompts, true);
                        magicInput = magicInput.Substring(0, 1);

                        if (magicInput.ToUpper() == "Q")
                        {
                            Console.Clear();
                            restartMenu = true;
                            break;
                        }

                        for (int i = 0; i < player.Spells.Count; i++)
                        {
                            if ((i + 1).ToString() == magicInput)
                            {
                                doAttack = true;
                            }
                        }

                        if (doAttack)
                        {
                            if (player.CurrentMP >= player.Spells[int.Parse(magicInput) - 1].MpCost)
                            {
                                Console.Clear();
                                player.MagicalAttack(newMonster, player.Spells[int.Parse(magicInput) - 1].Name);
                            }
                            else
                            {
                                doAttack = false;
                                DisplayMethods.DisplayInformation("You do not have enough mana!!!");
                                DisplayMethods.DisplayInformation("Press enter to continue...", true);
                                Console.Clear();
                            }
                        }
                    }
                    break;
                }

                case "R":
                    Random runAwayChance = new Random();
                    if (runAwayChance.Next(0, newMonster.Luck) < runAwayChance.Next(0, player.Luck))
                    {
                        DisplayMethods.DisplayInformation("Successfully got away!!!");
                        ranAwayState = true;
                    }
                    else
                    {
                        DisplayMethods.DisplayInformation("Failed to get away!!!");
                    }
                    break;

                case "I":
                {
                    newMonster.DisplayStatus();
                    DisplayMethods.DisplayInformation("Press Any key To Continue");
                    Console.Clear();
                    break;
                }
                }

                if (restartMenu)
                {
                    continue;
                }

                if (ranAwayState)
                {
                    song.Stop();
                    break;
                }

                winState = newMonster.CurrentHP <= 0;

                DisplayMethods.DisplayInformation("");
                if (winState)
                {
                    DisplayMethods.DisplayInformation($"The {newMonster.Name} has finally fallen... What a challenge.");
                    player.AwardExp(newMonster.Exp);
                    Console.Clear();
                    song.Stop();
                    player.CheckIfLevelUp();
                    break;
                }
                newMonster.Act(player);
                Console.Clear();

                loseState = player.CurrentHP <= 0;



                if (loseState)
                {
                    DisplayMethods.DisplayInformation($"{player.Name} has died horribly at the hands of the mighty {newMonster.Name}...");
                    DisplayMethods.DisplayInformation("Press any key to end...", true);
                    song.Stop();
                    break;
                }
                prompts.Clear();
            }
            song.Stop();
        }
示例#14
0
        private void UseAbility(PlayerCharacter player)
        {
            List <string> prompts = new List <string>()
            {
                $"The {this.Name} used {this.AbilityToUse.Name}",
                $"The {this.Name} {this.AbilityToUse.Dialog}"
            };

            if (this.AbilityToUse.IsAttack)
            {
                int physicalDealtDamage = (this.AbilityToUse.Attack + this.Attack) - player.Defense + player.TempDef;
                int magicalDealtDamage  = (this.AbilityToUse.MagAttack + this.MagAttack) - player.MagDefense + player.TempMagDef;


                if (physicalDealtDamage > 0)
                {
                    prompts.Add($"The {this.Name} dealt {physicalDealtDamage} physical damage");
                    player.CurrentHP -= physicalDealtDamage;
                }

                if (magicalDealtDamage > 0)
                {
                    prompts.Add($"The {this.Name} dealt {magicalDealtDamage} magic damage");
                    player.CurrentHP -= magicalDealtDamage;
                }

                if (this.AbilityToUse.HP > 0)
                {
                    prompts.Add($"The {this.Name} healed you {this.AbilityToUse.HP} HP");
                    if (player.CurrentHP + this.AbilityToUse.HP <= player.MaxHP)
                    {
                        player.CurrentHP += this.AbilityToUse.HP;
                    }
                    else
                    {
                        player.CurrentHP = player.MaxHP;
                    }
                }
                this.CurrentMP -= this.AbilityToUse.MP;
            }
            else
            {
                if (this.AbilityToUse.HP != 0)
                {
                    prompts.Add($"The {this.Name} {VerbForStatus(this.AbilityToUse.HP)} its health for {this.AbilityToUse.HP}");
                }
                if (this.AbilityToUse.MP != 0)
                {
                    prompts.Add($"The {this.Name} {VerbForStatus(this.AbilityToUse.MP)} its mana for {this.AbilityToUse.MP}");
                }
                if (this.AbilityToUse.Stamina != 0)
                {
                    prompts.Add($"The {this.Name} {VerbForStatus(this.AbilityToUse.Stamina)} its stamina for {this.AbilityToUse.Stamina}");
                }
                if (this.AbilityToUse.Attack != 0)
                {
                    prompts.Add($"The {this.Name} {VerbForCombat(this.AbilityToUse.Attack)} its attack by {this.AbilityToUse.Attack}");
                }
                if (this.AbilityToUse.Defense != 0)
                {
                    prompts.Add($"The {this.Name} {VerbForCombat(this.AbilityToUse.Defense)} its defense by {this.AbilityToUse.Defense}");
                }
                if (this.AbilityToUse.MagAttack != 0)
                {
                    prompts.Add($"The {this.Name} {VerbForCombat(this.AbilityToUse.MagAttack)} its magic attack by {this.AbilityToUse.MagAttack}");
                }
                if (this.AbilityToUse.MagAttack != 0)
                {
                    prompts.Add($"The {this.Name} {VerbForCombat(this.AbilityToUse.MagDefense)} its magic defense by {this.AbilityToUse.MagDefense}");
                }

                if (this.CurrentHP + this.AbilityToUse.HP <= this.MaxHP)
                {
                    this.CurrentHP += this.AbilityToUse.HP;
                }
                else
                {
                    this.CurrentHP = this.MaxHP;
                }

                if (this.CurrentMP + this.AbilityToUse.MP <= this.MaxMP)
                {
                    this.CurrentMP += this.AbilityToUse.MP;
                }
                else
                {
                    this.CurrentMP = this.MaxMP;
                }

                if (this.CurrentStamina + this.AbilityToUse.Stamina <= this.MaxStamina)
                {
                    this.CurrentStamina += this.AbilityToUse.Stamina;
                }
                else
                {
                    this.CurrentStamina = this.MaxStamina;
                }

                this.Attack     += this.AbilityToUse.Attack;
                this.Defense    += this.AbilityToUse.Defense;
                this.MagAttack  += this.AbilityToUse.MagAttack;
                this.MagDefense += this.AbilityToUse.MagDefense;
            }

            DisplayMethods.DisplayInformation(prompts);
            DisplayMethods.DisplayInformation("Press any key to continue...", true);
        }
        private void LevelUp()
        {
            List <string> prompts = new List <string>();

            prompts.Add("Level: " + this.Level);

            Random randomLevelSeed   = new Random();
            int    randomHPAddition  = randomLevelSeed.Next(3, this.Luck / randomLevelSeed.Next(1, 3) + 3);
            int    randomMPAddition  = randomLevelSeed.Next(2, this.Luck / randomLevelSeed.Next(1, 3) + 1);
            int    count             = 3;
            bool   didLevelNineCount = false;


            while (this.LevelingArray[this.Level] < this.Exp)
            {
                if (this.Level >= 9 && !didLevelNineCount)
                {
                    count             = 9;
                    didLevelNineCount = true;
                }
                prompts.Add("LEVEL UP!!!");
                prompts.Add("New Level: " + (this.Level + 1));
                prompts.Add($"HP: {this.MaxHP} + {randomHPAddition} = {(this.MaxHP + randomHPAddition)}");
                prompts.Add($"MP: {this.MaxMP} + {randomMPAddition} = {(this.MaxMP + randomMPAddition)}");

                prompts.Add($"You have {count} stats to allot: ");
                prompts.Add($"(1) Attack: {this.Attack}");
                prompts.Add($"(2) Defense: {this.Defense}");
                prompts.Add($"(3) Magic Attack: {this.MagAttack}");
                prompts.Add($"(4) Magic Defense: {this.MagDefense}");
                prompts.Add($"(5) Stamina: {this.MaxStamina}");
                prompts.Add($"(6) Luck: {this.Luck}");
                prompts.Add("");
                prompts.Add("Player input (1,2,3,4,5,6): ");


                string input;
                while (true)
                {
                    input = DisplayMethods.DisplayInformation(prompts, true);
                    input = input.Substring(0, 1);
                    if (input == "1" || input == "2" || input == "3" || input == "4" || input == "5" || input == "6")
                    {
                        break;
                    }
                    else
                    {
                        Console.Clear();
                    }
                }
                switch (input)
                {
                case "1":
                    this.Attack++;
                    break;

                case "2":
                    this.Defense++;
                    break;

                case "3":
                    this.MagAttack++;
                    break;

                case "4":
                    this.MagDefense++;
                    break;

                case "5":
                    this.MaxStamina++;
                    this.CurrentStamina++;
                    break;

                case "6":
                    this.Luck++;
                    break;
                }
                count--;
                if (count < 1)
                {
                    this.Level++;
                    count            = 3;
                    this.MaxHP      += randomHPAddition;
                    this.CurrentHP  += randomHPAddition;
                    this.MaxMP      += randomMPAddition;
                    this.CurrentMP  += randomMPAddition;
                    randomHPAddition = randomLevelSeed.Next(3, this.Luck / randomLevelSeed.Next(1, 3) + 3);
                    randomMPAddition = randomLevelSeed.Next(2, this.Luck / randomLevelSeed.Next(1, 3) + 1);
                }
                prompts.Clear();
                Console.Clear();
            }

            if (this.Level == 1)
            {
                Spell fireBall = new Spell("FireBall", 2, 2);
                DisplayMethods.DisplayInformation($"For reaching {this.Level} level you have been awarded the {fireBall.Name} Spell || {fireBall.Damage} damage || {fireBall.MpCost} cost. ");
                this.AddSpell(fireBall);
            }

            DisplayMethods.DisplayInformation("Finished Leveling", true);
            Console.Clear();
        }