예제 #1
0
        public void MappingIntoABustBusts()
        {
            Game gameFixture = new Game();
            Card FiveOfMaps  = new Card {
                Suit = Suites.Maps, Value = 5
            };
            Card SevenOfMaps = new Card()
            {
                Suit = Suites.Maps, Value = 7
            };

            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfMaps);
            GameHelpers.ClearDiscardPile(ref gameFixture);
            GameHelpers.BringCardFromDeckToDiscardPile(ref gameFixture, SevenOfMaps);
            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.ChooseMapTarget
            });

            gameFixture.GetMapCards();
            gameFixture.TakeAction(Actions.ChooseMapTarget, SevenOfMaps);

            gameFixture.CurrentAvailableActions.Should().BeEquivalentTo(
                new List <Actions>()
            {
                Actions.Draw
            },
                options => options.WithoutStrictOrdering());
            gameFixture.Field.Count.Should().Be(0);
            gameFixture.CurrentPlayersTurn.Should().Be(Players.PlayerTwo);
            gameFixture.ScoreZones[0].PointsShowing().Should().Be(0);
            gameFixture.DiscardPile.Count.Should().Be(2);
        }
예제 #2
0
        public void DrawingAKrakenBustsWithoutAdditionalDraws()
        {
            Game gameFixture = new Game();

            GameHelpers.BringCardToPositionInDeck(ref gameFixture, new Card {
                Suit = Suites.Krakens, Value = 7
            }, 0);
            GameHelpers.BringCardToPositionInDeck(ref gameFixture, new Card {
                Suit = Suites.Keys, Value = 5
            }, 1);
            GameHelpers.BringCardFromDeckToField(ref gameFixture, new Card {
                Suit = Suites.Krakens, Value = 5
            });
            GameHelpers.ClearDiscardPile(ref gameFixture);

            gameFixture.TakeAction(Actions.Draw);

            gameFixture.Field.Count.Should().Be(0);
            gameFixture.DiscardPile.Count.Should().Be(2);
            List <Card> deckCards = typeof(Deck).GetField("Cards",
                                                          BindingFlags.NonPublic | BindingFlags.Instance)
                                    .GetValue(gameFixture.Deck) as List <Card>;

            deckCards[0].Should().BeEquivalentTo(new Card {
                Suit = Suites.Keys, Value = 5
            });
            gameFixture.CurrentPlayersTurn.Should().Be(Players.PlayerTwo);
        }
예제 #3
0
        public void AskingForMapCardsReturnsThree()
        {
            Game gameFixture = new Game();
            Card FiveOfMaps  = new Card {
                Suit = Suites.Maps, Value = 5
            };
            Card FiveOfKeys = new Card {
                Suit = Suites.Keys, Value = 5
            };
            Card FiveOfCannons = new Card {
                Suit = Suites.Cannons, Value = 5
            };
            Card FiveOfChests = new Card {
                Suit = Suites.Chests, Value = 5
            };

            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfMaps);
            GameHelpers.ClearDiscardPile(ref gameFixture);
            GameHelpers.BringCardFromDeckToDiscardPile(ref gameFixture, FiveOfKeys);
            GameHelpers.BringCardFromDeckToDiscardPile(ref gameFixture, FiveOfChests);
            GameHelpers.BringCardFromDeckToDiscardPile(ref gameFixture, FiveOfCannons);
            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.ChooseMapTarget
            });

            var actual = gameFixture.GetMapCards();

            actual.Should().BeEquivalentTo(new List <Card> {
                FiveOfKeys, FiveOfChests, FiveOfCannons
            },
                                           options => options.WithoutStrictOrdering());
        }
예제 #4
0
        public void DrawingAMapFirstButTheDiscardIsEmptyDoesntEndTheKraken()
        {
            Game gameFixture = new Game();

            GameHelpers.BringCardToPositionInDeck(ref gameFixture, new Card {
                Suit = Suites.Krakens, Value = 5
            }, 0);
            GameHelpers.BringCardToPositionInDeck(ref gameFixture, new Card {
                Suit = Suites.Maps, Value = 5
            }, 1);
            GameHelpers.BringCardToPositionInDeck(ref gameFixture, new Card {
                Suit = Suites.Oracles, Value = 5
            }, 2);
            GameHelpers.ClearDiscardPile(ref gameFixture);

            gameFixture.TakeAction(Actions.Draw);

            gameFixture.CurrentAvailableActions.Should().BeEquivalentTo(
                new List <Actions> {
                Actions.Draw, Actions.TakeAll
            },
                options => options.WithoutStrictOrdering());
            gameFixture.Field.Count.Should().Be(3);
            gameFixture.Field[2].Should().Match(a => (a as Card).Suit == Suites.Oracles && (a as Card).Value == 5);
        }
예제 #5
0
        public void BustingWithAnAnchorOutProtectsEarlierCards()
        {
            Game gameFixture = new Game();
            Card FiveOfKeys  = new Card()
            {
                Suit = Suites.Keys, Value = 5
            };
            Card FiveOfAnchors = new Card()
            {
                Suit = Suites.Anchors, Value = 5
            };
            Card SevenOfKeys = new Card()
            {
                Suit = Suites.Keys, Value = 7
            };

            GameHelpers.ClearDiscardPile(ref gameFixture);
            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfKeys);
            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfAnchors);
            GameHelpers.BringCardToPositionInDeck(ref gameFixture, SevenOfKeys, 0);
            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.Draw
            });

            gameFixture.TakeAction(Actions.Draw);

            gameFixture.ScoreZones[0].PointsShowing().Should().Be(5);
            gameFixture.ScoreZones[0].HighestOfSuit(Suites.Anchors).Should().BeNull();
            gameFixture.ScoreZones[0].HighestOfSuit(Suites.Keys).Should().NotBeNull();
            gameFixture.ScoreZones[0].HighestOfSuit(Suites.Keys).Value.Should().Be(5);
            gameFixture.DiscardPile.Count.Should().Be(2);
        }
예제 #6
0
        public void TakingBothAChestAndAKeyWhenTheDiscardIsLowYeildsAsMuchAsPossible()
        {
            Game gameFixture = new Game();
            Card FiveOfKeys  = new Card {
                Suit = Suites.Keys, Value = 5
            };
            Card FiveOfChests = new Card {
                Suit = Suites.Chests, Value = 5
            };

            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfKeys);
            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfChests);
            GameHelpers.ClearDiscardPile(ref gameFixture);
            GameHelpers.BringCardFromDeckToDiscardPile(ref gameFixture, new Card {
                Suit = Suites.Oracles, Value = 5
            });
            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.TakeAll
            });

            gameFixture.TakeAction(Actions.TakeAll);

            gameFixture.ScoreZones[0].PointsShowing().Should().Be(15);
            gameFixture.DiscardPile.Count.Should().Be(0);
        }
예제 #7
0
        public void DrawingAMapWhenTheDiscardPileHasNoCardsDoesNothing()
        {
            Game gameFixture = new Game();
            Card FiveOfMaps  = new Card {
                Suit = Suites.Maps, Value = 5
            };

            GameHelpers.BringCardToPositionInDeck(ref gameFixture, FiveOfMaps, 0);
            GameHelpers.ClearDiscardPile(ref gameFixture);

            gameFixture.TakeAction(Actions.Draw);

            gameFixture.CurrentAvailableActions.Should().BeEquivalentTo(
                new List <Actions>()
            {
                Actions.Draw, Actions.TakeAll
            },
                options => options.WithoutStrictOrdering());
        }
예제 #8
0
        public void DrawingAMapWhenTheDiscardPileHasOneCardStillWorks()
        {
            Game gameFixture = new Game();
            Card FiveOfMaps  = new Card {
                Suit = Suites.Maps, Value = 5
            };
            Card FiveOfKeys = new Card {
                Suit = Suites.Keys, Value = 5
            };

            GameHelpers.BringCardToPositionInDeck(ref gameFixture, FiveOfMaps, 0);
            GameHelpers.ClearDiscardPile(ref gameFixture);
            GameHelpers.BringCardFromDeckToDiscardPile(ref gameFixture, FiveOfKeys);

            gameFixture.TakeAction(Actions.Draw);

            gameFixture.CurrentAvailableActions.Should().BeEquivalentTo(
                new List <Actions>()
            {
                Actions.ChooseMapTarget
            });
        }
예제 #9
0
        public void ChoosingATargetBringsThatCardIntoTheField()
        {
            Game gameFixture = new Game();
            Card FiveOfMaps  = new Card {
                Suit = Suites.Maps, Value = 5
            };
            Card FiveOfKeys = new Card {
                Suit = Suites.Keys, Value = 5
            };

            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfMaps);
            GameHelpers.ClearDiscardPile(ref gameFixture);
            GameHelpers.BringCardFromDeckToDiscardPile(ref gameFixture, FiveOfKeys);
            GameHelpers.BringCardFromDeckToDiscardPile(ref gameFixture, new Card()
            {
                Suit = Suites.Chests, Value = 5
            });
            GameHelpers.BringCardFromDeckToDiscardPile(ref gameFixture, new Card()
            {
                Suit = Suites.Cannons, Value = 5
            });
            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.ChooseMapTarget
            });

            gameFixture.GetMapCards();
            gameFixture.TakeAction(Actions.ChooseMapTarget, FiveOfKeys);

            gameFixture.Field.Count.Should().Be(2);
            gameFixture.Field[1].Should().BeEquivalentTo(FiveOfKeys);
            gameFixture.DiscardPile.Count.Should().Be(2);
            gameFixture.CurrentAvailableActions.Should().BeEquivalentTo(
                new List <Actions>()
            {
                Actions.Draw, Actions.TakeAll
            },
                options => options.WithoutStrictOrdering());
        }
예제 #10
0
        public void BustingWithBothAChestAndAKeyBehindAnAnchorStillGetsABonus()
        {
            Game gameFixture = new Game();
            Card FiveOfKeys  = new Card {
                Suit = Suites.Keys, Value = 5
            };
            Card FiveOfChests = new Card {
                Suit = Suites.Chests, Value = 5
            };

            GameHelpers.ClearDiscardPile(ref gameFixture);
            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfKeys);
            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfChests);
            GameHelpers.BringCardFromDeckToField(ref gameFixture, new Card {
                Suit = Suites.Anchors, Value = 5
            });
            GameHelpers.BringCardFromDeckToField(ref gameFixture, new Card {
                Suit = Suites.Mermaids, Value = 5
            });
            GameHelpers.BringCardToPositionInDeck(ref gameFixture, new Card {
                Suit = Suites.Mermaids, Value = 9
            }, 0);
            GameHelpers.BringCardFromDeckToDiscardPile(ref gameFixture, new Card {
                Suit = Suites.Oracles, Value = 5
            });
            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.Draw
            });

            gameFixture.TakeAction(Actions.Draw);

            gameFixture.ScoreZones[0].PointsShowing().Should().Be(15);
            gameFixture.ScoreZones[0].HighestOfSuit(Suites.Keys).Value.Should().Be(5);
            gameFixture.ScoreZones[0].HighestOfSuit(Suites.Chests).Value.Should().Be(5);
            gameFixture.ScoreZones[0].HighestOfSuit(Suites.Oracles).Value.Should().Be(5);
            gameFixture.DiscardPile.Count.Should().Be(3);
        }
예제 #11
0
        public void DrawingACannonFirstPausesTheKrakenButResumesAfterAShotWasTaken()
        {
            Game gameFixture = new Game();

            GameHelpers.BringCardToPositionInDeck(ref gameFixture, new Card {
                Suit = Suites.Krakens, Value = 5
            }, 0);
            GameHelpers.BringCardToPositionInDeck(ref gameFixture, new Card {
                Suit = Suites.Cannons, Value = 5
            }, 1);
            GameHelpers.BringCardToPositionInDeck(ref gameFixture, new Card {
                Suit = Suites.Oracles, Value = 5
            }, 2);
            GameHelpers.BringCardFromDeckToScoreZone(ref gameFixture, new Card {
                Suit = Suites.Keys, Value = 5
            }, 1);
            GameHelpers.ClearDiscardPile(ref gameFixture);

            gameFixture.TakeAction(Actions.Draw);

            gameFixture.CurrentAvailableActions.Should().BeEquivalentTo(new List <Actions> {
                Actions.CannonThenBackToKraken
            });
            gameFixture.Field.Count.Should().Be(2);

            gameFixture.TakeAction(Actions.CannonThenBackToKraken, new Card {
                Suit = Suites.Keys, Value = 5
            });
            gameFixture.DiscardPile.Count.Should().Be(1);
            gameFixture.CurrentAvailableActions.Should().BeEquivalentTo(
                new List <Actions> {
                Actions.Draw, Actions.TakeAll
            },
                options => options.WithoutStrictOrdering());
            gameFixture.Field.Count.Should().Be(3);
            gameFixture.Field[2].Should().Match(a => (a as Card).Suit == Suites.Oracles && (a as Card).Value == 5);
        }
예제 #12
0
        public void SecondDrawCanTriggerBust()
        {
            Game gameFixture = new Game();

            GameHelpers.BringCardToPositionInDeck(ref gameFixture, new Card {
                Suit = Suites.Krakens, Value = 5
            }, 0);
            GameHelpers.BringCardToPositionInDeck(ref gameFixture, new Card {
                Suit = Suites.Keys, Value = 5
            }, 1);
            GameHelpers.BringCardToPositionInDeck(ref gameFixture, new Card {
                Suit = Suites.Oracles, Value = 7
            }, 2);
            GameHelpers.BringCardFromDeckToField(ref gameFixture, new Card {
                Suit = Suites.Oracles, Value = 5
            });
            GameHelpers.ClearDiscardPile(ref gameFixture);

            gameFixture.TakeAction(Actions.Draw);

            gameFixture.Field.Count.Should().Be(0);
            gameFixture.DiscardPile.Count.Should().Be(4);
            gameFixture.CurrentPlayersTurn.Should().Be(Players.PlayerTwo);
        }