Updated implementation of Hexproof abilities (#6451)

* updated implementation of hexproof abilities

* added hexproof from color test

* updated generic in AbilityPredicate
This commit is contained in:
Evan Kranzler 2020-04-23 20:01:13 -04:00 committed by GitHub
parent f7309919b9
commit 7f32ea0be2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 128 additions and 126 deletions

View file

@ -9,7 +9,6 @@ import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class HexproofTest extends CardTestPlayerBase {
@ -37,6 +36,7 @@ public class HexproofTest extends CardTestPlayerBase {
assertPowerToughness(playerA, "Elder of Laurels", 3, 4);
assertAbility(playerA, "Elder of Laurels", HexproofAbility.getInstance(), true);
}
/**
* Tests one target gets hexproof
*/
@ -64,4 +64,42 @@ public class HexproofTest extends CardTestPlayerBase {
assertAbility(playerA, "Elder of Laurels", HexproofAbility.getInstance(), true);
assertPermanentCount(playerA, "Arbor Elf", 0);
}
/**
* Tests hexproof from a color with opponent's spells
*/
@Test
public void testHexproofFromColorOpponentSpells() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 6);
addCard(Zone.HAND, playerA, "Murder", 2);
addCard(Zone.BATTLEFIELD, playerB, "Knight of Grace");
addCard(Zone.BATTLEFIELD, playerB, "Knight of Malice");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Murder", "Knight of Grace");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Murder", "Knight of Malice");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerB, "Knight of Grace", 1);
assertPermanentCount(playerB, "Knight of Malice", 0);
}
/**
* Tests hexproof from a color with controller's spells
*/
@Test
public void testHexproofFromColorOwnSpells() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
addCard(Zone.BATTLEFIELD, playerA, "Knight of Grace");
addCard(Zone.HAND, playerA, "Murder");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Murder", "Knight of Grace");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Knight of Grace", 0);
}
}