Esempio n. 1
0
        public void That_Destroys_Target_Opponent_Unit()
        {
            DeckList.Add(SetCodes.DebugDestroyOpponentUnit);
            StartGame(DeckList);

            var support = Player.Hand[0].Id;

            Play.SetFaceDown(Player.Id, support);
            Play.EndTurn(Player.Id);
            var unitA = Opponent.Hand[1];
            var unitB = Opponent.Hand[6];

            Play.Deploy(Opponent.Id, unitA.Id);
            Play.PassPlay(Player.Id);
            Play.PassPlay(Opponent.Id);
            Play.Deploy(Opponent.Id, unitB.Id);
            Play.PassPlay(Player.Id);
            Play.PassPlay(Opponent.Id);
            Play.EndTurn(Opponent.Id);
            Play.Activate(Player.Id, support, unitA.Id);
            Play.PassPlay(Opponent.Id);
            Play.PassPlay(Player.Id);

            Assert.Contains(unitA, Opponent.Graveyard, "Then That Unit Is Destroyed");
        }
Esempio n. 2
0
        public void test_tag_unit_removed_from_field()
        {
            DeckList.Add(SetCodes.DebugDestroyOpponentUnit);
            DeckList.Add(SetCodes.AlphaGuardPuppy);

            StartGame(DeckList);
            var destroyUnit = Player.Hand[1];

            Play.SetFaceDown(Player.Id, destroyUnit.Id);
            Play.EndTurn(Player.Id);
            var guardPuppy   = Opponent.Hand[0];
            var dungeonGuide = Opponent.Hand[2];

            Play.Deploy(Opponent.Id, dungeonGuide.Id);
            Play.PassPlay(Player.Id);
            Play.PassPlay(Opponent.Id);
            Play.Deploy(Opponent.Id, guardPuppy.Id);
            Play.PassPlay(Player.Id);
            Play.PassPlay(Opponent.Id);
            Play.EndTurn(Opponent.Id);
            Play.Activate(Player.Id, destroyUnit.Id, dungeonGuide.Id);
            Play.PassPlay(Opponent.Id);
            Play.PassPlay(Player.Id);

            Assert.Contains(dungeonGuide, Opponent.Graveyard, "That Unit is in owner's discard");
            Assert.IsFalse(dungeonGuide.HasTag(TagIds.CannotBeAttacked), "Then that Unit no longer has the tag");
        }
Esempio n. 3
0
 public void OnAttack()
 {
     
 // This test allows us to check that Chain Mines destroyed the attacking monster
 // However it doesn't absolutely confirm that this activation was legal (we know it is but the game doesn't know for sure)
 // We likely need to create a dedicated error handler system with err_codes, signals etc.
     var deckList = new List<SetCodes>();
     deckList.Add(SetCodes.Debug500500);
     deckList.Add(SetCodes.Debug500500);
     deckList.Add(SetCodes.Debug500500);
     deckList.Add(SetCodes.DebugDestroyAttackingUnit);
     deckList.Add(SetCodes.DebugDestroyAttackingUnit);
     deckList.Add(SetCodes.DebugDestroyAttackingUnit);
     deckList.Add(SetCodes.Debug15001000);
     deckList.Add(SetCodes.Debug15001000);
     deckList.Add(SetCodes.Debug15001000);
     StartGame(deckList);
     var attacker = Player.Hand[6];
     var chainMine = Opponent.Hand[3];
     Play.Deploy(Player.Id, attacker.Id);
     Play.PassPlay(Opponent.Id);
     Play.PassPlay(Player.Id);
     Play.EndTurn(Player.Id);
     Play.SetFaceDown(Opponent.Id, chainMine.Id);
     Play.EndTurn(Opponent.Id);
     Play.AttackDirectly(Player.Id, attacker.Id);
     Play.Activate(Opponent.Id, chainMine.Id);
     Play.PassPlay(Player.Id);
     Play.PassPlay(Opponent.Id);
     
     // Link Should Resolve Here
     Assert.Contains(attacker, Player.Graveyard, attacker + "is in Player 1's Discard");
     Assert.Contains(chainMine, Opponent.Graveyard, chainMine + " is in Player 0's Discard");
 }
Esempio n. 4
0
        public void That_Targets_A_Unit_When_Only_One_Nontargetable_Target_Exists()
        {
            // This requires restructing our targeting based systems.
            DeckList.Add(SetCodes.DebugCannotBeTargeted);
            DeckList.Add(SetCodes.DebugDestroyOpponentUnit);
            StartGame(DeckList);

            var cannotBeTargeted = Opponent.Hand[1];

            var destroyUnit = Player.Hand[0];

            Play.SetFaceDown(Player.Id, destroyUnit.Id);
            Play.EndTurn(Player.Id);
            Play.Deploy(Opponent.Id, cannotBeTargeted.Id);
            Play.PassPlay(Player.Id);
            Play.PassPlay(Opponent.Id);
            Play.EndTurn(Opponent.Id);

            Play.Activate(Player.Id, destroyUnit.Id, cannotBeTargeted.Id);
            Play.PassPlay(Opponent.Id);
            Play.PassPlay(Player.Id);

            Assert.DoesNotContain(destroyUnit, Player.Graveyard, "DestroyUnit was not sent to Player's discard");
            Assert.DoesNotContain(cannotBeTargeted, Opponent.Graveyard, "Untargetable Card was not destroyed");
        }
Esempio n. 5
0
        public void When_They_Activate_A_Support_While_InActive()
        {
            DeckList.Add(SetCodes.DebugDraw2Cards);
            StartGame(DeckList);
            var support = Player.Hand[0].Id;

            Play.SetFaceDown(Player.Id, support);
            Play.EndTurn(Player.Id);
            Play.Activate(Player.Id, support);

            Assert.IsTrue(Player.IsDisqualified);
        }
Esempio n. 6
0
        public void When_They_Activate_An_Unready_Support()
        {
            DeckList.Add(SetCodes.DebugDraw2Cards);
            StartGame(DeckList);
            var s       = Player.Hand[0];
            var support = Player.Hand[0].Id;

            Assert.IsFalse(s.IsReady, "Card is not ready in hand");
            Play.SetFaceDown(Player.Id, support);
            Assert.IsFalse(s.IsReady, "Card is not ready when set");
            Play.Activate(Player.Id, support);
            Assert.IsFalse(s.IsReady, "Card is not ready when activated");
            Assert.IsTrue(Player.IsDisqualified, "Player is disqualified");
        }
Esempio n. 7
0
        public void That_Discards_Your_Target_Card()
        {
            DeckList.Add(SetCodes.DebugDiscardYourCard);
            StartGame(DeckList);
            var discarding = Player.Hand[1];
            var discarder  = Player.Hand[0].Id;

            Play.SetFaceDown(Player.Id, discarder);
            Play.EndTurn(Player.Id);
            Play.EndTurn(Opponent.Id);
            Play.Activate(Player.Id, discarder, discarding.Id);
            Play.PassPlay(Opponent.Id);
            Play.PassPlay(Player.Id);

            Assert.Contains(discarding, Player.Graveyard, "Then that card is in that Player's Discard");
        }
Esempio n. 8
0
        public void That_Mills_A_Card()
        {
            DeckList.Add(SetCodes.MillOneFromDeck);

            StartGame(DeckList);
            var millCard = Player.Hand[0].Id;

            Play.SetFaceDown(Player.Id, millCard);
            Play.EndTurn(Player.Id);
            Play.EndTurn(Opponent.Id);
            var cardToMill = Player.Deck[Player.Deck.Count - 1];

            Play.Activate(Player.Id, millCard);
            Play.PassPlay(Opponent.Id);
            Play.PassPlay(Player.Id);

            Assert.Contains(cardToMill, Player.Graveyard, "Then that card is in the Player's discard");
        }
Esempio n. 9
0
        public void ActivePlayer_Becomes_Active_When_They_Take_An_Action()
        {
            StartGame(Decklist);
            var support = Player.Hand[3].Id;

            Play.SetFaceDown(Player.Id, support);
            Play.EndTurn(Player.Id);
            var unit = Opponent.Hand[0].Id;

            Play.Deploy(Opponent.Id, unit);
            var oldState = Player.State;

            Play.Activate(Player.Id, support);
            var newState = Player.State;

            Assert.IsTrue(oldState == States.Active, "Player was Active");
            Assert.IsTrue(newState == States.Acting, "Player is Acting");
        }
Esempio n. 10
0
        public void That_Returns_A_Card_To_The_Players_Deck()
        {
            DeckList.Add(SetCodes.DebugReturnToDeck);

            StartGame(DeckList);
            var returnToDeckCard = Player.Hand[0].Id;

            Play.SetFaceDown(Player.Id, returnToDeckCard);
            Play.EndTurn(Player.Id);
            Play.EndTurn(Opponent.Id);

            var cardToReturn = Player.Hand[0];

            Play.Activate(Player.Id, returnToDeckCard, cardToReturn.Id);
            Play.PassPlay(Opponent.Id);
            Play.PassPlay(Player.Id);

            Assert.Contains(cardToReturn, Player.Deck, "Then that card is in the Player's Deck");
        }
Esempio n. 11
0
        public void That_Returns_A_Unit_To_Opponents_Hand()
        {
            DeckList.Add(SetCodes.DebugBounceFromField);
            StartGame(DeckList);
            var bouncer = Player.Hand[0].Id;
            var bounce  = Opponent.Hand[1];

            Play.SetFaceDown(Player.Id, bouncer);
            Play.EndTurn(Player.Id);
            Play.Deploy(Opponent.Id, bounce.Id);
            Play.PassPlay(Player.Id);
            Play.PassPlay(Opponent.Id);
            Play.EndTurn(Opponent.Id);
            var bounceIsOnField = Opponent.Field.Contains(bounce);

            Play.Activate(Player.Id, bouncer, bounce.Id);
            Play.PassPlay(Opponent.Id);
            Play.PassPlay(Player.Id);

            Assert.IsTrue(bounceIsOnField, "Bounced Card Was On Field");
            Assert.Contains(bounce, Opponent.Hand, "Bounce is in Owners Hand");
        }
Esempio n. 12
0
        public void That_Tries_To_Destroy_An_Indestructible_Card()
        {
            DeckList.Add(SetCodes.DebugDestroyOpponentUnit);
            DeckList.Add(SetCodes.DebugCannotBeDestoyedByEffect);
            StartGame(DeckList);
            var invincibleCard  = Opponent.Hand[0];
            var destroyUnitCard = Player.Hand[1];

            Play.SetFaceDown(Player.Id, destroyUnitCard.Id);
            Play.EndTurn(Player.Id);
            Play.Deploy(Opponent.Id, invincibleCard.Id);
            Play.PassPlay(Player.Id);
            Play.PassPlay(Opponent.Id);
            Play.EndTurn(Opponent.Id);
            Play.Activate(Player.Id, destroyUnitCard.Id, invincibleCard.Id);
            Play.PassPlay(Opponent.Id);
            Play.PassPlay(Player.Id);

            Assert.Contains(destroyUnitCard, Player.Graveyard, "Then that skill's card is in the discard");

            Assert.DoesNotContain(invincibleCard, Opponent.Graveyard,
                                  "But the invincible card is not in its owner discard");
        }
Esempio n. 13
0
        public void OnAttack()
        {
            var deckList = new List <SetCodes>();

            deckList.Add(SetCodes.Debug500500);
            deckList.Add(SetCodes.Debug500500);
            deckList.Add(SetCodes.Debug500500);
            deckList.Add(SetCodes.DebugDestroyAttackingUnit);
            deckList.Add(SetCodes.DebugDestroyAttackingUnit);
            deckList.Add(SetCodes.DebugDestroyAttackingUnit);
            deckList.Add(SetCodes.Debug15001000);
            deckList.Add(SetCodes.Debug15001000);
            deckList.Add(SetCodes.Debug15001000);
            StartGame(deckList);

            // LINK SUMMARY
            // ACTION TAKEN (NON CHAIN)
            // PLAYER WHO TOOK ACTION MAY CHAIN
            // OPPONENT MAY CHAIN
            // RESOLVE

            // UPDATE
            // Player A May Take Action From IDLE
            // Player A May Respond To Own Action (Repeat This Until Pass) From ACTIVE
            // Player B May Respond (From ACTIVE)
            // Player A May Respond (From ACTIVE)
            var attacker   = Player.Hand[6];
            var chainMines = (Support)Opponent.Hand[3];



            // Whitebox Checking
            Assert.IsTrue(Player.State == States.Idle, "Player 1 is IDLE");
            Assert.IsTrue(Opponent.State == States.Passive, "Player 0 is PASSIVE");

            Play.Deploy(Player.Id, attacker.Id);

            // Whitebox Checking
            // Player 1 took an action from IDLE that doesn't start a chain so they should
            // be active (rather than acting?) Maybe acting != activating?

            Assert.Contains(attacker, Player.Field, "Attacker Has been Deployed");

            Assert.IsTrue(Player.State == States.Acting, "Player 1 is ACTING");
            Assert.IsTrue(Opponent.State == States.Active, "Player 0 is ACTIVE");

            Play.PassPlay(Opponent.Id);

            // Whitebox Check
            Assert.IsTrue(Opponent.State == States.Passing, "Player 0 is PASSING");
            Assert.IsTrue(Player.State == States.Active, "Player 1 is ACTIVE");

            Play.PassPlay(Player.Id);

            Assert.IsTrue(Player.State == States.Idle, "Player 1 is IDLE");
            Assert.IsTrue(Opponent.State == States.Passive, "Player 0 is PASSIVE");

            Play.EndTurn(Player.Id);

            Assert.IsTrue(Player.State == States.Passive, "Player 1 is PASSIVE");
            Assert.IsTrue(Opponent.State == States.Idle, "Player 0 is IDLE");

            Play.SetFaceDown(Opponent.Id, chainMines.Id);
            Assert.Contains(chainMines, Opponent.Support, "Chain Mines Has been set");
            Play.EndTurn(Opponent.Id);

            Assert.IsTrue(Player.State == States.Idle, "Player 1 is IDLE");
            Assert.IsTrue(Opponent.State == States.Passive, "Player 0 is PASSIVE");
            Play.AttackDirectly(Player.Id, attacker.Id);

            Assert.IsTrue(Player.State == States.Acting, "Player 1 is ACTING");
            Assert.IsTrue(Opponent.State == States.Active, "Player 0 is ACTIVE");

            Assert.IsTrue(chainMines.IsReady, "ChainMines Is Ready");
            Assert.IsTrue(chainMines.State == Card.States.CanBeActivated, "ChainMine can be activated");
            Play.Activate(Opponent.Id, chainMines.Id);

            Assert.IsTrue(Opponent.State == States.Acting, "Player 0 is ACTING");
            Assert.IsTrue(Player.State == States.Active, "Player 1 is ACTIVE");

            Play.PassPlay(Player.Id);

            Assert.IsTrue(Player.State == States.Passing, "Player 1 is PASSING");
            Assert.IsTrue(Opponent.State == States.Active, "Player 0 is ACTIVE");

            Play.PassPlay(Opponent.Id);

            Assert.IsTrue(Player.State == States.Idle, "Player 1 is IDLE");
            Assert.IsTrue(Opponent.State == States.Passive, "Player 0 is PASSIVE");



            Assert.Contains(attacker, Player.Graveyard, attacker + "Unit %s is in Player 1's discard");

            Assert.Contains(chainMines, Opponent.Graveyard, chainMines + "Support %s is in Player 0's Discard");
        }