Merge pull request #5888 from jgray1206/boneclad_necromancer_fix

added boneclad necromancer unit tests + fix for issue #5875
This commit is contained in:
Oleg Agafonov 2019-07-08 06:39:58 +02:00 committed by GitHub
commit aa1ebd7303
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 79 additions and 2 deletions

View file

@ -9,7 +9,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.game.permanent.token.ZombieToken;
import mage.target.common.TargetCardInGraveyard;
@ -20,7 +20,7 @@ import java.util.UUID;
*/
public final class BonecladNecromancer extends CardImpl {
private static final FilterCard filter = new FilterCard("creature card from a graveyard");
private static final FilterCreatureCard filter = new FilterCreatureCard("creature card from a graveyard");
public BonecladNecromancer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}");

View file

@ -0,0 +1,77 @@
package org.mage.test.cards.triggers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* Added this test class to test issue #5875
* https://github.com/magefree/mage/issues/5875
*
* Boneclad Necromancer could exile non-creature cards from the graveyard to get his 2/2 Zombie.
*
* Boneclad Necromancer {3}{B}{B}
*
* Card Type: Creature Human Wizard
* P / T: 3 / 3
* Description: When Boneclad Necromancer enters the battlefield, you may exile target creature card from a graveyard.
* If you do, create a 2/2 black Zombie creature token.
*
* @author jgray1206
*/
public class BonecladNecromancerTest extends CardTestPlayerBase {
@Test
public void testBonecladNecromancerCanExileCreaturesFromOwnGraveyard() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
addCard(Zone.HAND, playerA, "Boneclad Necromancer", 1);
addCard(Zone.GRAVEYARD, playerA, "Raptor Hatchling", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Boneclad Necromancer");
playerA.addChoice("Raptor Hatchling");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Boneclad Necromancer", 1);
assertPermanentCount(playerA, "Zombie", 1);
assertExileCount(playerA, "Raptor Hatchling", 1);
assertGraveyardCount(playerA, "Raptor Hatchling", 0);
}
@Test
public void testBonecladNecromancerCanExileCreaturesFromOtherGraveyard() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
addCard(Zone.HAND, playerA, "Boneclad Necromancer", 1);
addCard(Zone.GRAVEYARD, playerB, "Raptor Hatchling", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Boneclad Necromancer");
playerA.addChoice("Raptor Hatchling");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Boneclad Necromancer", 1);
assertPermanentCount(playerA, "Zombie", 1);
assertExileCount(playerB, "Raptor Hatchling", 1);
assertGraveyardCount(playerB, "Raptor Hatchling", 0);
}
@Test
public void testBonecladNecromancerCantExileNonCreatures() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
addCard(Zone.HAND, playerA, "Boneclad Necromancer", 1);
addCard(Zone.GRAVEYARD, playerA, "Feral Invocation", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Boneclad Necromancer");
playerA.addChoice("Feral Invocation");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Boneclad Necromancer", 1);
assertPermanentCount(playerA, "Zombie", 0);
assertExileCount(playerA, "Feral Invocation", 0);
assertGraveyardCount(playerA, "Feral Invocation", 1);
}
}