Merge pull request #5783 from drmDev/ut/BlockTrollTests

UTs added for Challenger Troll block restrictions. closes #5730
This commit is contained in:
Derek M 2019-05-05 12:32:19 -04:00 committed by GitHub
commit 3d3960c5f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -225,4 +225,77 @@ public class BlockRequirementTest extends CardTestPlayerBase {
assertGraveyardCount(playerB, "Dimensional Infiltrator", 1);
assertGraveyardCount(playerB, "Llanowar Elves", 1);
}
/*
Reported bug: Challenger Troll on field not enforcing block restrictions
*/
@Test
public void testChallengerTrollTryBlockWithMany() {
/*
Challenger Troll {4}{G} - 6/5
Creature Troll
Each creature you control with power 4 or greater cant be blocked by more than one creature.
*/
String cTroll = "Challenger Troll";
String bSable = "Bronze Sable"; // {2} 2/1
String hGiant = "Hill Giant"; // {3}{R} 3/3
addCard(Zone.BATTLEFIELD, playerA, cTroll);
addCard(Zone.BATTLEFIELD, playerB, bSable);
addCard(Zone.BATTLEFIELD, playerB, hGiant);
attack(1, playerA, cTroll);
// only 1 should be able to block it since Troll >=4 power block restriction
block(1, playerB, bSable, cTroll);
block(1, playerB, hGiant, cTroll);
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
try {
execute();
fail("Expected exception not thrown");
} catch (UnsupportedOperationException e) {
assertEquals("Challenger Troll is blocked by 2 creature(s). It can only be blocked by 1 or less.", e.getMessage());
}
}
/*
Reported bug: Challenger Troll on field not enforcing block restrictions
*/
@Test
public void testChallengerTrollAndOtherFourPowerCreaturesBlocks() {
/*
Challenger Troll {4}{G} - 6/5
Creature Troll
Each creature you control with power 4 or greater cant be blocked by more than one creature.
*/
String cTroll = "Challenger Troll";
String bHulk = "Bloom Hulk"; // {3}{G} 4/4 ETB: proliferate
String bSable = "Bronze Sable"; // {2} 2/1
String hGiant = "Hill Giant"; // {3}{R} 3/3
addCard(Zone.BATTLEFIELD, playerA, cTroll);
addCard(Zone.BATTLEFIELD, playerA, bHulk);
addCard(Zone.BATTLEFIELD, playerB, bSable);
addCard(Zone.BATTLEFIELD, playerB, hGiant);
attack(1, playerA, cTroll);
attack(1, playerA, bHulk);
// only 1 should be able to block Bloom Hulk since >=4 power and Troll on field
block(1, playerB, bSable, bHulk);
block(1, playerB, hGiant, bHulk);
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
try {
execute();
fail("Expected exception not thrown");
} catch (UnsupportedOperationException e) {
assertEquals("Bloom Hulk is blocked by 2 creature(s). It can only be blocked by 1 or less.", e.getMessage());
}
}
}