receiveDamage() public method

public receiveDamage ( Weapon weapon ) : void
weapon Weapon
return void
コード例 #1
0
ファイル: MainGame.cs プロジェクト: somoso/psychic-dangerzone
        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;
            }
        }