Beispiel #1
0
        public override async Task OnGameActionRequested(GameActionRequest actionRequest)
        {
            // OnGameActionRequested fires when your bot actually needs to do something. In the request, you will find the entire game
            // state (what you would normally see on the game table) and a list of possible actions. Some actions have options that
            // you need to provide when taking them, things like how many dice to roll, or which building you would like to buy.
            string log   = "OnGameActionRequested - Possible Actions:";
            bool   first = true;

            foreach (GameActionType type in actionRequest.PossibleActions)
            {
                if (!first)
                {
                    log += ",";
                }
                first = false;
                log  += $" {type.ToString()}";
            }
            Logger.Log(Log.Info, log);

            // This state helper object is super useful object that helps you understand the current state of the game.
            // There are 4 modules to the state helper. Each helper has functions specific the to topic.
            //     Player
            //         ex. GetPlayer(), GetNumberOfLandmarksOwned(), GetMaxRollsAllowed(), CanHaveExtraTurn()
            //     Marketplace
            //         ex. GetMaxBuildingsInGame(), GetBuiltBuildingsInCurrentGame(), GetBuildingTypesBuildableInMarketplace()
            //     CurrentTurn
            //         ex. CanRollOrReRoll(), GetPossibleActions(), CanTakeAction()
            //     BuildingRules
            //         This helper holds all of the building types and the rules of them. ex. BuildingRules[buildingIndex].GetColor()
            //
            StateHelper stateHelper = actionRequest.State.GetStateHelper(GetCurrentUserName());

            // Ask the log core to handle the action request.
            await m_logicCore.OnGameActionRequested(actionRequest, stateHelper);
        }
Beispiel #2
0
        public override async Task OnGameActionRequested(GameActionRequest actionRequest)
        {
            // OnGameActionRequested fires when your bot actually needs to do something. In the request, you will find the entire game state (what you would normally see on the table)
            // and a list of possible actions. Some actions have options that you need to provide when taking them, things like how many dice to roll, or which building you would like to buy.
            string log   = "OnGameActionRequested - Possible Actions:";
            bool   first = true;

            foreach (GameActionType type in actionRequest.PossibleActions)
            {
                if (!first)
                {
                    log += ",";
                }
                first = false;
                log  += $" {type.ToString()}";
            }
            Logger.Log(Log.Info, log);

            // This state helper object is useful to validate state questions.
            StateHelper stateHelper = actionRequest.State.GetStateHelper(GetCurrentUserName());

            // Ask the log core to handle the action request.
            await m_logicCore.OnGameActionRequested(actionRequest, stateHelper);
        }