public Dungeon(Hero hero, Enemy enemy) { counter = Count; lineCounter = LineCounter; this.hero = hero; this.enemy = enemy; spell = new Spell(); }
static void Main(string[] args) { Hero hero = new Hero(name: "Ivan", nickName: "Ruski", health: 100, mana: 100, manaRegenerationRate: 2); Enemy enemy = new Enemy(health: 100, mana: 100, damage: 20); Weapon wep = new Weapon("Damn", 20); hero.Equip(wep); Dungeon test = new Dungeon(hero, enemy); test.Spawn(hero); Commands(test,hero,enemy); }
public bool Spawn(Hero hero) { string[] text = File.ReadAllLines(path); string line = string.Empty; for (int i = 0; i < text.Length; i++) { line = text[i]; foreach (var item in line) { if (item.Equals('S')) { line = line.Replace('S', 'H'); text[i] = line; File.WriteAllLines(path, text); Count = i; return true; } LineCounter++; } LineCounter = 0; } return false; }
public static void Commands(Dungeon test,Hero hero,Enemy enemy) { test.PrintMap(); string inputDirection = string.Empty; while (true) { inputDirection= Console.ReadLine(); if (inputDirection == "Right") { Console.WriteLine(test.MoveHero(Direction.Right)); if (!hero.IsAlive()) { return; } if (test.Victory) { Console.WriteLine("You won"); return; } test.PrintMap(); } else if (inputDirection == "Left") { Console.WriteLine(test.MoveHero(Direction.Left)); if (!hero.IsAlive()) { return; } if (test.Victory) { Console.WriteLine("You won"); return; } test.PrintMap(); } else if (inputDirection == "Up") { Console.WriteLine(test.MoveHero(Direction.Up)); if (!hero.IsAlive()) { return; } if (test.Victory) { Console.WriteLine("You won"); return; } test.PrintMap(); } else if (inputDirection == "Down") { Console.WriteLine(test.MoveHero(Direction.Down)); if (!hero.IsAlive()) { return; } if (test.Victory) { Console.WriteLine("You won"); return; } test.PrintMap(); } else { Console.WriteLine("Wrong direction"); } } }
public Fight(Hero hero, Enemy enemy) { this.hero = hero; this.enemy = enemy; }