Esempio n. 1
0
        public ScenarioRunner ReceivesAcceptDirectTradeEvent(string buyerName, ResourceClutch buyingResources, string sellerName, ResourceClutch sellingResources)
        {
            var gameEvent        = new AcceptTradeEvent(this.GetPlayerId(buyerName), buyingResources, this.GetPlayerId(sellerName), sellingResources);
            var eventInstruction = new EventInstruction(gameEvent);

            this.currentPlayerAgent.AddInstruction(eventInstruction);
            return(this);
        }
Esempio n. 2
0
        public ScenarioRunner ReceivesAnswerDirectTradeOfferEvent(string buyingPlayerName, ResourceClutch wantedResources)
        {
            var gameEvent        = new AnswerDirectTradeOfferEvent(this.GetPlayerId(buyingPlayerName), wantedResources);
            var eventInstruction = new EventInstruction(gameEvent);

            this.currentPlayerAgent.AddInstruction(eventInstruction);
            return(this);
        }
Esempio n. 3
0
        public ScenarioRunner ReceivesPlaceInfrastructureSetupEvent()
        {
            var gameEvent        = new PlaceSetupInfrastructureEvent();
            var eventInstruction = new EventInstruction(gameEvent);

            this.currentPlayerAgent.AddInstruction(eventInstruction);
            return(this);
        }
Esempio n. 4
0
        public ScenarioRunner ReceivesInitialBoardSetupEvent(GameBoardSetup gameBoardSetup)
        {
            var gameEvent        = new InitialBoardSetupEvent(gameBoardSetup);
            var eventInstruction = new EventInstruction(gameEvent);

            this.currentPlayerAgent.AddInstruction(eventInstruction);
            return(this);
        }
Esempio n. 5
0
        public ScenarioRunner ReceivesGameErrorEvent(ErrorCodes errorCode, string errorMessage)
        {
            var gameEvent        = new GameErrorEvent(this.GetPlayerId(this.currentPlayerAgent.Name), (int)errorCode, errorMessage);
            var eventInstruction = new EventInstruction(gameEvent);

            this.currentPlayerAgent.AddInstruction(eventInstruction);
            return(this);
        }
Esempio n. 6
0
        public ScenarioRunner ReceivesGameJoinedEvent()
        {
            var gameEvent        = new GameJoinedEvent(this.GetPlayerId(this.currentPlayerAgent.Name));
            var eventInstruction = new EventInstruction(gameEvent);

            this.currentPlayerAgent.AddInstruction(eventInstruction);
            return(this);
        }
Esempio n. 7
0
        public ScenarioRunner ReceivesConfirmGameStartEvent()
        {
            var gameEvent        = new ConfirmGameStartEvent();
            var eventInstruction = new EventInstruction(gameEvent);

            this.currentPlayerAgent.AddInstruction(eventInstruction);
            return(this);
        }
Esempio n. 8
0
        public ScenarioRunner ReceivesPlayerOrderEvent(string[] playerNames)
        {
            var playerIds        = this.playerAgents.Select(playerAgent => playerAgent.Id).ToArray();
            var gameEvent        = new PlayerOrderEvent(playerIds);
            var eventInstruction = new EventInstruction(gameEvent);

            this.currentPlayerAgent.AddInstruction(eventInstruction);
            return(this);
        }
Esempio n. 9
0
        public ScenarioRunner ReceivesPlayerSetupEvent()
        {
            var playerIdsByName  = this.playerAgents.ToDictionary(playerAgent => playerAgent.Name, playerAgent => playerAgent.Id);
            var playerNames      = this.playerAgents.Select(playerAgent => playerAgent.Name).ToArray();
            var gameEvent        = new PlayerSetupEvent(playerNames, playerIdsByName);
            var eventInstruction = new EventInstruction(gameEvent);

            this.currentPlayerAgent.AddInstruction(eventInstruction);
            return(this);
        }
Esempio n. 10
0
        public ScenarioRunner ReceivesResourceCollectedEvent(Dictionary <string, ResourceCollection[]> resourcesCollectedByPlayerName)
        {
            var resourcesCollectedByPlayerId = new Dictionary <Guid, ResourceCollection[]>();

            foreach (var kv in resourcesCollectedByPlayerName)
            {
                resourcesCollectedByPlayerId.Add(this.GetPlayerId(kv.Key), kv.Value);
            }
            var gameEvent        = new ResourcesCollectedEvent(resourcesCollectedByPlayerId);
            var eventInstruction = new EventInstruction(gameEvent);

            this.currentPlayerAgent.AddInstruction(eventInstruction);
            return(this);
        }
Esempio n. 11
0
        public ScenarioRunner ReceivesMonopolyCardPlayedEvent(Dictionary <string, ResourceClutch> resourcesByPlayerName, string playerName = null)
        {
            var playerId = playerName != null ? this.playerAgentsByName[playerName].Id : this.currentPlayerAgent.Id;
            var resourceTransactionList = new ResourceTransactionList();

            if (resourcesByPlayerName != null && resourcesByPlayerName.Count > 0)
            {
                foreach (var kv in resourcesByPlayerName)
                {
                    resourceTransactionList.Add(new ResourceTransaction(playerId, this.playerAgentsByName[kv.Key].Id, kv.Value));
                }
            }
            var gameEvent        = new PlayMonopolyCardEvent(playerId, resourceTransactionList);
            var eventInstruction = new EventInstruction(gameEvent);

            this.currentPlayerAgent.AddInstruction(eventInstruction);
            return(this);
        }