public void FightMagicalCreature(MagicalCreature creature) { bool fightMode = true; while (fightMode) { Console.Clear(); string attack = creature.GetRandomAttack(); Console.WriteLine($"{creature.Name} {attack}"); var attackDamage = creature.Strength - player.Endurance; Console.Write($"Dealing {attackDamage} damage"); player.Hp -= creature.Strength; Console.ReadLine(); Console.WriteLine($"You hit {creature.Name} with your slingshot!"); Console.Write($"Dealing {player.Strength} damage"); creature.Hp -= player.Strength; Console.ReadLine(); if (player.Hp <= 0) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("\nYou are defeated and failed to complete your mission. The animals will hate you for all eternity!"); Console.WriteLine("GAME OVER"); Environment.Exit(0); } if (creature.Hp <= 0) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(); player.Level += 1; Console.WriteLine($"You have defeated {creature.Name}! You gained {creature.Exp} experience points and {creature.Gold} gold"); player.Exp += creature.Exp; player.Gold += creature.Gold; Console.WriteLine($"You've reached level {player.Level}. You have now {player.Exp} exp, {player.Hp} hp and {player.Gold} gold"); foreach (var item in ListOfCreatures) { if (creature == item) { ListOfCreatures.Remove(creature); break; } } Console.ReadLine(); Menu(); } Console.WriteLine($"\n{player.Name}: {player.Hp} hp"); Console.WriteLine($"{creature.Name}: {creature.Hp} hp"); Console.ReadLine(); } }
public void AddMagicalCreatures() { ListOfCreatures.Add(new MagicalCreature("Cinderella", 20, 5, "throws ashes in your eyes", "takes help from fairy godmother and try to turn you into a pumpkin!")); ListOfCreatures.Add(new MagicalCreature("Prince Charming", 20, 5, "weakens you with his charm", "flips his hair which leaves you breathless")); ListOfCreatures.Add(new MagicalCreature("Rapunzel", 30, 8, "hits you with a frying pan!", "strangle you with her hair!")); ListOfCreatures.Add(new MagicalCreature("Ariel", 20, 5, "distracts you and hits you with her fin!", "stabs you in your feets with a fork")); ListOfCreatures.Add(new MagicalCreature("Belle", 20, 5, "throws books at you!", "calls for The Beast who jumps on you and bites you in the arm!")); ListOfCreatures.Add(new MagicalCreature("The Big Bad Wolf", 30, 8, "he huffs and he puffs and he blows you over with a BANG!", "he scratches you with his claws")); ListOfCreatures.Add(new MagicalCreature("Elsa", 30, 8, "throws snowballs at you", "hits you with an ice blast!")); ListOfCreatures.Add(new MagicalCreature("Snow white", 40, 10, "makes you eat poison apple", "calls for the 7 dwarfs who hits you with sledgehammers!")); ListOfCreatures.Add(new MagicalCreature("Maleficent", 40, 10, "pokes you with her horns!", "casts a curse of pain on you!")); theWitch = new MagicalCreature("The Witch", 100, 15, "uses telekinesis and hits you with her broom", "throws witchcraft towards you"); }