public static void Fight(IPlayer player) { Random rnd = new Random(); CreateMonsters(player); //Select a monster appropriate for player level int index = rnd.Next(monstersList.Count); monster = monstersList[index]; Console.WriteLine($"You encounter a {monster.Name}!"); //Starts the Combat resolution while (monster.Hp > 0 && player.Hp > 0) { if (player.Hp < player.MaxHp && player.Consumable != null) { Potions heal = new Potions(); Console.WriteLine("Do you wish to use a potion? y or n"); string usePotion = Console.ReadLine(); if (usePotion.ToUpper() == "Y") { heal.Restore(player); // IConsumable potion = player.Consumable.First(); // player.Hp += potion.Amount; // if (player.Hp > player.MaxHp) // { // player.Hp = player.MaxHp; // } // player.Consumable.RemoveAt(0); } } var playerDamage = player.Attack(player.Weapon); var monsterDamage = monster.Attack(monster.Strength); Console.WriteLine($"You attack and deal {playerDamage} damage!, {monster.Name} negates {monster.Armor} damage"); monster.Hp -= playerDamage - monster.Armor; Console.WriteLine($"{monster.Name} has {monster.Hp} HP left"); if (monster.Hp <= 0) { Console.WriteLine("you won the fight!"); monster.Gold = monster.DropGold(monster.Level); Console.WriteLine($"{monster.Name} yielded {monster.Exp} experience and dropped {monster.Gold} gold"); player.Exp += monster.Exp; player.Gold += monster.Gold; Console.WriteLine($"you now have {player.Gold} gold"); if (player.Exp >= player.ExpToLevel) { player = player.LevelUp(player); Console.WriteLine($"You gained a level! you are now level {player.Level}"); if (player.Level == 10) { wonGame = !wonGame; } } Console.WriteLine(""); Console.WriteLine("Press enter to continue"); Console.ReadLine(); break; } Console.WriteLine($"{monster.Name} attacks and deal {monsterDamage}, you negate {player.Armor.StatType} damage"); player.Hp -= monsterDamage - player.Armor.StatType; Console.WriteLine($"You have {player.Hp} HP left"); if (player.Hp <= 0) { Console.WriteLine("You died..."); Console.WriteLine("Press enter to exit"); lostGame = !lostGame; break; } Console.WriteLine(""); Console.WriteLine("*******************************************************************"); Console.ReadLine(); } }