コード例 #1
0
        public void Fight(PlayerModel player, MonsterModel monster)
        {
            player.PrepareFight();
            player.Ability(player);
            monster.Ability(player);

            while (player.HP > 0 && monster.HP > 0)
            {
                PlayerAttackJudge(player, monster);

                monster.HP = monster.HP - CalculateDamage(player.Attak, monster.Defence);
                if (monster.HP <= 0)
                {
                    monster.HP = 0;
                    break;
                }

                player.HP = player.HP - CalculateDamage(monster.Attak, player.Defence);
                if (player.HP <= 0)
                {
                    player.HP = 0;
                }
                Thread.Sleep(WaitMillionSecond);
            }

            if (player.HP == 0)
            {
                ShowLoseResult(player, monster);
            }
            else
            {
                ShowWinResult(player, monster);
            }
        }