コード例 #1
0
ファイル: DevelopmentCard.cs プロジェクト: toyners/SoC
 public DevelopmentCard(DevelopmentCardTypes type, string title, string text)
 {
     this.Id    = Guid.NewGuid();
     this.Type  = type;
     this.Title = title;
     this.Text  = text;
 }
コード例 #2
0
ファイル: PlayerStateInstruction.cs プロジェクト: toyners/SoC
 public PlayerStateInstruction HeldCardsByType(DevelopmentCardTypes developmentCardType, int count)
 {
     if (this.developmentCardsByCount == null)
     {
         this.developmentCardsByCount = new Dictionary <DevelopmentCardTypes, int>();
     }
     this.developmentCardsByCount.Add(developmentCardType, count);
     return(this);
 }
コード例 #3
0
        internal void SetHeldCard(int cardCount, DevelopmentCardTypes developmentCardType)
        {
            while (cardCount-- > 0)
            {
                switch (developmentCardType)
                {
                case DevelopmentCardTypes.Knight: this.HeldCards.Add(new KnightDevelopmentCard()); break;

                case DevelopmentCardTypes.Monopoly: this.HeldCards.Add(new MonopolyDevelopmentCard()); break;

                case DevelopmentCardTypes.RoadBuilding: this.HeldCards.Add(new RoadBuildingDevelopmentCard()); break;

                case DevelopmentCardTypes.YearOfPlenty: this.HeldCards.Add(new YearOfPlentyDevelopmentCard()); break;

                default: throw new ArgumentException($"{developmentCardType} type not recognised", "developmentCardType");
                }
            }
        }
コード例 #4
0
        public void AddDevelopmentCard(DevelopmentCardTypes developmentCardType)
        {
            DevelopmentCard developmentCard = null;

            switch (developmentCardType)
            {
            case DevelopmentCardTypes.Knight: developmentCard = new KnightDevelopmentCard(); break;

            case DevelopmentCardTypes.Monopoly: developmentCard = new MonopolyDevelopmentCard(); break;

            case DevelopmentCardTypes.RoadBuilding: developmentCard = new RoadBuildingDevelopmentCard(); break;

            case DevelopmentCardTypes.YearOfPlenty: developmentCard = new YearOfPlentyDevelopmentCard(); break;

            default: throw new NotImplementedException($"Development card type {developmentCardType} not recognised");
            }

            this.developmentCards.Enqueue(developmentCard);
        }
コード例 #5
0
 public ScenarioBuyDevelopmentCardEvent(ScenarioComputerPlayer player, DevelopmentCardTypes developmentCardType) : base(player.Id)
 {
     this.developmentCardType = developmentCardType;
     this.player = player;
 }
コード例 #6
0
        private void AssertNextDevelopmentCardIsCorrect(DevelopmentCardHolder developmentCardHolder, DevelopmentCardTypes expectedType)
        {
            DevelopmentCard developmentCard;

            developmentCardHolder.TryGetNextCard(out developmentCard).ShouldBeTrue();
            developmentCard.Type.ShouldBe(expectedType);
        }
コード例 #7
0
 public ScenarioRunner ReceivesDevelopmentCardBoughtEvent(DevelopmentCardTypes developmentCardType)
 {
     this.developmentCardHolder.AddDevelopmentCard(developmentCardType);
     this.AddEventInstruction(new DevelopmentCardBoughtEvent(this.currentPlayerAgent.Id, developmentCardType));
     return(this);
 }
コード例 #8
0
 public DevelopmentCardBoughtEvent(Guid playerId, DevelopmentCardTypes cardType) : base(playerId)
     => this.CardType = cardType;