From a38216ccf276841c720f5759de3d8cc53db5321e Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Thu, 10 Mar 2016 17:07:45 +0100 Subject: [PATCH] Added test. --- .../requirement/AttackRequirementTest.java | 43 +++++++++++++------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/requirement/AttackRequirementTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/requirement/AttackRequirementTest.java index 6fcfd8a4435..98fc4af658b 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/requirement/AttackRequirementTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/requirement/AttackRequirementTest.java @@ -36,56 +36,73 @@ import org.mage.test.serverside.base.CardTestPlayerBase; * * @author LevelX2 */ - public class AttackRequirementTest extends CardTestPlayerBase { - @Test public void testSimpleAttackRequirement() { // Defender // {G}: Wall of Tanglecord gains reach until end of turn. (It can block creatures with flying.) addCard(Zone.BATTLEFIELD, playerA, "Wall of Tanglecord"); // 0/6 - + // Juggernaut attacks each turn if able. // Juggernaut can't be blocked by Walls addCard(Zone.BATTLEFIELD, playerB, "Juggernaut"); // 5/3 - - // Juggernaut should be forced to ttack + + // Juggernaut should be forced to ttack block(2, playerA, "Wall of Tanglecord", "Juggernaut"); // this block should'nt work because of Juggernauts restriction setStopAt(2, PhaseStep.POSTCOMBAT_MAIN); execute(); - assertLife(playerA, 15); + assertLife(playerA, 15); assertLife(playerB, 20); } - @Test public void testAttackRequirementWithAttackRestriction() { addCard(Zone.BATTLEFIELD, playerA, "Plains", 3); // Defender // {G}: Wall of Tanglecord gains reach until end of turn. (It can block creatures with flying.) addCard(Zone.BATTLEFIELD, playerA, "Wall of Tanglecord"); // 0/6 - + // Creatures can't attack you unless their controller pays {2} for each creature he or she controls that's attacking you addCard(Zone.HAND, playerA, "Ghostly Prison"); - + // Juggernaut attacks each turn if able. // Juggernaut can't be blocked by Walls addCard(Zone.BATTLEFIELD, playerB, "Juggernaut"); // 5/3 - + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ghostly Prison"); - + // Juggernaut is forced to attack but can't without paying the Ghostly Prison cost and don't has to pay the costs so no attack + setStopAt(2, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertLife(playerA, 20); + assertLife(playerB, 20); + + } + + /** + * Goblin Rabblemaster isn't forcing Goblins to attack. + */ + @Test + public void testAttackRequirementGoblinRabblemaster() { + // Other Goblin creatures you control attack each turn if able. + // At the beginning of combat on your turn, put a 1/1 red Goblin creature token with haste onto the battlefield. + // When Goblin Rabblemaster attacks, it gets +1/+0 until end of turn for each other attacking Goblin. + addCard(Zone.BATTLEFIELD, playerB, "Goblin Rabblemaster"); // 2/2 + // Menace (This creature can't be blocked except by two or more creatures.) + addCard(Zone.BATTLEFIELD, playerB, "Boggart Brute"); // 3/2 + + attack(2, playerB, "Goblin Rabblemaster"); setStopAt(2, PhaseStep.POSTCOMBAT_MAIN); execute(); - assertLife(playerA, 20); + assertLife(playerA, 12); // got damage 1 from Token, 3 from Boggart Brute + 2 + 2 from Goblin Rabblemaster = 9 assertLife(playerB, 20); } - }