Demo på Clean Code
This commit is contained in:
37
CleanDemo/GameRunner.cs
Normal file
37
CleanDemo/GameRunner.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
public class GameRunner {
|
||||
static void Main(string[] args) {
|
||||
Player player = new Player("Hero", 100, 15);
|
||||
player.AddToInventory("potion");
|
||||
player.AddToInventory("sword");
|
||||
|
||||
Enemy goblin = new Enemy("Goblin", 40, 8, EnemyType.Normal);
|
||||
Enemy dragon = new Enemy("Dragon", 120, 25, EnemyType.Boss);
|
||||
|
||||
var battle = new BattleService();
|
||||
|
||||
Console.WriteLine("=== GAME START ===");
|
||||
player.Describe();
|
||||
goblin.Describe();
|
||||
|
||||
Console.WriteLine("\n-- Round 1 --");
|
||||
battle.PlayerAttacks(player, goblin);
|
||||
battle.EnemyAttacks(goblin, player);
|
||||
battle.PlayerAttacks(player, goblin);
|
||||
|
||||
Console.WriteLine("\n-- Round 2 --");
|
||||
player.Describe();
|
||||
player.Heal();
|
||||
|
||||
Console.WriteLine("\n-- Boss Fight --");
|
||||
dragon.Describe();
|
||||
battle.PlayerAttacks(player, dragon);
|
||||
battle.EnemyAttacks(dragon, player);
|
||||
battle.PlayerAttacks(player, dragon);
|
||||
battle.EnemyAttacks(dragon, player);
|
||||
battle.PlayerAttacks(player, dragon);
|
||||
|
||||
|
||||
Console.WriteLine("\n=== RESULT ===");
|
||||
player.Describe();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user