예제 #1
0
        public void OnChooseEntities(KettleChooseEntities chooseEntities)
        {
            Console.WriteLine("simulator OnChooseEntities called");

            PowerEntityChoices entityChoices = Game.EntityChoicesMap[chooseEntities.Id];
            ChooseTask         chooseTask    = entityChoices.ChoiceType == ChoiceType.MULLIGAN
                                ? ChooseTask.Mulligan(entityChoices.PlayerId == 1 ? Game.Player1 : Game.Player2, chooseEntities.Choices)
                                : ChooseTask.Pick(entityChoices.PlayerId == 1 ? Game.Player1 : Game.Player2, chooseEntities.Choices[0]);

            Console.WriteLine($"processing => {chooseTask.FullPrint()}");

            Adapter.SendMessage(new KettleEntitiesChosen
            {
                ChoiceType     = (int)entityChoices.ChoiceType,
                PlayerId       = entityChoices.PlayerId,
                ChooseEntities = chooseEntities,
            });

            Game.Process(chooseTask);
            ShowLog(Game, LogLevel.VERBOSE);

            SendPowerHistory(Game.PowerHistory.Last);
            SendChoicesOrOptions();

            if (Game.Step == Step.BEGIN_MULLIGAN &&
                Game.Player1.MulliganState == Mulligan.DONE &&
                Game.Player2.MulliganState == Mulligan.DONE)
            {
                Game.MainBegin();

                while (Game.Step != Step.MAIN_ACTION)
                {
                    Thread.Sleep(500);
                }

                ShowLog(Game, LogLevel.VERBOSE);

                SendPowerHistory(Game.PowerHistory.Last);
                SendChoicesOrOptions();
            }
        }