mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
tests: added todo and PoC test for multi target definition (see test_JadeSeedstonesAndMultiTargets)
This commit is contained in:
parent
027bda9c04
commit
2186a49a0f
2 changed files with 49 additions and 8 deletions
|
|
@ -2,6 +2,7 @@ package org.mage.test.cards.abilities.keywords;
|
||||||
|
|
||||||
import mage.constants.PhaseStep;
|
import mage.constants.PhaseStep;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
|
import mage.counters.CounterType;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
@ -201,4 +202,42 @@ public class CraftTest extends CardTestPlayerBase {
|
||||||
assertHandCount(playerA, 0);
|
assertHandCount(playerA, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore // TODO: enable and search code by "int takeMaxTargetsPerChoose"
|
||||||
|
public void test_JadeSeedstonesAndMultiTargets() {
|
||||||
|
// testing multiple addTarget support (possible bug: one ability can take target definition from other ability)
|
||||||
|
|
||||||
|
// Jade Seedstones:
|
||||||
|
// Craft with creature {5}{G}{G} ({5}{G}{G}, Exile this artifact, Exile a creature you control or a
|
||||||
|
// creature card from your graveyard: Return this card transformed under its owner’s control.
|
||||||
|
// Craft only as a sorcery.)
|
||||||
|
// Jadeheart Attendant:
|
||||||
|
// When Jadeheart Attendant enters the battlefield, you gain life equal to the mana value of the
|
||||||
|
// exiled card used to craft it.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Jade Seedstones"); // {3}{G}
|
||||||
|
addCard(Zone.GRAVEYARD, playerA, "Elvish Mystic"); // {G}
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Forest", 8);
|
||||||
|
//
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Llanowar Elves");
|
||||||
|
//
|
||||||
|
// When Bond Beetle enters the battlefield, put a +1/+1 counter on target creature.
|
||||||
|
addCard(Zone.HAND, playerA, "Bond Beetle"); // {G}
|
||||||
|
|
||||||
|
// craft, transform and gain 1 life from exiled elvish
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Craft");
|
||||||
|
addTarget(playerA, "Elvish Mystic");
|
||||||
|
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||||
|
checkPermanentCount("after craft", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Jadeheart Attendant", 1);
|
||||||
|
checkLife("after craft", 1, PhaseStep.PRECOMBAT_MAIN, playerA, 20 + 1);
|
||||||
|
|
||||||
|
// cast beetle and add counter to elves
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Bond Beetle");
|
||||||
|
addTarget(playerA,"Llanowar Elves");
|
||||||
|
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||||
|
checkPermanentCounters("after beetle", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Llanowar Elves", CounterType.P1P1, 1);
|
||||||
|
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,8 @@ public class TestPlayer implements Player {
|
||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(TestPlayer.class);
|
private static final Logger LOGGER = Logger.getLogger(TestPlayer.class);
|
||||||
|
|
||||||
|
private static final int takeMaxTargetsPerChoose = Integer.MAX_VALUE; // TODO: set 1, fix broken tests and replace all "for (String targetDefinition" by targets.get(0)
|
||||||
|
|
||||||
public static final String TARGET_SKIP = "[target_skip]"; // stop/skip targeting
|
public static final String TARGET_SKIP = "[target_skip]"; // stop/skip targeting
|
||||||
public static final String CHOICE_SKIP = "[choice_skip]"; // stop/skip choice
|
public static final String CHOICE_SKIP = "[choice_skip]"; // stop/skip choice
|
||||||
public static final String MANA_CANCEL = "[mana_cancel]"; // cancel payment
|
public static final String MANA_CANCEL = "[mana_cancel]"; // cancel payment
|
||||||
|
|
@ -2429,7 +2431,7 @@ public class TestPlayer implements Player {
|
||||||
|| target.getOriginalTarget() instanceof TargetAnyTarget
|
|| target.getOriginalTarget() instanceof TargetAnyTarget
|
||||||
|| target.getOriginalTarget() instanceof TargetCreatureOrPlayer
|
|| target.getOriginalTarget() instanceof TargetCreatureOrPlayer
|
||||||
|| target.getOriginalTarget() instanceof TargetPermanentOrPlayer) {
|
|| target.getOriginalTarget() instanceof TargetPermanentOrPlayer) {
|
||||||
for (String targetDefinition : targets) {
|
for (String targetDefinition : targets.stream().limit(takeMaxTargetsPerChoose).collect(Collectors.toList())) {
|
||||||
if (!targetDefinition.startsWith("targetPlayer=")) {
|
if (!targetDefinition.startsWith("targetPlayer=")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -2452,7 +2454,7 @@ public class TestPlayer implements Player {
|
||||||
|| (target.getOriginalTarget() instanceof TargetAnyTarget)
|
|| (target.getOriginalTarget() instanceof TargetAnyTarget)
|
||||||
|| (target.getOriginalTarget() instanceof TargetCreatureOrPlayer)
|
|| (target.getOriginalTarget() instanceof TargetCreatureOrPlayer)
|
||||||
|| (target.getOriginalTarget() instanceof TargetPermanentOrSuspendedCard)) {
|
|| (target.getOriginalTarget() instanceof TargetPermanentOrSuspendedCard)) {
|
||||||
for (String targetDefinition : targets) {
|
for (String targetDefinition : targets.stream().limit(takeMaxTargetsPerChoose).collect(Collectors.toList())) {
|
||||||
if (targetDefinition.startsWith("targetPlayer=")) {
|
if (targetDefinition.startsWith("targetPlayer=")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -2508,7 +2510,7 @@ public class TestPlayer implements Player {
|
||||||
|| target.getOriginalTarget() instanceof TargetDiscard
|
|| target.getOriginalTarget() instanceof TargetDiscard
|
||||||
|| (target.getOriginalTarget() instanceof TargetCard && target.getOriginalTarget().getZone() == Zone.HAND)) {
|
|| (target.getOriginalTarget() instanceof TargetCard && target.getOriginalTarget().getZone() == Zone.HAND)) {
|
||||||
targetCardZonesChecked.add(Zone.HAND);
|
targetCardZonesChecked.add(Zone.HAND);
|
||||||
for (String targetDefinition : targets) {
|
for (String targetDefinition : targets.stream().limit(takeMaxTargetsPerChoose).collect(Collectors.toList())) {
|
||||||
checkTargetDefinitionMarksSupport(target, targetDefinition, "^");
|
checkTargetDefinitionMarksSupport(target, targetDefinition, "^");
|
||||||
String[] targetList = targetDefinition.split("\\^");
|
String[] targetList = targetDefinition.split("\\^");
|
||||||
boolean targetFound = false;
|
boolean targetFound = false;
|
||||||
|
|
@ -2546,7 +2548,7 @@ public class TestPlayer implements Player {
|
||||||
+ target.getOriginalTarget().getClass().getCanonicalName());
|
+ target.getOriginalTarget().getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String targetDefinition : targets) {
|
for (String targetDefinition : targets.stream().limit(takeMaxTargetsPerChoose).collect(Collectors.toList())) {
|
||||||
checkTargetDefinitionMarksSupport(target, targetDefinition, "^");
|
checkTargetDefinitionMarksSupport(target, targetDefinition, "^");
|
||||||
String[] targetList = targetDefinition.split("\\^");
|
String[] targetList = targetDefinition.split("\\^");
|
||||||
boolean targetFound = false;
|
boolean targetFound = false;
|
||||||
|
|
@ -2571,7 +2573,7 @@ public class TestPlayer implements Player {
|
||||||
// card in battlefield
|
// card in battlefield
|
||||||
if (target instanceof TargetCardInGraveyardBattlefieldOrStack) {
|
if (target instanceof TargetCardInGraveyardBattlefieldOrStack) {
|
||||||
TargetCard targetFull = (TargetCard) target;
|
TargetCard targetFull = (TargetCard) target;
|
||||||
for (String targetDefinition : targets) {
|
for (String targetDefinition : targets.stream().limit(takeMaxTargetsPerChoose).collect(Collectors.toList())) {
|
||||||
checkTargetDefinitionMarksSupport(target, targetDefinition, "^");
|
checkTargetDefinitionMarksSupport(target, targetDefinition, "^");
|
||||||
String[] targetList = targetDefinition.split("\\^");
|
String[] targetList = targetDefinition.split("\\^");
|
||||||
boolean targetFound = false;
|
boolean targetFound = false;
|
||||||
|
|
@ -2619,7 +2621,7 @@ public class TestPlayer implements Player {
|
||||||
Assert.assertEquals(1, needPlayers.size());
|
Assert.assertEquals(1, needPlayers.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String targetDefinition : targets) {
|
for (String targetDefinition : targets.stream().limit(takeMaxTargetsPerChoose).collect(Collectors.toList())) {
|
||||||
checkTargetDefinitionMarksSupport(target, targetDefinition, "^");
|
checkTargetDefinitionMarksSupport(target, targetDefinition, "^");
|
||||||
|
|
||||||
String[] targetList = targetDefinition.split("\\^");
|
String[] targetList = targetDefinition.split("\\^");
|
||||||
|
|
@ -2650,7 +2652,7 @@ public class TestPlayer implements Player {
|
||||||
|
|
||||||
// stack
|
// stack
|
||||||
if (target.getOriginalTarget() instanceof TargetSpell) {
|
if (target.getOriginalTarget() instanceof TargetSpell) {
|
||||||
for (String targetDefinition : targets) {
|
for (String targetDefinition : targets.stream().limit(takeMaxTargetsPerChoose).collect(Collectors.toList())) {
|
||||||
checkTargetDefinitionMarksSupport(target, targetDefinition, "^");
|
checkTargetDefinitionMarksSupport(target, targetDefinition, "^");
|
||||||
String[] targetList = targetDefinition.split("\\^");
|
String[] targetList = targetDefinition.split("\\^");
|
||||||
boolean targetFound = false;
|
boolean targetFound = false;
|
||||||
|
|
@ -2730,7 +2732,7 @@ public class TestPlayer implements Player {
|
||||||
targets.remove(0);
|
targets.remove(0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (String targetDefinition : targets) {
|
for (String targetDefinition : targets.stream().limit(takeMaxTargetsPerChoose).collect(Collectors.toList())) {
|
||||||
String[] targetList = targetDefinition.split("\\^");
|
String[] targetList = targetDefinition.split("\\^");
|
||||||
boolean targetFound = false;
|
boolean targetFound = false;
|
||||||
for (String targetName : targetList) {
|
for (String targetName : targetList) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue