* Added UT for #3244. Not able to reproduce the problem.

This commit is contained in:
LevelX2 2017-05-17 12:53:00 +02:00
parent 85c394c29b
commit 020c66c6a1
5 changed files with 398 additions and 49 deletions

View file

@ -55,10 +55,10 @@ import mage.watchers.common.PlayerLostLifeWatcher;
*/
public class LuminarchAscension extends CardImpl {
private String rule = "At the beginning of each opponent's end step, if you didn't lose life this turn, you may put a quest counter on Luminarch Ascension. (Damage causes loss of life.)";
private String rule = "At the beginning of each opponent's end step, if you didn't lose life this turn, you may put a quest counter on {this}. (Damage causes loss of life.)";
public LuminarchAscension(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{W}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
// At the beginning of each opponent's end step, if you didn't lose life this turn, you may put a quest counter on Luminarch Ascension.
this.addAbility(new ConditionalTriggeredAbility(new LuminarchAscensionTriggeredAbility(), YouLostNoLifeThisTurnCondition.instance, rule));
@ -141,7 +141,6 @@ class SourceHasCountersCost extends CostImpl {
enum YouLostNoLifeThisTurnCondition implements Condition {
instance;
@Override

View file

@ -0,0 +1,301 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package org.mage.test.multiplayer;
import java.io.FileNotFoundException;
import mage.constants.MultiplayerAttackOption;
import mage.constants.PhaseStep;
import mage.constants.RangeOfInfluence;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.FreeForAll;
import mage.game.Game;
import mage.game.GameException;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestMultiPlayerBase;
/**
*
* @author LevelX2
*/
public class PlayerLeftGameRange1Test extends CardTestMultiPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
// Start Life = 2
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ONE, 0, 2);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, playerA, "PlayerA");
playerB = createPlayer(game, playerB, "PlayerB");
playerC = createPlayer(game, playerC, "PlayerC");
playerD = createPlayer(game, playerD, "PlayerD");
return game;
}
/**
* Tests Enchantment to control other permanent
*/
@Test
public void TestControlledByEnchantment() {
addCard(Zone.BATTLEFIELD, playerB, "Rootwater Commando");
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
// Enchant creature
// You control enchanted creature.
addCard(Zone.HAND, playerA, "Control Magic");
addCard(Zone.BATTLEFIELD, playerC, "Silvercoat Lion");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Control Magic", "Rootwater Commando");
attack(3, playerC, "Silvercoat Lion", playerB);
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertLife(playerB, 0);
assertPermanentCount(playerB, 0);
assertPermanentCount(playerA, "Rootwater Commando", 0);
assertGraveyardCount(playerA, "Control Magic", 1);
}
/**
* Tests Sorcery to control other players permanent
*/
@Test
public void TestControlledBySorcery() {
addCard(Zone.BATTLEFIELD, playerB, "Rootwater Commando");
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
// Exchange control of target artifact or creature and another target permanent that shares one of those types with it.
// (This effect lasts indefinitely.)
addCard(Zone.HAND, playerA, "Legerdemain"); // Sorcery
addCard(Zone.BATTLEFIELD, playerA, "Wall of Air");
addCard(Zone.BATTLEFIELD, playerC, "Silvercoat Lion");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Legerdemain", "Rootwater Commando^Wall of Air");
attack(3, playerC, "Silvercoat Lion", playerB);
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertLife(playerB, 0);
assertGraveyardCount(playerA, "Legerdemain", 1);
assertPermanentCount(playerB, 0);
assertPermanentCount(playerA, "Rootwater Commando", 0); // removed from game because player B left
assertPermanentCount(playerB, "Wall of Air", 0);
assertGraveyardCount(playerA, "Wall of Air", 0);
assertPermanentCount(playerA, "Wall of Air", 1); // Returned back to player A
}
/**
* Tests Instant to control other permanent
*/
@Test
public void TestOtherPlayerControllsCreature() {
addCard(Zone.BATTLEFIELD, playerB, "Rootwater Commando");
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
// Untap target nonlegendary creature and gain control of it until end of turn. That creature gains haste until end of turn.
addCard(Zone.HAND, playerA, "Blind with Anger"); // Instant
addCard(Zone.BATTLEFIELD, playerC, "Silvercoat Lion");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Blind with Anger", "Rootwater Commando");
attack(3, playerC, "Silvercoat Lion", playerB);
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertLife(playerB, 0);
assertGraveyardCount(playerA, "Blind with Anger", 1);
assertPermanentCount(playerB, 0);
assertPermanentCount(playerA, "Rootwater Commando", 0); // Removed from game because player C left
assertPermanentCount(playerA, "Rootwater Commando", 0); // Returned back to player A
}
/**
* Xmage throws an error involving an emblem unable to find the initial
* source if it has a proc. To reproduce, a Planeswalker was taken from an
* original player's control, such as using Scrambleverse to shuffle Jace,
* Unraveler of Secrets, to a second player and then the second player uses
* Jace's ability to create an emblem ("Whenever an opponent casts his or
* her first spell each turn, counter that spell."). Then the original
* player concedes the game and removes the Planeswalker. Once it becomes an
* opponent of the original player's turn and that opponent plays a spell,
* Xmage throws an error and rollsback the turn.
*
* I don't have the actual error report on my due to negligence, but what I
* can recollect is that the error message was along the lines of "The
* emblem cannot find the original source. This turn will be rolled back".
* This error message will always appear when an opponent tries to play a
* spell. Player order: A -> D -> C -> B
*/
@Test
public void TestOtherPlayerPlaneswalkerCreatedEmblem() {
// +1: Scry 1, then draw a card.
// -2: Return target creature to its owner's hand.
// -8: You get an emblem with "Whenever an opponent casts his or her first spell each turn, counter that spell."
addCard(Zone.BATTLEFIELD, playerB, "Jace, Unraveler of Secrets");
addCounters(1, PhaseStep.DRAW, playerB, "Jace, Unraveler of Secrets", CounterType.LOYALTY, 8);
addCard(Zone.BATTLEFIELD, playerA, "Island", 6);
// Enchant permanent (Target a permanent as you cast this. This card enters the battlefield attached to that permanent.)
// You control enchanted permanent.
addCard(Zone.HAND, playerA, "Confiscate"); // Enchantment Aura
addCard(Zone.BATTLEFIELD, playerC, "Plains", 2);
addCard(Zone.HAND, playerC, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerD, "Plains", 2);
addCard(Zone.HAND, playerD, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerC, "Silvercoat Lion");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Confiscate", "Jace, Unraveler of Secrets");
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "-8: You get an emblem with");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Blind with Anger", "Rootwater Commando");
attack(3, playerC, "Silvercoat Lion", playerB);
castSpell(3, PhaseStep.POSTCOMBAT_MAIN, playerC, "Silvercoat Lion");
castSpell(5, PhaseStep.PRECOMBAT_MAIN, playerD, "Silvercoat Lion");
setStopAt(5, PhaseStep.END_TURN);
execute();
assertLife(playerB, 0);
assertPermanentCount(playerB, 0);
assertGraveyardCount(playerA, "Confiscate", 1);
assertPermanentCount(playerA, "Jace, Unraveler of Secrets", 0); // Removed from game because player C left the game
assertEmblemCount(playerA, 1);
assertPermanentCount(playerC, "Silvercoat Lion", 2); // Emblem does not work yet on player C, because range 1
assertGraveyardCount(playerD, "Silvercoat Lion", 1); // Emblem should counter the spell
}
/**
* Situation: I attacked an opponent with some creatures with True
* Conviction in play. There were multiple "deals combat damage to a
* player"-triggers (Edric, Spymaster of Trest, Daxos of Meletis et al),
* then the opponent lost the game during the first strike combat
* damage-step . In the second combat damage step the triggers went on the
* stack again, although there was no player being dealt damage (multiplayer
* game, so the game wasn't over yet). I don't think these abilities should
* trigger again here.
*/
@Test
public void TestPlayerDiesDuringFirstStrikeDamageStep() {
// Creatures you control have double strike and lifelink.
addCard(Zone.BATTLEFIELD, playerD, "True Conviction");
// Whenever a creature deals combat damage to one of your opponents, its controller may draw a card.
addCard(Zone.BATTLEFIELD, playerD, "Edric, Spymaster of Trest");
addCard(Zone.BATTLEFIELD, playerD, "Dross Crocodile", 8); // Creature 5/1
attack(2, playerD, "Dross Crocodile", playerC);
setStopAt(3, PhaseStep.END_TURN);
execute();
assertLife(playerC, -3);
assertLife(playerD, 7);
assertHandCount(playerD, 2); // 1 (normal draw) + 1 from True Convition
assertPermanentCount(playerC, 0);
}
/**
* I've encountered a case today where someone conceded on their turn. The
* remaining phases were went through as normal, but my Luminarch Ascension
* did not trigger during the end step.
*/
// Player order: A -> D -> C -> B
@Test
public void TestTurnEndTrigger() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
// At the beginning of each opponent's end step, if you didn't lose life this turn, you may put a quest counter on Luminarch Ascension.
// {1}{W}: Create a 4/4 white Angel creature token with flying. Activate this ability only if Luminarch Ascension has four or more quest counters on it..
addCard(Zone.HAND, playerA, "Luminarch Ascension"); // Enchantment {1}{W}
addCard(Zone.HAND, playerC, "Lightning Bolt");
addCard(Zone.BATTLEFIELD, playerC, "Mountain", 1);
addCard(Zone.HAND, playerD, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerD, "Plains", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Luminarch Ascension");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerD, "Silvercoat Lion");
castSpell(2, PhaseStep.BEGIN_COMBAT, playerC, "Lightning Bolt", playerD);
setStopAt(3, PhaseStep.PRECOMBAT_MAIN);
execute();
assertPermanentCount(playerA, "Luminarch Ascension", 1);
assertGraveyardCount(playerC, "Lightning Bolt", 1);
assertLife(playerD, -1);
Assert.assertFalse("Player D is no longer in the game", playerD.isInGame());
assertCounterCount(playerA, "Luminarch Ascension", CounterType.QUEST, 1); // 1 from turn 2
}
@Test
public void TestTurnEndTriggerAfterConcede() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
// At the beginning of each opponent's end step, if you didn't lose life this turn, you may put a quest counter on Luminarch Ascension.
// {1}{W}: Create a 4/4 white Angel creature token with flying. Activate this ability only if Luminarch Ascension has four or more quest counters on it..
addCard(Zone.HAND, playerA, "Luminarch Ascension"); // Enchantment {1}{W}
addCard(Zone.HAND, playerD, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerD, "Plains", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Luminarch Ascension");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerD, "Silvercoat Lion");
concede(2, PhaseStep.BEGIN_COMBAT, playerD);
setStopAt(3, PhaseStep.PRECOMBAT_MAIN);
execute();
assertPermanentCount(playerA, "Luminarch Ascension", 1);
assertLife(playerD, 2);
Assert.assertFalse("Player D is no longer in the game", playerD.isInGame());
assertCounterCount(playerA, "Luminarch Ascension", CounterType.QUEST, 1); // 1 from turn 2
}
}

View file

@ -36,6 +36,7 @@ import mage.counters.CounterType;
import mage.game.FreeForAll;
import mage.game.Game;
import mage.game.GameException;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestMultiPlayerBase;
@ -43,7 +44,7 @@ import org.mage.test.serverside.base.CardTestMultiPlayerBase;
*
* @author LevelX2
*/
public class PlayerLeftGameTest extends CardTestMultiPlayerBase {
public class PlayerLeftGameRangeAllTest extends CardTestMultiPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
@ -229,4 +230,40 @@ public class PlayerLeftGameTest extends CardTestMultiPlayerBase {
}
/**
* I've encountered a case today where someone conceded on their turn. The
* remaining phases were went through as normal, but my Luminarch Ascension
* did not trigger during the end step.
*/
// Player order: A -> D -> C -> B
@Test
public void TestTurnEndTrigger() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
// At the beginning of each opponent's end step, if you didn't lose life this turn, you may put a quest counter on Luminarch Ascension.
// {1}{W}: Create a 4/4 white Angel creature token with flying. Activate this ability only if Luminarch Ascension has four or more quest counters on it..
addCard(Zone.HAND, playerA, "Luminarch Ascension"); // Enchantment {1}{W}
addCard(Zone.HAND, playerC, "Lightning Bolt");
addCard(Zone.BATTLEFIELD, playerC, "Mountain", 1);
addCard(Zone.HAND, playerD, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerD, "Plains", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Luminarch Ascension");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerD, "Silvercoat Lion");
castSpell(2, PhaseStep.BEGIN_COMBAT, playerC, "Lightning Bolt", playerD);
setStopAt(3, PhaseStep.PRECOMBAT_MAIN);
execute();
assertPermanentCount(playerA, "Luminarch Ascension", 1);
assertGraveyardCount(playerC, "Lightning Bolt", 1);
assertLife(playerD, -1);
Assert.assertFalse("Player D is no longer in the game", playerD.isInGame());
assertCounterCount(playerA, "Luminarch Ascension", CounterType.QUEST, 1); // 1 from turn 2
}
}

View file

@ -31,8 +31,6 @@ import java.io.Serializable;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import mage.MageException;
import mage.MageObject;
import mage.MageObjectReference;
import mage.abilities.Abilities;
@ -168,7 +166,7 @@ public class TestPlayer implements Player {
/**
* @param maxCallsWithoutAction max number of priority passes a player may
* have for this test (default = 100)
* have for this test (default = 100)
*/
public void setMaxCallsWithoutAction(int maxCallsWithoutAction) {
this.maxCallsWithoutAction = maxCallsWithoutAction;
@ -178,32 +176,38 @@ public class TestPlayer implements Player {
initialTurns = turns;
}
private Permanent findPermanent(FilterPermanent filter, String name, UUID controllerID, Game game) {
return findPermanent(filter, name, controllerID, game, true);
}
/**
* Finds a permanent based on a general filter an their name and possible index.
* Finds a permanent based on a general filter an their name and possible
* index.
*
* An index is permitted after the permanent's name to denote their index on the battlefield
* Either use name="<permanent>" which will get the first permanent with that name on the battlefield
* that meets the filter criteria or name="<permanent>:<index>" to get the named permanent with that index on
* the battlefield.
* An index is permitted after the permanent's name to denote their index on
* the battlefield Either use name="<permanent>" which will get the first
* permanent with that name on the battlefield that meets the filter
* criteria or name="<permanent>:<index>" to get the named permanent with
* that index on the battlefield.
*
* Permanents are zero indexed in the order they entered the battlefield for each controller:
* Permanents are zero indexed in the order they entered the battlefield for
* each controller:
*
* findPermanent(new AttackingCreatureFilter(), "Human", <controllerID>, <game>)
* Will find the first "Human" creature that entered the battlefield under this controller and is attacking.
* findPermanent(new AttackingCreatureFilter(), "Human", <controllerID>,
* <game>) Will find the first "Human" creature that entered the battlefield
* under this controller and is attacking.
*
* findPermanent(new FilterControllerPermanent(), "Fabled Hero:3", <controllerID>, <game>)
* Will find the 4th permanent named "Fabled Hero" that entered the battlefield under this controller
* findPermanent(new FilterControllerPermanent(), "Fabled Hero:3",
* <controllerID>, <game>) Will find the 4th permanent named "Fabled Hero"
* that entered the battlefield under this controller
*
* An exception will be thrown if no permanents match the criteria or the index is larger than the number
* of permanents found with that name.
* An exception will be thrown if no permanents match the criteria or the
* index is larger than the number of permanents found with that name.
*
* failOnNotFound boolean controls if this function returns null for a permanent not found on the battlefield. Currently
* used only as a workaround for attackers in selectAttackers() being able to attack multiple times each combat. See issue #3038
* failOnNotFound boolean controls if this function returns null for a
* permanent not found on the battlefield. Currently used only as a
* workaround for attackers in selectAttackers() being able to attack
* multiple times each combat. See issue #3038
*/
private Permanent findPermanent(FilterPermanent filter, String name, UUID controllerID, Game game, boolean failOnNotFound) {
String filteredName = name;
@ -217,12 +221,14 @@ public class TestPlayer implements Player {
filter.add(new NamePredicate(filteredName));
List<Permanent> allPermanents = game.getBattlefield().getAllActivePermanents(filter, controllerID, game);
if (allPermanents.isEmpty()) {
if (failOnNotFound)
if (failOnNotFound) {
throw new AssertionError("No permanents found called " + filteredName + " that match the filter criteria \"" + filter.getMessage() + "\"");
}
return null;
} else if (allPermanents.size() - 1 < index) {
if (failOnNotFound)
if (failOnNotFound) {
throw new AssertionError("Cannot find " + filteredName + ":" + index + " that match the filter criteria \"" + filter.getMessage() + "\"" + ".\nOnly " + allPermanents.size() + " called " + filteredName + " found for this controller(zero indexed).");
}
return null;
}
return allPermanents.get(index);
@ -535,6 +541,10 @@ public class TestPlayer implements Player {
return true;
}
}
if (groups[0].equals("Concede")) {
game.concede(getId());
actions.remove(action);
}
}
}
}
@ -558,10 +568,10 @@ public class TestPlayer implements Player {
/*
* Iterates through each player on the current turn and asserts if they can attack or block legally this turn
*/
*/
private void checkLegalMovesThisTurn(Game game) {
// Each player is given priority before actual turns start for e.g. leylines and pre-game initialisation
if(initialTurns < game.getPlayers().size()) {
if (initialTurns < game.getPlayers().size()) {
initialTurns++;
return;
}
@ -647,7 +657,6 @@ public class TestPlayer implements Player {
}
}
@Override
public void selectBlockers(Game game, UUID defendingPlayerId) {
@ -1080,7 +1089,6 @@ public class TestPlayer implements Player {
return computerPlayer.chooseTarget(outcome, target, source, game);
}
@Override
public boolean chooseTarget(Outcome outcome, Cards cards, TargetCard target, Ability source, Game game) {
if (!targets.isEmpty()) {
@ -2308,4 +2316,3 @@ public class TestPlayer implements Player {
}
}

View file

@ -5,7 +5,6 @@ import java.util.List;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import mage.abilities.Ability;
import mage.cards.Card;
import mage.cards.decks.Deck;
@ -23,7 +22,6 @@ import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.game.*;
import mage.game.command.CommandObject;
import mage.game.match.MatchType;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentCard;
import mage.players.Player;
@ -717,7 +715,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
Permanent found = getPermanent(cardName);
Assert.assertFalse("(Battlefield) card type found (" + cardName + ':' + type + ')', found.getCardType().contains(type));
}
/**
* Assert whether a permanent is not a specified subtype
*
@ -963,42 +961,39 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
Assert.assertEquals("message", currentGame.getState().getActivePlayerId(), player.getId());
}
public Permanent getPermanent(String cardName, UUID controller) {
Permanent found = null;
Pattern indexedName = Pattern.compile("^([\\w| ]+):(\\d+)$"); // Ends with <:number>
Matcher indexedMatcher = indexedName.matcher(cardName);
int index = 0;
int count = 0;
if(indexedMatcher.matches()) {
cardName = indexedMatcher.group(1);
index = Integer.valueOf(indexedMatcher.group(2));
if (indexedMatcher.matches()) {
cardName = indexedMatcher.group(1);
index = Integer.valueOf(indexedMatcher.group(2));
}
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) {
if (permanent.getName().equals(cardName)) {
if (controller == null || permanent.getControllerId().equals(controller)) {
found = permanent;
if(count != index) {
count++;
}
}
if (controller == null || permanent.getControllerId().equals(controller)) {
found = permanent;
if (count != index) {
count++;
}
}
}
}
Assert.assertNotNull("Couldn't find a card with specified name: " + cardName, found);
Assert.assertEquals("Only " + count + " permanents were found and " + cardName + ":" + index + " was requested", index, count);
return found;
}
public Permanent getPermanent(String cardName, Player player) {
return getPermanent(cardName, player.getId());
}
public Permanent getPermanent(String cardName) {
return getPermanent(cardName, (UUID)null);
return getPermanent(cardName, (UUID) null);
}
public void playLand(int turnNum, PhaseStep step, TestPlayer player, String cardName) {
player.addAction(turnNum, step, "activate:Play " + cardName);
}
@ -1028,6 +1023,17 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
player.addAction(turnNum, step, "playerAction:Rollback" + "$turns=" + turns);
}
/**
* The player concedes at the given turn and phase
*
* @param turnNum
* @param step
* @param player
*/
public void concede(int turnNum, PhaseStep step, TestPlayer player) {
player.addAction(turnNum, step, "playerAction:Concede");
}
/**
*
* @param turnNum
@ -1064,7 +1070,6 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
castSpell(turnNum, step, player, cardName, targetName, spellOnStack, StackClause.WHILE_ON_STACK);
}
/**
* Spell will only be cast, if a spell / ability with the given name IS or
* IS NOT on the stack
@ -1112,7 +1117,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
player.addAction(turnNum, step, "activate:" + ability + "$targetPlayer=" + target.getName());
}
public void activateAbility(int turnNum, PhaseStep step, TestPlayer player, String ability, String ... targetNames) {
public void activateAbility(int turnNum, PhaseStep step, TestPlayer player, String ability, String... targetNames) {
player.addAction(turnNum, step, "activate:" + ability + "$target=" + String.join("^", targetNames));
}