Пример #1
0
        protected void attack(Enemy enemy, Weapon weapon)
        {
            playerone.currentRoom.battle.steps++;
            enemy.receiveDamage(weapon);
            playerone.receiveDamage(enemy, weapon);

            if (playerone.health > 0)
            {
                Console.WriteLine("You are now at " + playerone.health + "HP");
            }

            if (enemy.health > 0)
            {
                Console.WriteLine("Enemy " + enemy.name + " is now at " + enemy.health + "HP\n\n");
                printFleeText();
            } else {
                Console.WriteLine("The enemy " + enemy.name + " is dead!");
                playerone.currentRoom.battle.enemies.Remove(enemy);
                Console.WriteLine("You can now continue your journey in this castle.");
                printRoomInfo = true;
            }
        }
Пример #2
0
 public void receiveDamage(Enemy enemy, Weapon weapon)
 {
     health -= weapon.damageToSelf;
     health -= enemy.damage;
 }