* Added test for Dream Leash.

This commit is contained in:
LevelX2 2020-06-29 18:02:18 +02:00
parent a5d10d6a5d
commit 368faa37dd
2 changed files with 90 additions and 1 deletions

View file

@ -0,0 +1,89 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.mage.test.cards.targets;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class TargetRestrictionsTest extends CardTestPlayerBase {
@Test
public void testDreamLeashWorks() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 6);
// Enchant permanent
// You can't choose an untapped permanent as Dream Leash's target as you cast Dream Leash.
// You control enchanted permanent.
addCard(Zone.HAND, playerA, "Dream Leash"); // Enchantment {3}{U}{U}
// Tap target creature. It doesn't untap during its controller's next untap step.
addCard(Zone.HAND, playerA, "Take into Custody"); // Instant {U}
addCard(Zone.BATTLEFIELD, playerB, "Sejiri Merfolk");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Take into Custody", "Sejiri Merfolk");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Dream Leash", "Sejiri Merfolk");
setStrictChooseMode(true);
setStopAt(3, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Dream Leash", 1);
assertPermanentCount(playerA, "Sejiri Merfolk", 1);
assertLife(playerA, 20);
assertLife(playerB, 20);
}
@Test
public void testDreamLeashUntappingAsResponseToCast() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 6);
// Enchant permanent
// You can't choose an untapped permanent as Dream Leash's target as you cast Dream Leash.
// You control enchanted permanent.
addCard(Zone.HAND, playerA, "Dream Leash"); // Enchantment {3}{U}{U}
// Tap target creature. It doesn't untap during its controller's next untap step.
addCard(Zone.HAND, playerA, "Take into Custody"); // Instant {U}
// Untap target creature. It gets +1/+3 until end of turn.
addCard(Zone.HAND, playerB, "Ornamental Courage"); // Instant {G}
addCard(Zone.BATTLEFIELD, playerB, "Forest");
addCard(Zone.BATTLEFIELD, playerB, "Sejiri Merfolk");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Take into Custody", "Sejiri Merfolk");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Dream Leash", "Sejiri Merfolk");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Ornamental Courage", "Sejiri Merfolk", "Dream Leash");
setStrictChooseMode(true);
setStopAt(3, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertGraveyardCount(playerA, "Take into Custody", 1);
assertGraveyardCount(playerB, "Ornamental Courage", 1);
assertPermanentCount(playerA, "Dream Leash", 1);
assertPermanentCount(playerA, "Sejiri Merfolk", 1);
assertPowerToughness(playerA, "Sejiri Merfolk", 2, 1);
assertLife(playerA, 20);
assertLife(playerB, 20);
}
}

View file

@ -29,7 +29,7 @@ public class EmergeAbility extends SpellAbility {
public EmergeAbility(Card card, ManaCosts<ManaCost> emergeCost) {
super(card.getSpellAbility());
this.emergeCost = emergeCost.copy();
this.newId(); // Why is this neccessary? will create new id anyway or not?
this.newId(); // Set newId because cards spell ability is copied and needs own id
this.setCardName(card.getName() + " with emerge");
zone = Zone.HAND;
spellAbilityType = SpellAbilityType.BASE_ALTERNATE;