public void TestQuestParticipation() { QuestMatch game = ScenarioCreator.GameNoDeal(2); game.AttachLogger(new Quest.Core.Logger("TestQuestParticipation")); Player aiPlayer = game.Players[0]; Player otherPlayer = game.Players[1]; aiPlayer.Behaviour = new Strategy3(); RescueTheFairMaiden quest = new RescueTheFairMaiden(game); // 3 stages. game.CurrentStory = quest; //some cards Lance lance = new Lance(game); Dagger dagger = new Dagger(game); Sword sword = new Sword(game); Thieves thieves = new Thieves(game); SirGalahad sirGalahad = new SirGalahad(game); aiPlayer.Hand.Add(lance); otherPlayer.Hand.Add(dagger); otherPlayer.Hand.Add(sword); //other player has 2 cards, ai has 1, don't participate Assert.IsFalse(aiPlayer.Behaviour.ParticipateInQuest(quest, aiPlayer.Hand)); aiPlayer.Hand.Add(thieves); //both players have 2 cards in hand, participate Assert.IsTrue(aiPlayer.Behaviour.ParticipateInQuest(quest, aiPlayer.Hand)); aiPlayer.Hand.Add(sirGalahad); //ai player has 3 cards, other has 2, participate Assert.IsTrue(aiPlayer.Behaviour.ParticipateInQuest(quest, aiPlayer.Hand)); }
public void TestQuestSponsoring() { QuestMatch game = ScenarioCreator.GameNoDeal(2); game.AttachLogger(new Quest.Core.Logger("TestQuestSponsoring")); Player aiPlayer = game.Players[0]; aiPlayer.Behaviour = new Strategy1(); Player otherPlayer = game.Players[1]; RescueTheFairMaiden quest = new RescueTheFairMaiden(game); // 3 Stages with bonus to Black Knight. game.CurrentStory = quest; // Test case where another player can win. //(conditions for whether or not to sponsor quest is same as strategy 2) otherPlayer.Rank.AddShields(21); Assert.IsFalse(aiPlayer.Behaviour.SponsorQuest(quest, aiPlayer.Hand)); otherPlayer.Rank.RemoveShields(10); //quest cards Dragon dragon = new Dragon(game); //50 BlackKnight blackKnight = new BlackKnight(game); //35 (25+10) Mordred mordred = new Mordred(game); //30 Thieves thieves = new Thieves(game); //5 Boar boar = new Boar(game); //5 Lance lance = new Lance(game); //20 Sword sword = new Sword(game); //10 Dagger dagger = new Dagger(game); //5 aiPlayer.Hand.Add(new TestOfValor(game)); aiPlayer.Hand.Add(boar); aiPlayer.Hand.Add(thieves); //hand: boar, thieves, testOfValor - not enough bp Assert.IsFalse(aiPlayer.Behaviour.SponsorQuest(quest, aiPlayer.Hand)); aiPlayer.Hand.Add(blackKnight); aiPlayer.Hand.Add(lance); //hand: boar, thieves, test, blackknight, lance - enough bp Assert.IsTrue(aiPlayer.Behaviour.SponsorQuest(quest, aiPlayer.Hand)); aiPlayer.Hand.Remove(boar); aiPlayer.Hand.Remove(thieves); aiPlayer.Hand.Remove(lance); aiPlayer.Hand.Add(dragon); //hand: black knight, test, lance, dragon - enough bp //(last stage dragon, 2nd stage test, first black knight (no lance)) Assert.IsTrue(aiPlayer.Behaviour.SponsorQuest(quest, aiPlayer.Hand)); }
public void TestQuestSponsoring() { QuestMatch game = ScenarioCreator.GameNoDeal(2); game.AttachLogger(new Quest.Core.Logger("TestQuestSponsoring")); Player aiPlayer = game.Players[0]; aiPlayer.Behaviour = new Strategy2(); Player winningPlayer = game.Players[1]; RescueTheFairMaiden quest = new RescueTheFairMaiden(game); // 3 Stages with bonus to Black Knight. game.CurrentStory = quest; // Test case where another player can win. winningPlayer.Rank.AddShields(21); Assert.IsFalse(aiPlayer.Behaviour.SponsorQuest(quest, aiPlayer.Hand)); winningPlayer.Rank.RemoveShields(10); // Test cards. Boar boar = new Boar(game); // 5 BP Thieves thieves = new Thieves(game); // 5 BP BlackKnight blackKnight = new BlackKnight(game); // Should be worth 35 BP, not 25. GreenKnight greenKnight = new GreenKnight(game); Mordred mordred = new Mordred(game); // 30 BP. Lance lance = new Lance(game); // +20 BP. // Ensure having a test card is taken into consideration for the next tests. aiPlayer.Hand.Add(new TestOfValor(game)); // First case, not enough battle points in second stage, expect false. aiPlayer.Hand.Add(boar); aiPlayer.Hand.Add(thieves); Assert.IsFalse(aiPlayer.Behaviour.SponsorQuest(quest, aiPlayer.Hand)); // Add weapon, expect true. aiPlayer.Hand.Add(lance); Assert.IsTrue(aiPlayer.Behaviour.SponsorQuest(quest, aiPlayer.Hand)); aiPlayer.Hand.Remove(lance); aiPlayer.Hand.Remove(boar); aiPlayer.Hand.Remove(thieves); // Green knight and black knight test, black night quest bonuse should be considered, expect true. aiPlayer.Hand.Add(blackKnight); aiPlayer.Hand.Add(greenKnight); Assert.IsTrue(aiPlayer.Behaviour.SponsorQuest(quest, aiPlayer.Hand)); }
public void TestQuestParticipation() { QuestMatch game = ScenarioCreator.GameNoDeal(1); game.AttachLogger(new Quest.Core.Logger("TestQuestParticipation")); Player aiPlayer = game.Players[0]; aiPlayer.Behaviour = new Strategy1(); RescueTheFairMaiden quest = new RescueTheFairMaiden(game); // 3 stages. game.CurrentStory = quest; //cards Lance lance = new Lance(game); //20 Dagger dagger = new Dagger(game); //5 Sword sword = new Sword(game); //10 SirGalahad sirGalahad = new SirGalahad(game); //15 SirLancelot sirLancelot = new SirLancelot(game); //15 KingPellinore kingPellinore = new KingPellinore(game); //10 Mordred mordred = new Mordred(game); //30 Thieves thieves = new Thieves(game); //5 Boar boar = new Boar(game); //5 aiPlayer.Hand.Add(lance); aiPlayer.Hand.Add(dagger); aiPlayer.Hand.Add(sword); aiPlayer.Hand.Add(sirGalahad); aiPlayer.Hand.Add(boar); aiPlayer.Hand.Add(thieves); //hand: lance, dagger, sword, galahad, boar, thieves - not enough weapon/allies Assert.IsFalse(aiPlayer.Behaviour.ParticipateInQuest(quest, aiPlayer.Hand)); aiPlayer.Hand.Add(sirLancelot); aiPlayer.Hand.Add(kingPellinore); //hand: lance, dagger, sword, galahad, lancelot, pelinore, boar, thieves Assert.IsTrue(aiPlayer.Behaviour.ParticipateInQuest(quest, aiPlayer.Hand)); aiPlayer.Hand.Remove(thieves); //not enough foes (to discard) Assert.IsFalse(aiPlayer.Behaviour.ParticipateInQuest(quest, aiPlayer.Hand)); //2 foes, but mordred has too much bp aiPlayer.Hand.Add(mordred); Assert.IsFalse(aiPlayer.Behaviour.ParticipateInQuest(quest, aiPlayer.Hand)); }
public void TestQuestParticipation() { QuestMatch game = ScenarioCreator.GameNoDeal(1); game.AttachLogger(new Quest.Core.Logger("TestQuestParticipation")); Player aiPlayer = game.Players[0]; aiPlayer.Behaviour = new Strategy2(); RescueTheFairMaiden quest = new RescueTheFairMaiden(game); // 3 stages. game.CurrentStory = quest; // Make player knight, 10 BP. aiPlayer.Rank.AddShields(5); // Test cards. KingArthur arthur = new KingArthur(game); // 10 BP. SirLancelot lancelot = new SirLancelot(game); // 15 BP. SirGalahad galahad = new SirGalahad(game); // 15 BP. Boar boar = new Boar(game); // 5 BP, should be discarded. Thieves thieves = new Thieves(game); // 5 BP, should be discarded. BlackKnight blackKnight = new BlackKnight(game); // 25 BP, should not be discarded. Excalibur excalibur = new Excalibur(game); // +30 BP. Lance lance = new Lance(game); // + 20 BP. // Cannot increase for all 3 stages, expect false. aiPlayer.Hand.Add(boar); aiPlayer.Hand.Add(thieves); aiPlayer.Hand.Add(blackKnight); aiPlayer.Hand.Add(arthur); aiPlayer.Hand.Add(lancelot); aiPlayer.Hand.Add(galahad); Assert.IsFalse(aiPlayer.Behaviour.ParticipateInQuest(quest, aiPlayer.Hand)); // Add weapons, expect true. aiPlayer.Hand.Add(excalibur); aiPlayer.Hand.Add(lance); Assert.IsTrue(aiPlayer.Behaviour.ParticipateInQuest(quest, aiPlayer.Hand)); // Remove discardable foe less than 25 BP, expect false. aiPlayer.Hand.Remove(boar); Assert.IsFalse(aiPlayer.Behaviour.ParticipateInQuest(quest, aiPlayer.Hand)); }
public void TestSetupQuest() { QuestMatch game = ScenarioCreator.GameNoDeal(1); game.AttachLogger(new Quest.Core.Logger("TestSetupQuest")); Player sponsorAI = game.Players[0]; sponsorAI.Behaviour = new Strategy1(); // Setup quest RescueTheFairMaiden quest = new RescueTheFairMaiden(game);//3 stages game.CurrentStory = quest; quest.Sponsor = sponsorAI; //quest cards Dragon dragon = new Dragon(game); //50 BlackKnight blackKnight = new BlackKnight(game); //35 (25+10) Thieves thieves = new Thieves(game); //5 Boar boar = new Boar(game); //5 TestOfValor testOfValor = new TestOfValor(game); sponsorAI.Hand.Add(new List <Card>() { testOfValor, boar, thieves, dragon }); List <AdventureCard>[] stages = sponsorAI.Behaviour.SetupQuest(quest, sponsorAI.Hand); Assert.AreEqual(3, stages.Length); //test last stage - should contain strongest foe (dragon) Assert.AreEqual(1, stages[2].Count); Assert.IsTrue(stages[2].Contains(dragon)); //test second last stage - should contain test of valor Assert.AreEqual(1, stages[1].Count); Assert.IsTrue(stages[1].Contains(testOfValor)); //test first stage Assert.AreEqual(1, stages[0].Count); }
public void TestPlayCardsInQuest() { QuestMatch game = ScenarioCreator.GameNoDeal(2); game.AttachLogger(new Quest.Core.Logger("TestPlayCardsInTest")); Player aiPlayer = game.Players[0]; Player sponsorPlayer = game.Players[1]; aiPlayer.Behaviour = new Strategy2(); // Setup quest RescueTheFairMaiden quest = new RescueTheFairMaiden(game); // 3 stages. game.CurrentStory = quest; quest.Sponsor = sponsorPlayer; //quest.AddParticipant(aiPlayer); FIXME Thieves questThieves = new Thieves(game); Saxons questSaxons = new Saxons(game); RobberKnight questRobberKnight = new RobberKnight(game); sponsorPlayer.Hand.Add(new List <Card>() { questThieves, questSaxons, questRobberKnight }); quest.AddFoeStage(questThieves); quest.AddFoeStage(questSaxons); quest.AddFoeStage(questRobberKnight); // Make player knight, 10 BP. aiPlayer.Rank.AddShields(5); // Test cards. Amour amour1 = new Amour(game); // 10 BP. Amour amour2 = new Amour(game); // Hopefully only one is played. SirGawain gawain = new SirGawain(game); // 10 BP. SirTristan tristan = new SirTristan(game); // 10 BP. SirGalahad galahad = new SirGalahad(game); // 15 BP. BattleAx axe = new BattleAx(game); // +5 BP aiPlayer.Hand.Add(amour1); aiPlayer.Hand.Add(amour2); aiPlayer.Hand.Add(gawain); aiPlayer.Hand.Add(tristan); aiPlayer.Hand.Add(galahad); aiPlayer.Hand.Add(axe); // Test first stage. Amour should be played first. List <BattleCard> played = aiPlayer.Behaviour.PlayCardsInQuest(quest, aiPlayer.Hand); Assert.AreEqual(1, played.Count); Assert.IsTrue((played.Contains(amour1) || played.Contains(amour2))); aiPlayer.Play(played); //quest.ResolveStage(); // FIXME // Does allies get played second? played = aiPlayer.Behaviour.PlayCardsInQuest(quest, aiPlayer.Hand); Assert.AreEqual(2, played.Count); Assert.IsTrue(played.Contains(gawain)); Assert.IsTrue(played.Contains(tristan)); aiPlayer.Play(played); //quest.ResolveStage(); FIXME // Does weapon (and galahad) get played last? played = aiPlayer.Behaviour.PlayCardsInQuest(quest, aiPlayer.Hand); Assert.AreEqual(2, played.Count); Assert.IsTrue(played.Contains(galahad)); Assert.IsTrue(played.Contains(axe)); }
public void TestPlayCardsInQuest() { //not testing bids for now QuestMatch game = ScenarioCreator.GameNoDeal(2); game.AttachLogger(new Quest.Core.Logger("TestPlayCardsInTest")); Player aiPlayer = game.Players[0]; Player sponsorPlayer = game.Players[1]; aiPlayer.Behaviour = new Strategy1(); // Setup quest RescueTheFairMaiden quest = new RescueTheFairMaiden(game); // 3 stages. game.CurrentStory = quest; quest.Sponsor = sponsorPlayer; //quest.AddParticipant(aiPlayer); // FIXME Thieves questThieves = new Thieves(game); Saxons questSaxons = new Saxons(game); RobberKnight questRobberKnight = new RobberKnight(game); sponsorPlayer.Hand.Add(new List <Card>() { questThieves, questSaxons, questRobberKnight }); quest.AddFoeStage(questThieves); //5 quest.AddFoeStage(questSaxons); //10 quest.AddFoeStage(questRobberKnight); //15 // Make player knight, 10 BP. aiPlayer.Rank.AddShields(5); //cards, no foes Lance lance = new Lance(game); //20 Lance lance2 = new Lance(game); //20 BattleAx battleAx = new BattleAx(game); //15 SirGalahad sirGalahad = new SirGalahad(game); //15 Amour amour = new Amour(game); //10 Sword sword = new Sword(game); //10 KingPellinore kingPellinore = new KingPellinore(game); //10 aiPlayer.Hand.Add(lance); aiPlayer.Hand.Add(lance2); aiPlayer.Hand.Add(battleAx); aiPlayer.Hand.Add(sirGalahad); //play stage 2 aiPlayer.Hand.Add(amour); //play stage 1 aiPlayer.Hand.Add(sword); aiPlayer.Hand.Add(kingPellinore); //first stage: amour List <BattleCard> played = aiPlayer.Behaviour.PlayCardsInQuest(quest, aiPlayer.Hand); Assert.AreEqual(1, played.Count); Assert.IsTrue(played.Contains(amour)); aiPlayer.Play(played); //quest.ResolveStage(); FIXME //2nd stage: galahad played = aiPlayer.Behaviour.PlayCardsInQuest(quest, aiPlayer.Hand); Assert.AreEqual(1, played.Count); Assert.IsTrue(played.Contains(sirGalahad)); aiPlayer.Play(played); //quest.ResolveStage(); FIXME //3rd stage: a lance, battleAx, sword, kingPellinore //is the quest not advancing stage?not sure played = aiPlayer.Behaviour.PlayCardsInQuest(quest, aiPlayer.Hand); Assert.AreEqual(4, played.Count); Assert.IsTrue((played.Contains(lance) || played.Contains(lance2))); Assert.IsTrue(played.Contains(battleAx)); Assert.IsTrue(played.Contains(sword)); Assert.IsTrue(played.Contains(kingPellinore)); }