mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 12:22:10 -08:00
* Some rework/clean up of the PlayFromNotOwnHandZone effects (fixes #6580). Some added tests.
This commit is contained in:
parent
8e4d966ff3
commit
85709c0a16
29 changed files with 465 additions and 797 deletions
|
|
@ -267,4 +267,166 @@ public class PlayFromNonHandZoneTest extends CardTestPlayerBase {
|
|||
assertActivePlayer(playerA);
|
||||
}
|
||||
|
||||
/**
|
||||
* #6580
|
||||
* Fallen Shinobi - In the second log, when Tormenting Voice is cast first,
|
||||
* the discard was required. In the first log, when it was cast after
|
||||
* Angelic Purge the discard was not required.
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void castFromExileButWithAdditionalCostTest() {
|
||||
// Ninjutsu {2}{U}{B}
|
||||
// Whenever Fallen Shinobi deals combat damage to a player, that player exiles the top two cards
|
||||
// of their library. Until end of turn, you may play those cards without paying their mana cost.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Fallen Shinobi", 1); // Creature 5/4
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
|
||||
addCard(Zone.HAND, playerB, "Pillarfield Ox");
|
||||
|
||||
addCard(Zone.LIBRARY, playerB, "Pillarfield Ox"); // Card to draw on turn 2
|
||||
// As an additional cost to cast Tormenting Voice, discard a card.
|
||||
// Draw two cards.
|
||||
addCard(Zone.LIBRARY, playerA, "Tormenting Voice"); // Sorcery {1}{R}
|
||||
// As an additional cost to cast this spell, sacrifice a creature.
|
||||
// Flying, Trample
|
||||
addCard(Zone.LIBRARY, playerA, "Demon of Catastrophes"); // Creature {2}{B}{B} 6/6
|
||||
|
||||
skipInitShuffling();
|
||||
|
||||
attack(2, playerB, "Fallen Shinobi");
|
||||
|
||||
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Tormenting Voice");
|
||||
setChoice(playerB, "Pillarfield Ox"); // Discord for Tormenting Voice
|
||||
|
||||
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Demon of Catastrophes");
|
||||
setChoice(playerB, "Silvercoat Lion"); // Sacrifice for Demon
|
||||
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertLife(playerA, 15);
|
||||
assertPermanentCount(playerB, "Fallen Shinobi", 1);
|
||||
|
||||
assertGraveyardCount(playerA, "Tormenting Voice", 1);
|
||||
assertGraveyardCount(playerB, "Pillarfield Ox", 1); // Discarded for Tormenting Voice
|
||||
|
||||
|
||||
assertPermanentCount(playerB, "Demon of Catastrophes", 1);
|
||||
assertGraveyardCount(playerB, "Silvercoat Lion", 1); // sacrificed for Demon
|
||||
|
||||
assertHandCount(playerB, "Pillarfield Ox", 1);
|
||||
assertHandCount(playerB, 3); // 2 from Tormenting Voice + 1 from Turn 2
|
||||
assertExileCount(playerA, 0); // Both exiled cards are cast
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void castFromExileButWithAdditionalCost2Test() {
|
||||
// Ninjutsu {2}{U}{B}
|
||||
// Whenever Fallen Shinobi deals combat damage to a player, that player exiles the top two cards
|
||||
// of their library. Until end of turn, you may play those cards without paying their mana cost.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Fallen Shinobi", 1); // Creature 5/4
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
|
||||
addCard(Zone.HAND, playerB, "Pillarfield Ox");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Amulet of Kroog"); // Just to exile for Angelic Purge
|
||||
|
||||
// As an additional cost to cast Tormenting Voice, discard a card.
|
||||
// Draw two cards.
|
||||
addCard(Zone.LIBRARY, playerA, "Tormenting Voice"); // Sorcery {1}{R}
|
||||
|
||||
// As an additional cost to cast Angelic Purge, sacrifice a permanent.
|
||||
// Exile target artifact, creature, or enchantment.
|
||||
addCard(Zone.LIBRARY, playerA, "Angelic Purge"); // Sorcery {2}{W}
|
||||
|
||||
skipInitShuffling();
|
||||
|
||||
attack(2, playerB, "Fallen Shinobi");
|
||||
|
||||
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Angelic Purge");
|
||||
setChoice(playerB, "Silvercoat Lion"); // Sacrifice for Purge
|
||||
addTarget(playerB, "Amulet of Kroog"); // Exile with Purge
|
||||
|
||||
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Tormenting Voice");
|
||||
setChoice(playerB, "Pillarfield Ox"); // Discord for Tormenting Voice
|
||||
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertLife(playerA, 15);
|
||||
assertPermanentCount(playerB, "Fallen Shinobi", 1);
|
||||
|
||||
assertGraveyardCount(playerA, "Angelic Purge", 1);
|
||||
assertGraveyardCount(playerB, "Silvercoat Lion", 1); // sacrificed for Purge
|
||||
|
||||
assertGraveyardCount(playerA, "Tormenting Voice", 1);
|
||||
assertGraveyardCount(playerB, "Pillarfield Ox", 1); // Discarded for Tormenting Voice
|
||||
|
||||
assertHandCount(playerB, 3); // 2 from Tormenting Voice + 1 from Turn 2 draw
|
||||
|
||||
assertExileCount(playerA, 1); // Both exiled cards are cast
|
||||
assertExileCount(playerA, "Amulet of Kroog", 1); // Exiled with Purge
|
||||
}
|
||||
|
||||
@Test
|
||||
public void castAdventureWithFallenShinobiTest() {
|
||||
// Ninjutsu {2}{U}{B}
|
||||
// Whenever Fallen Shinobi deals combat damage to a player, that player exiles the top two cards
|
||||
// of their library. Until end of turn, you may play those cards without paying their mana cost.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Fallen Shinobi", 1); // Creature 5/4
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Amulet of Kroog"); // Just to exile for Angelic Purge
|
||||
|
||||
/* Curious Pair {1}{G}
|
||||
* Creature — Human Peasant
|
||||
* 1/3
|
||||
* ----
|
||||
* Treats to Share {G}
|
||||
* Sorcery — Adventure
|
||||
* Create a Food token.
|
||||
*/
|
||||
addCard(Zone.LIBRARY, playerA, "Curious Pair");
|
||||
|
||||
// As an additional cost to cast Angelic Purge, sacrifice a permanent.
|
||||
// Exile target artifact, creature, or enchantment.
|
||||
addCard(Zone.LIBRARY, playerA, "Angelic Purge"); // Sorcery {2}{W}
|
||||
|
||||
skipInitShuffling();
|
||||
|
||||
attack(2, playerB, "Fallen Shinobi");
|
||||
|
||||
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Angelic Purge");
|
||||
setChoice(playerB, "Silvercoat Lion"); // Sacrifice for Purge
|
||||
addTarget(playerB, "Amulet of Kroog"); // Exile with Purge
|
||||
|
||||
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Treats to Share");
|
||||
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertLife(playerA, 15);
|
||||
assertPermanentCount(playerB, "Fallen Shinobi", 1);
|
||||
|
||||
assertGraveyardCount(playerA, "Angelic Purge", 1);
|
||||
assertGraveyardCount(playerB, "Silvercoat Lion", 1); // sacrificed for Purge
|
||||
|
||||
assertPermanentCount(playerB, "Food", 1);
|
||||
assertExileCount(playerA, "Curious Pair", 1);
|
||||
|
||||
assertHandCount(playerB, 1); // 1 from Turn 2 draw
|
||||
|
||||
assertExileCount(playerA, 2); // Both exiled cards are cast
|
||||
assertExileCount(playerA, "Amulet of Kroog", 1); // Exiled with Purge
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,12 +80,12 @@ public class CastSplitCardsWithFuseTest extends CardTestPlayerBase {
|
|||
addCard(Zone.BATTLEFIELD, playerB, "Absolute Grace"); // Enchantment
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Juggernaut"); // Artifact
|
||||
|
||||
showAvaileableAbilities("abils", 1, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
// showAvaileableAbilities("abils", 1, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "fused Wear // Tear");
|
||||
addTarget(playerA, "Juggernaut");
|
||||
addTarget(playerA, "Absolute Grace");
|
||||
//playerA.addTarget("Absolute Grace");
|
||||
showBattlefield("after", 1, PhaseStep.BEGIN_COMBAT, playerB);
|
||||
// showBattlefield("after", 1, PhaseStep.BEGIN_COMBAT, playerB);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ public class TidehollowScullerTest extends CardTestPlayerBase {
|
|||
for (int i = 1; i <= 10; i++) {
|
||||
try {
|
||||
this.reset();
|
||||
System.out.println("run " + i);
|
||||
// System.out.println("run " + i);
|
||||
test_CastTwoCardFromHandWillBeExiled();
|
||||
} catch (Exception e) {
|
||||
//
|
||||
|
|
|
|||
|
|
@ -359,7 +359,7 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isAbilityHaveTargetNameOrAlias(Game game, Ability ability, String nameOrAlias) {
|
||||
public boolean hasAbilityTargetNameOrAlias(Game game, Ability ability, String nameOrAlias) {
|
||||
// use cases:
|
||||
// * Cast cardName with extra
|
||||
// * Cast @ref
|
||||
|
|
@ -379,7 +379,7 @@ public class TestPlayer implements Player {
|
|||
foundObject = true;
|
||||
foundAbility = ability.toString().startsWith(nameOrAlias);
|
||||
} else {
|
||||
foundObject = isObjectHaveTargetNameOrAlias(game.getObject(ability.getSourceId()), searchObject);
|
||||
foundObject = hasObjectTargetNameOrAlias(game.getObject(ability.getSourceId()), searchObject);
|
||||
foundAbility = searchObject.startsWith(ALIAS_PREFIX) || ability.toString().startsWith(nameOrAlias);
|
||||
}
|
||||
} else if (nameOrAlias.startsWith(ALIAS_PREFIX)) {
|
||||
|
|
@ -388,7 +388,7 @@ public class TestPlayer implements Player {
|
|||
Assert.assertTrue("ability alias must contains space", nameOrAlias.contains(" "));
|
||||
String searchObject = nameOrAlias.substring(0, nameOrAlias.indexOf(" "));
|
||||
String searchAbility = nameOrAlias.substring(nameOrAlias.indexOf(" ") + 1);
|
||||
foundObject = isObjectHaveTargetNameOrAlias(game.getObject(ability.getSourceId()), searchObject);
|
||||
foundObject = hasObjectTargetNameOrAlias(game.getObject(ability.getSourceId()), searchObject);
|
||||
foundAbility = ability.toString().startsWith(searchAbility);
|
||||
} else {
|
||||
// ability text
|
||||
|
|
@ -399,7 +399,7 @@ public class TestPlayer implements Player {
|
|||
return foundObject && foundAbility;
|
||||
}
|
||||
|
||||
public boolean isObjectHaveTargetNameOrAlias(MageObject object, String nameOrAlias) {
|
||||
public boolean hasObjectTargetNameOrAlias(MageObject object, String nameOrAlias) {
|
||||
if (object == null || nameOrAlias == null) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -505,7 +505,7 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
// need by alias or by name
|
||||
if (!isObjectHaveTargetNameOrAlias(object, targetName)) {
|
||||
if (!hasObjectTargetNameOrAlias(object, targetName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -578,7 +578,7 @@ public class TestPlayer implements Player {
|
|||
break;
|
||||
}
|
||||
for (ActivatedAbility ability : computerPlayer.getPlayable(game, true)) { // add wrong action log?
|
||||
if (isAbilityHaveTargetNameOrAlias(game, ability, groups[0])) {
|
||||
if (hasAbilityTargetNameOrAlias(game, ability, groups[0])) {
|
||||
int bookmark = game.bookmarkState();
|
||||
ActivatedAbility newAbility = ability.copy();
|
||||
if (groups.length > 1 && !groups[1].equals("target=" + NO_TARGET)) {
|
||||
|
|
@ -606,7 +606,7 @@ public class TestPlayer implements Player {
|
|||
for (MageObject mageObject : manaObjects) {
|
||||
if (mageObject instanceof Permanent) {
|
||||
for (Ability manaAbility : ((Permanent) mageObject).getAbilities(game).getAvailableActivatedManaAbilities(Zone.BATTLEFIELD, game)) {
|
||||
if (isAbilityHaveTargetNameOrAlias(game, manaAbility, groups[0])) {
|
||||
if (hasAbilityTargetNameOrAlias(game, manaAbility, groups[0])) {
|
||||
Ability newManaAbility = manaAbility.copy();
|
||||
computerPlayer.activateAbility((ActivatedAbility) newManaAbility, game);
|
||||
actions.remove(action);
|
||||
|
|
@ -615,7 +615,7 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
} else if (mageObject instanceof Card) {
|
||||
for (Ability manaAbility : ((Card) mageObject).getAbilities(game).getAvailableActivatedManaAbilities(game.getState().getZone(mageObject.getId()), game)) {
|
||||
if (isAbilityHaveTargetNameOrAlias(game, manaAbility, groups[0])) {
|
||||
if (hasAbilityTargetNameOrAlias(game, manaAbility, groups[0])) {
|
||||
Ability newManaAbility = manaAbility.copy();
|
||||
computerPlayer.activateAbility((ActivatedAbility) newManaAbility, game);
|
||||
actions.remove(action);
|
||||
|
|
@ -624,7 +624,7 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
} else {
|
||||
for (Ability manaAbility : mageObject.getAbilities().getAvailableActivatedManaAbilities(game.getState().getZone(mageObject.getId()), game)) {
|
||||
if (isAbilityHaveTargetNameOrAlias(game, manaAbility, groups[0])) {
|
||||
if (hasAbilityTargetNameOrAlias(game, manaAbility, groups[0])) {
|
||||
Ability newManaAbility = manaAbility.copy();
|
||||
computerPlayer.activateAbility((ActivatedAbility) newManaAbility, game);
|
||||
actions.remove(action);
|
||||
|
|
@ -636,7 +636,7 @@ public class TestPlayer implements Player {
|
|||
List<Permanent> manaPermsWithCost = computerPlayer.getAvailableManaProducersWithCost(game);
|
||||
for (Permanent perm : manaPermsWithCost) {
|
||||
for (ActivatedManaAbilityImpl manaAbility : perm.getAbilities().getAvailableActivatedManaAbilities(Zone.BATTLEFIELD, game)) {
|
||||
if (isAbilityHaveTargetNameOrAlias(game, manaAbility, groups[0])
|
||||
if (hasAbilityTargetNameOrAlias(game, manaAbility, groups[0])
|
||||
&& manaAbility.canActivate(computerPlayer.getId(), game).canActivate()) {
|
||||
Ability newManaAbility = manaAbility.copy();
|
||||
computerPlayer.activateAbility((ActivatedAbility) newManaAbility, game);
|
||||
|
|
@ -650,7 +650,7 @@ public class TestPlayer implements Player {
|
|||
command = command.substring(command.indexOf("addCounters:") + 12);
|
||||
String[] groups = command.split("\\$");
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) {
|
||||
if (isObjectHaveTargetNameOrAlias(permanent, groups[0])) {
|
||||
if (hasObjectTargetNameOrAlias(permanent, groups[0])) {
|
||||
CounterType counterType = CounterType.findByName(groups[1]);
|
||||
Assert.assertNotNull("Invalid counter type " + groups[1], counterType);
|
||||
Counter counter = counterType.createInstance(Integer.parseInt(groups[2]));
|
||||
|
|
@ -989,7 +989,7 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
// need by alias or by name
|
||||
if (!isObjectHaveTargetNameOrAlias(perm, cardName)) {
|
||||
if (!hasObjectTargetNameOrAlias(perm, cardName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -1198,7 +1198,7 @@ public class TestPlayer implements Player {
|
|||
private void assertPermanentCount(PlayerAction action, Game game, Player player, String permanentName, int count) {
|
||||
int foundedCount = 0;
|
||||
for (Permanent perm : game.getBattlefield().getAllPermanents()) {
|
||||
if (isObjectHaveTargetNameOrAlias(perm, permanentName) && perm.getControllerId().equals(player.getId())) {
|
||||
if (hasObjectTargetNameOrAlias(perm, permanentName) && perm.getControllerId().equals(player.getId())) {
|
||||
foundedCount++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1209,7 +1209,7 @@ public class TestPlayer implements Player {
|
|||
private void assertPermanentCounters(PlayerAction action, Game game, Player player, String permanentName, CounterType counterType, int count) {
|
||||
int foundedCount = 0;
|
||||
for (Permanent perm : game.getBattlefield().getAllPermanents()) {
|
||||
if (isObjectHaveTargetNameOrAlias(perm, permanentName) && perm.getControllerId().equals(player.getId())) {
|
||||
if (hasObjectTargetNameOrAlias(perm, permanentName) && perm.getControllerId().equals(player.getId())) {
|
||||
foundedCount = perm.getCounters(game).getCount(counterType);
|
||||
}
|
||||
}
|
||||
|
|
@ -1220,7 +1220,7 @@ public class TestPlayer implements Player {
|
|||
private void assertExileCount(PlayerAction action, Game game, Player player, String permanentName, int count) {
|
||||
int foundedCount = 0;
|
||||
for (Card card : game.getExile().getAllCards(game)) {
|
||||
if (isObjectHaveTargetNameOrAlias(card, permanentName) && card.isOwnedBy(player.getId())) {
|
||||
if (hasObjectTargetNameOrAlias(card, permanentName) && card.isOwnedBy(player.getId())) {
|
||||
foundedCount++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1231,7 +1231,7 @@ public class TestPlayer implements Player {
|
|||
private void assertGraveyardCount(PlayerAction action, Game game, Player player, String permanentName, int count) {
|
||||
int foundedCount = 0;
|
||||
for (Card card : player.getGraveyard().getCards(game)) {
|
||||
if (isObjectHaveTargetNameOrAlias(card, permanentName) && card.isOwnedBy(player.getId())) {
|
||||
if (hasObjectTargetNameOrAlias(card, permanentName) && card.isOwnedBy(player.getId())) {
|
||||
foundedCount++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1247,7 +1247,7 @@ public class TestPlayer implements Player {
|
|||
int realCount = 0;
|
||||
for (UUID cardId : player.getHand()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (isObjectHaveTargetNameOrAlias(card, cardName)) {
|
||||
if (hasObjectTargetNameOrAlias(card, cardName)) {
|
||||
realCount++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1259,7 +1259,7 @@ public class TestPlayer implements Player {
|
|||
int realCount = 0;
|
||||
for (UUID cardId : game.getCommandersIds(player)) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (isObjectHaveTargetNameOrAlias(card, cardName) && Zone.COMMAND.equals(game.getState().getZone(cardId))) {
|
||||
if (hasObjectTargetNameOrAlias(card, cardName) && Zone.COMMAND.equals(game.getState().getZone(cardId))) {
|
||||
realCount++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1476,7 +1476,7 @@ public class TestPlayer implements Player {
|
|||
if (group.startsWith("planeswalker=")) {
|
||||
String planeswalkerName = group.substring(group.indexOf("planeswalker=") + 13);
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_PLANESWALKER, game)) {
|
||||
if (isObjectHaveTargetNameOrAlias(permanent, planeswalkerName)) {
|
||||
if (hasObjectTargetNameOrAlias(permanent, planeswalkerName)) {
|
||||
defenderId = permanent.getId();
|
||||
}
|
||||
}
|
||||
|
|
@ -1832,7 +1832,7 @@ public class TestPlayer implements Player {
|
|||
if (target.getTargets().contains(permanent.getId())) {
|
||||
continue;
|
||||
}
|
||||
if (isObjectHaveTargetNameOrAlias(permanent, targetName)) {
|
||||
if (hasObjectTargetNameOrAlias(permanent, targetName)) {
|
||||
if (target.isNotTarget() || target.canTarget(abilityControllerId, permanent.getId(), source, game)) {
|
||||
if ((permanent.isCopy() && !originOnly) || (!permanent.isCopy() && !copyOnly)) {
|
||||
target.add(permanent.getId(), game);
|
||||
|
|
@ -1897,7 +1897,7 @@ public class TestPlayer implements Player {
|
|||
CheckTargetsList:
|
||||
for (UUID targetId : possibleCards) {
|
||||
MageObject targetObject = game.getObject(targetId);
|
||||
if (isObjectHaveTargetNameOrAlias(targetObject, possibleChoice)) {
|
||||
if (hasObjectTargetNameOrAlias(targetObject, possibleChoice)) {
|
||||
if (target.canTarget(targetObject.getId(), game)) {
|
||||
// only unique targets
|
||||
if (usedTargets.contains(targetObject.getId())) {
|
||||
|
|
@ -1950,7 +1950,7 @@ public class TestPlayer implements Player {
|
|||
for (UUID targetId : possibleTargets) {
|
||||
MageObject targetObject = game.getObject(targetId);
|
||||
if (targetObject != null) {
|
||||
if (isObjectHaveTargetNameOrAlias(targetObject, targetName)) {
|
||||
if (hasObjectTargetNameOrAlias(targetObject, targetName)) {
|
||||
List<UUID> alreadyTargetted = target.getTargets();
|
||||
if (t.canTarget(targetObject.getId(), game)) {
|
||||
if (alreadyTargetted != null && !alreadyTargetted.contains(targetObject.getId())) {
|
||||
|
|
@ -2086,7 +2086,7 @@ public class TestPlayer implements Player {
|
|||
filter = ((FilterPlaneswalkerOrPlayer) filter).getFilterPermanent();
|
||||
}
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents((FilterPermanent) filter, abilityControllerId, sourceId, game)) {
|
||||
if (isObjectHaveTargetNameOrAlias(permanent, targetName) || (permanent.getName() + '-' + permanent.getExpansionSetCode()).equals(targetName)) { // TODO: remove exp code search?
|
||||
if (hasObjectTargetNameOrAlias(permanent, targetName) || (permanent.getName() + '-' + permanent.getExpansionSetCode()).equals(targetName)) { // TODO: remove exp code search?
|
||||
if (target.canTarget(abilityControllerId, permanent.getId(), source, game) && !target.getTargets().contains(permanent.getId())) {
|
||||
if ((permanent.isCopy() && !originOnly) || (!permanent.isCopy() && !copyOnly)) {
|
||||
target.addTarget(permanent.getId(), source, game);
|
||||
|
|
@ -2112,7 +2112,7 @@ public class TestPlayer implements Player {
|
|||
boolean targetFound = false;
|
||||
for (String targetName : targetList) {
|
||||
for (Card card : computerPlayer.getHand().getCards(((TargetCardInHand) target.getOriginalTarget()).getFilter(), game)) {
|
||||
if (isObjectHaveTargetNameOrAlias(card, targetName) || (card.getName() + '-' + card.getExpansionSetCode()).equals(targetName)) { // TODO: remove set code search?
|
||||
if (hasObjectTargetNameOrAlias(card, targetName) || (card.getName() + '-' + card.getExpansionSetCode()).equals(targetName)) { // TODO: remove set code search?
|
||||
if (target.canTarget(abilityControllerId, card.getId(), source, game) && !target.getTargets().contains(card.getId())) {
|
||||
target.addTarget(card.getId(), source, game);
|
||||
targetFound = true;
|
||||
|
|
@ -2137,7 +2137,7 @@ public class TestPlayer implements Player {
|
|||
boolean targetFound = false;
|
||||
for (String targetName : targetList) {
|
||||
for (Card card : game.getExile().getCards(targetFull.getFilter(), game)) {
|
||||
if (isObjectHaveTargetNameOrAlias(card, targetName) || (card.getName() + '-' + card.getExpansionSetCode()).equals(targetName)) { // TODO: remove set code search?
|
||||
if (hasObjectTargetNameOrAlias(card, targetName) || (card.getName() + '-' + card.getExpansionSetCode()).equals(targetName)) { // TODO: remove set code search?
|
||||
if (target.canTarget(abilityControllerId, card.getId(), source, game) && !target.getTargets().contains(card.getId())) {
|
||||
target.addTarget(card.getId(), source, game);
|
||||
targetFound = true;
|
||||
|
|
@ -2162,7 +2162,7 @@ public class TestPlayer implements Player {
|
|||
boolean targetFound = false;
|
||||
for (String targetName : targetList) {
|
||||
for (Card card : game.getBattlefield().getAllActivePermanents()) {
|
||||
if (isObjectHaveTargetNameOrAlias(card, targetName) || (card.getName() + '-' + card.getExpansionSetCode()).equals(targetName)) { // TODO: remove set code search?
|
||||
if (hasObjectTargetNameOrAlias(card, targetName) || (card.getName() + '-' + card.getExpansionSetCode()).equals(targetName)) { // TODO: remove set code search?
|
||||
if (targetFull.canTarget(abilityControllerId, card.getId(), source, game) && !targetFull.getTargets().contains(card.getId())) {
|
||||
targetFull.add(card.getId(), game);
|
||||
targetFound = true;
|
||||
|
|
@ -2212,7 +2212,7 @@ public class TestPlayer implements Player {
|
|||
for (UUID playerId : needPlayers) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
for (Card card : player.getGraveyard().getCards(targetFull.getFilter(), game)) {
|
||||
if (isObjectHaveTargetNameOrAlias(card, targetName) || (card.getName() + '-' + card.getExpansionSetCode()).equals(targetName)) { // TODO: remove set code search?
|
||||
if (hasObjectTargetNameOrAlias(card, targetName) || (card.getName() + '-' + card.getExpansionSetCode()).equals(targetName)) { // TODO: remove set code search?
|
||||
if (target.canTarget(abilityControllerId, card.getId(), source, game) && !target.getTargets().contains(card.getId())) {
|
||||
target.addTarget(card.getId(), source, game);
|
||||
targetFound = true;
|
||||
|
|
@ -2239,7 +2239,7 @@ public class TestPlayer implements Player {
|
|||
boolean targetFound = false;
|
||||
for (String targetName : targetList) {
|
||||
for (StackObject stackObject : game.getStack()) {
|
||||
if (isObjectHaveTargetNameOrAlias(stackObject, targetName)) {
|
||||
if (hasObjectTargetNameOrAlias(stackObject, targetName)) {
|
||||
if (target.canTarget(abilityControllerId, stackObject.getId(), source, game) && !target.getTargets().contains(stackObject.getId())) {
|
||||
target.addTarget(stackObject.getId(), source, game);
|
||||
targetFound = true;
|
||||
|
|
@ -2289,7 +2289,7 @@ public class TestPlayer implements Player {
|
|||
boolean targetFound = false;
|
||||
for (String targetName : targetList) {
|
||||
for (Card card : cards.getCards(game)) {
|
||||
if (isObjectHaveTargetNameOrAlias(card, targetName) && !target.getTargets().contains(card.getId())) {
|
||||
if (hasObjectTargetNameOrAlias(card, targetName) && !target.getTargets().contains(card.getId())) {
|
||||
target.addTarget(card.getId(), source, game);
|
||||
targetFound = true;
|
||||
break;
|
||||
|
|
@ -3517,7 +3517,7 @@ public class TestPlayer implements Player {
|
|||
if (target.getTargets().contains(card.getId())) {
|
||||
continue;
|
||||
}
|
||||
if (isObjectHaveTargetNameOrAlias(card, targetName)) {
|
||||
if (hasObjectTargetNameOrAlias(card, targetName)) {
|
||||
if (target.isNotTarget() || target.canTarget(card.getId(), game)) {
|
||||
target.add(card.getId(), game);
|
||||
targetFound = true;
|
||||
|
|
|
|||
|
|
@ -1819,7 +1819,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
private boolean isObjectHaveTargetNameOrAlias(Player player, MageObject object, String nameOrAlias) {
|
||||
TestPlayer testPlayer = (TestPlayer) player;
|
||||
if (player != null) { // TODO: remove null check and replace all null-player calls in tests by player
|
||||
return testPlayer.isObjectHaveTargetNameOrAlias(object, nameOrAlias);
|
||||
return testPlayer.hasObjectTargetNameOrAlias(object, nameOrAlias);
|
||||
} else {
|
||||
return object.getName().equals(nameOrAlias);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue