Exemple #1
0
        public void Use_Invalid_BlueItem_Target_Creature()
        {
            int invalidSourceId = 0;
            int targetId        = 0;

            UseAction action = new UseAction(invalidSourceId, targetId);
            bool      result = action.Execute(player1, player2);

            Assert.IsTrue(result);
            Assert.AreEqual(DEFAULT_MY_HEALTH, player1.Data.Health);
            Assert.AreEqual(DEFAULT_OPP_HEALTH, player2.Data.Health);
        }
Exemple #2
0
        private void RunUseActionCreatureTest(int sourceId, int targetId)
        {
            Card card = player1.Hand[sourceId];

            player1.Mana = card.Cost;

            int expectedMyHealth  = player1.Data.Health + card.MyHealthChange;
            int expectedOppHealth = player2.Data.Health + card.OppHealthChange;

            int expectedNextDraw   = player1.NextDrawSize + card.Draw;
            int expectedPlayerHand = player1.Hand.Count - 1;


            player1.Table.TryGetValue(targetId, out CombatCreature target);
            if (target == null)
            {
                player2.Table.TryGetValue(targetId, out target);
            }

            int expectedAttack  = target.Attack + (targetId == -1 ? 0 : card.Attack);
            int expectedDefense = target.Defense + (targetId == -1 ? 0 : card.Defense);

            Card expectedCard = target.Card.Clone();

            if (card.Type == 2)
            {
                expectedCard.RemoveAbils(card.Abils);
            }
            else if (card.Type == 1)
            {
                expectedCard.AddAbils(card.Abils);
            }

            UseAction action = new UseAction(sourceId, targetId);
            bool      result = action.Execute(player1, player2);

            Assert.IsTrue(result);
            Assert.AreEqual(expectedMyHealth, player1.Data.Health);
            Assert.AreEqual(expectedOppHealth, player2.Data.Health);
            Assert.AreEqual(expectedNextDraw, player1.NextDrawSize);
            Assert.AreEqual(expectedPlayerHand, player1.Hand.Count);
            Assert.AreEqual(expectedAttack, target.Attack);
            Assert.AreEqual(expectedDefense, target.Defense);
            Assert.AreEqual(expectedCard.Abils, target.Card.Abils);
        }
Exemple #3
0
        private void RunInvalidUseActionTest(int sourceId, int targetId)
        {
            int expectedMyHealth   = player1.Data.Health;
            int expectedOppHealth  = player2.Data.Health;
            int expectedNextDraw   = player1.NextDrawSize;
            int expectedOppTable   = player2.Table.Count;
            int expectedPlayerHand = player1.Hand.Count;


            UseAction action = new UseAction(sourceId, targetId);
            bool      result = action.Execute(player1, player2);

            Assert.IsTrue(result);
            Assert.AreEqual(expectedMyHealth, player1.Data.Health);
            Assert.AreEqual(expectedOppHealth, player2.Data.Health);
            Assert.AreEqual(expectedNextDraw, player1.NextDrawSize);
            Assert.AreEqual(expectedPlayerHand, player1.Hand.Count);
            Assert.AreEqual(expectedOppTable, player2.Table.Count);
        }
Exemple #4
0
        private void RunUseActionPlayerTest(int sourceId, int targetId)
        {
            Card card = player1.Hand[sourceId];

            player1.Mana = card.Cost;

            int expectedMyHealth  = player1.Data.Health + card.MyHealthChange;
            int expectedOppHealth = player2.Data.Health + card.OppHealthChange + card.Defense;

            int expectedNextDraw   = player1.NextDrawSize + card.Draw;
            int expectedPlayerHand = player1.Hand.Count - 1;

            UseAction action = new UseAction(sourceId, targetId);
            bool      result = action.Execute(player1, player2);

            Assert.IsTrue(result);
            Assert.AreEqual(expectedMyHealth, player1.Data.Health);
            Assert.AreEqual(expectedOppHealth, player2.Data.Health);
            Assert.AreEqual(expectedNextDraw, player1.NextDrawSize);
            Assert.AreEqual(expectedPlayerHand, player1.Hand.Count);
        }