예제 #1
0
        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));
        }
예제 #2
0
        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));
        }