예제 #1
0
        private void initGame()
        {
            // Init decks
            List <STC.Card> cardsInDeck = new List <STC.Card>();

            HearthMirror.Objects.Deck MirrorDeck = Core.Game.CurrentSelectedDeck;
            if (MirrorDeck != null)
            {
                MirrorDeck.Cards.ForEach(card =>
                {
                    for (var i = 0; i < card.Count; i++)
                    {
                        cardsInDeck.Add(STC.Cards.FromId(card.Id));
                    }
                });
            }

            List <STC.Card> UnknownDeck = new List <STC.Card>();

            for (int i = 0; i < 30; i++)
            {
                UnknownDeck.Add(new STC.Card()
                {
                    Id   = "Unknown",
                    Name = "Unknown",
                    Tags = new Dictionary <GameTag, int> {
                        [GameTag.CARDTYPE] = (int)CardType.MINION, [GameTag.COST] = 51
                    },
                });
            }

            // Init agent
            _agent = new Expectiminimax(cardsInDeck, Converter.GetCardClass(Core.Game.Player.Class), Strategy.Control);

            // Init game
            GameV2 gameV2 = Core.Game;

            _game = new STC.Game(
                new GameConfig()
            {
                StartPlayer      = gameV2.Player.HandCount == 3 ? 1 : 2,
                Player1Name      = gameV2.Player.Name,
                Player1HeroClass = Converter.GetCardClass(gameV2.Player.Class),
                Player1Deck      = cardsInDeck,
                Player2Name      = gameV2.Opponent.Name,
                Player2HeroClass = Converter.GetCardClass(gameV2.Opponent.Class),
                Player2Deck      = UnknownDeck,
                FillDecks        = false,
                Shuffle          = false,
                SkipMulligan     = false,
                AutoNextStep     = false,
                Logging          = false,
                History          = false,
                RandomController = _randomController
            });
            _game.StartGame();
            _game.BeginDraw();
            _game.BeginMulligan();
            Converter.SyncEntityIds(ref _entityIdMapping, _game, gameV2);
        }
예제 #2
0
        /// <summary>Invokes the method which corresponds to the next simulation step.</summary>
        /// <param name="game">The game subject.</param>
        /// <param name="step">The (next) step value.</param>
        /// <exception cref="ArgumentOutOfRangeException">step - when the provided step is unknown</exception>
        public void NextStepEvent(Game game, Step step)
        {
            game.Log(LogLevel.DEBUG, BlockType.TRIGGER, "Event", !game.Logging? "":$"NextStepEvent - {step}");
            switch (step)
            {
            case Step.BEGIN_FIRST:
                game.Step = step;
                game.BeginFirst();
                break;

            case Step.BEGIN_SHUFFLE:
                game.Step = step;
                game.BeginShuffle();
                break;

            case Step.BEGIN_DRAW:
                game.Step = step;
                game.BeginDraw();
                break;

            case Step.BEGIN_MULLIGAN:
                game.Step = step;
                game.BeginMulligan();
                break;

            case Step.MAIN_BEGIN:
                game.Step = step;
                game.MainBegin();
                break;

            case Step.MAIN_DRAW:
                game.Step = step;
                game.MainDraw();
                break;

            case Step.MAIN_READY:
                game.Step = step;
                game.MainReady();
                break;

            case Step.MAIN_RESOURCE:
                game.Step = step;
                game.MainRessources();
                break;

            case Step.MAIN_START:
                game.Step = step;
                game.MainStart();
                break;

            case Step.MAIN_START_TRIGGERS:
                game.Step = step;
                game.MainStartTriggers();
                break;

            case Step.MAIN_ACTION:
                game.Step = step;
                break;

            case Step.MAIN_COMBAT:
                break;

            case Step.MAIN_CLEANUP:
                game.Step = step;
                game.MainCleanUp();
                break;

            case Step.MAIN_END:
                game.Step = step;
                game.MainEnd();
                break;

            case Step.MAIN_NEXT:
                game.Step = step;
                game.MainNext();
                break;

            case Step.FINAL_WRAPUP:
                game.FinalWrapUp();
                break;

            case Step.FINAL_GAMEOVER:
                game.FinalGameOver();
                break;

            case Step.INVALID:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(step), step, null);
            }
        }