public void BuildAndRavage_BecomesTwoBuilds() { List <string> invaderLog = new List <string>(); // Given: Going to Ravage / Build in Jungle var(user, ctx) = TestSpirit.SetupGame(PowerCard.For <CallToTrade>(), (gs) => { var jungleCard = new InvaderCard(Terrain.Jungle); gs.InvaderDeck = InvaderDeck.BuildTestDeck(jungleCard, jungleCard, jungleCard, jungleCard); gs.NewLogEntry += (s) => invaderLog.Add(s.Msg()); }); // Given: advance to 2nd round where we have a ravage user.DoesNothingForARound(); invaderLog.Clear(); // Given: a space that IS-RAVAGE AND BUILD var spaceCtx = ctx.AllSpaces .Select(ctx.Target) .Last(s => s.MatchesRavageCard && s.MatchesBuildCard); // last stays away from city and ocean invaderLog.Add("Selected target:" + spaceCtx.Space.Label); // And: it has 3 explorers (in case dahan attacks during ravage, would still 1 left over Given_HasOnly3Explorers(spaceCtx); Given_Has2Dahan(spaceCtx); Given_NoSuroundingTowns(spaceCtx); Given_NoSuroundingDahan(spaceCtx); When_GrowsBuysAndActivatesCard(user, spaceCtx); spaceCtx.Tokens.InvaderSummary().ShouldBe("1C@3,1T@2,4E@1"); }
public void SingleBuild(bool playsCard, string result) { var(user, ctx) = TestSpirit.SetupGame(PowerCard.For <RitesOfTheLandsRejection>()); // Given: find a space with 1 explorer var spaceCtx = ctx.AllSpaces .Select(ctx.Target) .First(sc => sc.Tokens.InvaderSummary() == "1E@1"); // And: add Dahan (because card requires it) spaceCtx.Dahan.Init(1); // When: growing user.Grows(); // And: purchase test card user.PlaysCard(RitesOfTheLandsRejection.Name); if (playsCard) { user.SelectsFastAction(RitesOfTheLandsRejection.Name); user.TargetsLand_IgnoreOptions(spaceCtx.Space.Label); user.AssertDecisionX("Select Power Option", "{Stop build - 1 fear / (Dahan or T/C)},Push up to 3 dahan", "{}"); } else { // And: done with fast (no more cards..) user.IsDoneWith(Phase.Fast); } // Then: space should have a building System.Threading.Thread.Sleep(10); spaceCtx.Tokens.InvaderSummary().ShouldBe(result); }
public void OneRavage_ReplacedWithBuild() { var(user, ctx) = TestSpirit.SetupGame(PowerCard.For <CallToTrade>()); // Given: advance to 2nd round where we have a ravage user.DoesNothingForARound(); // Given: a space that IS-RAVAGE but NOT-BUILD var spaceCtx = ctx.AllSpaces .Select(ctx.Target) .Last(s => s.MatchesRavageCard && !s.MatchesBuildCard); // last stays away from city and ocean // And: it has 3 explorers (in case dahan attacks during ravage, would still 1 left over Given_HasOnly3Explorers(spaceCtx); Given_Has2Dahan(spaceCtx); Given_NoSuroundingTowns(spaceCtx); Given_NoSuroundingDahan(spaceCtx); string info = $"{spaceCtx.Space.Label} {ctx.GameState.InvaderDeck.Build.Single()} "; When_GrowsBuysAndActivatesCard(user, spaceCtx); // Then: Card converted ravage to a build spaceCtx.Tokens.InvaderSummary().ShouldBe("1T@2,3E@1"); }
public void TerrorLevel3_RavageRemainsRavage() { var(user, ctx) = TestSpirit.SetupGame(PowerCard.For <CallToTrade>()); // Elevate to Terror Level 3 Given_TerrorLevelIs3(ctx); // Given: advance to 2nd round where we have a ravage user.DoesNothingForARound(); // Given: a space that IS-RAVAGE but NOT-BUILD var spaceCtx = ctx.AllSpaces .Select(ctx.Target) .Last(s => s.MatchesRavageCard && !s.MatchesBuildCard); // last stays away from city and ocean // And: it has 3 explorers (in case dahan attacks during ravage, would still 1 left over Given_HasOnly3Explorers(spaceCtx); Given_Has2Dahan(spaceCtx); Given_NoSuroundingTowns(spaceCtx); Given_NoSuroundingDahan(spaceCtx); When_GrowsBuysAndActivatesCard(user, spaceCtx); // Then: Ravage remains - 3 explorers kill 1 dahan, remaining dahan kills 2 explorers spaceCtx.Tokens.InvaderSummary().ShouldBe("1E@1"); }
protected TestInvaderDeckSequence_Base() { var powerCard = PowerCard.For <CallToTend>(); var(userLocal, ctxLocal) = TestSpirit.SetupGame(powerCard, gs => { gs.NewLogEntry += RecordLogItem; // (s) => log.Enqueue(s.Msg); }); user = userLocal; ctx = ctxLocal; log.Clear(); // skip over initial Explorer setup }
public void StopsAllInvaderActions() { List <string> invaderLog = new List <string>(); var(user, ctx) = TestSpirit.SetupGame(PowerCard.For <IndomitableClaim>(), (gs) => { var jungleCard = new InvaderCard(Terrain.Jungle); gs.InvaderDeck = InvaderDeck.BuildTestDeck(jungleCard, jungleCard, jungleCard, jungleCard); gs.NewLogEntry += (s) => invaderLog.Add(s.Msg()); }); // Given: there a ravage card user.Grows(); user.IsDoneBuyingCards(); invaderLog.Clear(); // and: there is a space that IS-RAVAGE AND BUILD (aka: Jungle - see above) var spaceCtx = ctx.AllSpaces .Select(ctx.Target) .Last(s => s.MatchesRavageCard && s.MatchesBuildCard); // last stays away from city and ocean invaderLog.Add("Selected target:" + spaceCtx.Space.Label); // And: we have a presence in that land ctx.Self.Presence.PlaceOn(spaceCtx.Space, spaceCtx.GameState); // And: it has 3 explorers spaceCtx.Tokens.InitDefault(Invader.Explorer, 3); spaceCtx.Tokens.InitDefault(Invader.Town, 0); spaceCtx.Tokens.InitDefault(Invader.City, 0); // if we had to advance cards, might have buit a city spaceCtx.Tokens.InvaderSummary().ShouldBe("3E@1", "Unable to init to 3 exploreres."); // And 2 dahan spaceCtx.Dahan.Init(2); // When: grows and purchases card user.Grows(); user.PlaysCard(IndomitableClaim.Name); // And: has enough elements to trigger the bonus ctx.Self.Elements[Element.Sun] = 2; ctx.Self.Elements[Element.Earth] = 3; // When: Activates Card user.SelectsFastAction(IndomitableClaim.Name); user.TargetsLand_IgnoreOptions(spaceCtx.Space.Label); user.PullsPresenceFromTrack(ctx.Self.Presence.Energy.RevealOptions.Single()); // Then: nothing changed spaceCtx.Tokens.InvaderSummary().ShouldBe("3E@1", "should be same that we started with"); // Make sure that we actually executed the Ravage Build / Explore Bit invaderLog.Count(s => s.Contains("Exploring")).ShouldBeGreaterThan(0); }
public TradeSuffers_Tests() { // On Board-A, // use A7 (Sands-2 Dahan) // or A4 (Sands-no dahan) var(user, ctx) = TestSpirit.SetupGame(PowerCard.For <RiversBounty>(), gs => { var fear = gs.Fear; gs.InvaderDeck = AvoidTheDahan_Tests.MountainThenAllSands(); gs.NewLogEntry += (s) => log.Add(s.Msg()); }); this.user = user; this.ctx = ctx; }
public AvoidTheDahan_Tests() { // On Board-A, // use A7 (Sands-2 Dahan) // or A4 (Sands-no dahan) var(user, ctx) = TestSpirit.SetupGame(PowerCard.For <RiversBounty>(), gs => { var fear = gs.Fear; gs.InvaderDeck = MountainThenAllSands(); gs.NewLogEntry += (s) => log.Add(s.Msg()); }); this.user = user; this.ctx = ctx; // Disable destroying presence ctx.GameState.ModifyBlightAddedEffect.ForGame.Add(x => { x.Cascade = false; x.DestroyPresence = false; }); }
public void NoRavage_NoBuild() { var(user, ctx) = TestSpirit.SetupGame(PowerCard.For <CallToTrade>()); // Given: a space that is not part of the build nor ravage var spaceCtx = ctx.AllSpaces .Select(ctx.Target) .Last(s => !s.MatchesBuildCard && !s.MatchesRavageCard); // last stays away from city and ocean Given_HasOnly3Explorers(spaceCtx); Given_Has2Dahan(spaceCtx); Given_NoSuroundingTowns(spaceCtx); Given_NoSuroundingDahan(spaceCtx); When_GrowsBuysAndActivatesCard(user, spaceCtx); // Then: Card did not create a ravage there (nor a build) spaceCtx.Tokens.InvaderSummary().ShouldBe("3E@1"); }
public Quarantine_Tests() { var powerCard = PowerCard.For <CallToTend>(); var(userLocal, ctxLocal) = TestSpirit.SetupGame(powerCard, gs => { gs.NewLogEntry += (s) => { if (s is InvaderActionEntry) { log.Enqueue(s.Msg()); } }; gs.InvaderDeck = InvaderDeck.BuildTestDeck( new InvaderCard(Terrain.Sand), // not on coast InvaderCard.Stage2Costal(), new InvaderCard(Terrain.Jungle) ); }); user = userLocal; ctx = ctxLocal; log.Clear(); // skip over initial Explorer setup }