Fixed a problem with Tokens of the CopyEffect (e.g. with Essence of the Wild and Back from the Bring in play).

This commit is contained in:
LevelX2 2016-03-07 17:34:03 +01:00
parent 397b874b2d
commit 0a31a8b479
3 changed files with 39 additions and 3 deletions

View file

@ -103,7 +103,7 @@ class BackFromTheBrinkCost extends CostImpl {
Player controller = game.getPlayer(controllerId);
if (controller != null) {
Card card = controller.getGraveyard().get(targets.getFirstTarget(), game);
if (card != null && controller.moveCards(card, null, Zone.EXILED, ability, game)) {
if (card != null && controller.moveCards(card, Zone.EXILED, ability, game)) {
ability.getEffects().get(0).setTargetPointer(new FixedTarget(card.getId()));
paid = card.getManaCost().pay(ability, game, sourceId, controllerId, noMana);
}

View file

@ -68,4 +68,36 @@ public class EssenceOfTheWildtest extends CardTestPlayerBase {
}
/**
* I control Essence of the Wild and Back from the Brink on the battlefield,
* and start using Back from the Brink on the creatures in my graveyard. The
* creature tokens don't enter the battlefield as copies of Essence of the
* Wild.
*
* Since it's an unusual situation, I checked around if there's something in
* the rules that would prevent this combo from working. Found this link and
* they confirmed that it should work, the tokens should come into play as
* 6/6s.
*/
@Test
public void testWithBackFromTheBrink() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
// Creatures you control enter the battlefield as a copy of Essence of the Wild.
addCard(Zone.BATTLEFIELD, playerA, "Essence of the Wild"); // 6/6
// Exile a creature card from your graveyard and pay its mana cost: Put a token onto the battlefield that's a copy of that card. Activate this ability only any time you could cast a sorcery.
addCard(Zone.BATTLEFIELD, playerA, "Back from the Brink"); // Enchantment
addCard(Zone.GRAVEYARD, playerA, "Silvercoat Lion");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Exile a creature card");
setChoice(playerA, "Silvercoat Lion");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertExileCount("Silvercoat Lion", 1);
assertPermanentCount(playerA, "Essence of the Wild", 2);
assertPowerToughness(playerA, "Essence of the Wild", 6, 6, Filter.ComparisonScope.All);
}
}

View file

@ -92,8 +92,12 @@ public class CopyEffect extends ContinuousEffectImpl {
permanent = game.getPermanentEntering(copyToObjectId);
if (permanent != null) {
copyToPermanent(permanent, game, source);
// set reference to the permanent later on the battlefield so we have to add already one to the zone change counter
affectedObjectList.add(new MageObjectReference(permanent.getId(), game.getState().getZoneChangeCounter(copyToObjectId) + 1, game));
// set reference to the permanent later on the battlefield so we have to add already one (if no token) to the zone change counter
int ZCCDiff = 1;
if (permanent instanceof PermanentToken) {
ZCCDiff = 0;
}
affectedObjectList.add(new MageObjectReference(permanent.getId(), game.getState().getZoneChangeCounter(copyToObjectId) + ZCCDiff, game));
}
}
}