예제 #1
0
        public void Res5Phasetest()
        {
            SunQuan     p1 = new SunQuan(0);
            LiuBei      p2 = new LiuBei(1);
            List <Card> x  = new List <Card>();

            Player[] p = new SunQuan[1];
            p[0] = p1;
            Miss miss   = new Miss(CardSuit.Diamond, 2);
            Card attack = new Attack(CardSuit.Spade, 1);

            x.Add(miss);
            x.Add(attack);
            Game game = new Game(p, new CardSet(x));



            // ActionPhase produces attackPhase
            ActionPhase a   = new ActionPhase(p1);
            PhaseList   ret = a.advance(new UseCardAction(attack, p2), game);
            Phase       b   = ret.pop();
            AttackPhase b2  = b as AttackPhase;

            p1.handCards.Add(attack);
            p1.handCards.Add(miss);
            p1.health = 1;

            // AttackPhase produces responsePhase
            ret = b.advance(null, game);
            Phase         c  = ret.pop();
            ResponsePhase c_ = c as ResponsePhase;


            Assert.IsInstanceOfType(a.responseAbilityActionSun(new AbilityActionSun(attack), game), typeof(PhaseList));
        }
예제 #2
0
 public void SunQuanAbtestnomockBVA()
 {
     {
         Player p    = new SunQuan(0);
         Attack card = new Attack(CardSuit.Heart, (byte)1);
         p.handCards.Add(card);
         Assert.IsTrue(p.handCards.Count == 1);
         Assert.IsTrue(card == p.handCards[0]);
     }
 }
예제 #3
0
        public void SunAbtestnomocknull2()
        {
            {
                Player p = new SunQuan(0);

                Attack card = new Attack(CardSuit.Heart, (byte)1);
                p.handCards.Add(card);
                p.abilitySun(new AbilityActionSun(card), null);
            }
        }
예제 #4
0
        public void SunAbtestnomocknull()
        {
            {
                Player p = new SunQuan(0);

                Attack card = new Attack(CardSuit.Heart, (byte)1);
                p.handCards.Add(card);
                p.abilitySun(null, mocks.Stub <IGame>());
            }
        }
예제 #5
0
 public void SunAbtestnomock()
 {
     {
         Player p        = new SunQuan(0);
         IGame  fakeGame = mocks.DynamicMock <IGame>();
         Attack card     = new Attack(CardSuit.Heart, (byte)1);
         p.handCards.Add(card);
         List <Card> l = new List <Card>();
         l.Add(card);
         p.abilitySun(new AbilityActionSun(card), new Game(new Player[0], new CardSet(l)));
     }
 }
예제 #6
0
        /// <summary>
        /// initialize players
        /// </summary>
        /// <param name="n"></param>
        /// <returns></returns>
        public static Player[] initializePlayers(int n)
        {
            Player[] players = new Player[n];

            players[0] = new LuMeng(0, PlayerType.King);
            players[1] = new SunQuan(1, PlayerType.Loyal);
            players[2] = new LiuBei(2, PlayerType.Rebel);
            players[3] = new ZhangFei(3, PlayerType.Rebel);
            players[4] = new CaoCao(4, PlayerType.Spy);

            return(players);
        }