* Fixed a bug that if a copy token creature of a transformed creature was created (e.g. Mirror Mockery), the front side instead of the transformed side was copied.

This commit is contained in:
LevelX2 2016-08-12 15:42:50 +02:00
parent 0c617d1d35
commit 46566361e7
5 changed files with 50 additions and 5 deletions

View file

@ -85,7 +85,7 @@ public class CrownOfDoom extends CardImpl {
Card sourceCard = game.getCard(ability.getSourceId());
if (sourceCard != null) {
ability.getTargets().clear();
FilterPlayer filter = new FilterPlayer("player other than " + sourceCard.getName() + "'s owner");
FilterPlayer filter = new FilterPlayer("player other than " + sourceCard.getIdName() + "'s owner");
filter.add(Predicates.not(new OwnerIdPredicate(sourceCard.getOwnerId())));
ability.addTarget(new TargetPlayer(1, 1, false, filter));
}
@ -124,7 +124,8 @@ class CrownOfDoomEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
Player newController = game.getPlayer(getTargetPointer().getFirst(game, source));
if (controller != null && newController != null && controller.getId() != newController.getId()) {
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfGame, newController.getId());
// Duration.Custom = effect ends if Artifact leaves the current zone (battlefield)
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, newController.getId());
effect.setTargetPointer(new FixedTarget(source.getSourceId()));
game.addEffect(effect, source);
return true;

View file

@ -51,7 +51,7 @@ public class UnimpededTrespasser extends CardImpl {
// this card is the second face of double-faced card
this.nightCard = true;
// Unimpeded Geist can't be blocked.
// Unimpeded Trespasser can't be blocked.
this.addAbility(new CantBeBlockedSourceAbility());
}

View file

@ -53,7 +53,7 @@ public class UninvitedGeist extends CardImpl {
this.canTransform = true;
this.secondSideCard = new UnimpededTrespasser(ownerId);
// Skulk
// Skulk (This creature can't be blocked by creatures with greater power.)
this.addAbility(new SkulkAbility());
// When Uninvited Geist deals combat damage to a player, transform it.

View file

@ -245,4 +245,43 @@ public class TransformTest extends CardTestPlayerBase {
assertPermanentCount(playerB, "Lambholt Pacifist", 1);
}
/**
* Mirror Mockery copies the front face of a Transformed card rather than
* the current face.
*
* It's worth pointing out that my opponent cast Mirror Mockery the previous
* turn - after it had transformed. I should have included the part of the
* log that showed that Mirror Mockery was applied to the Unimpeded
* Trespasser.
*/
@Test
public void testTransformCopyrnansformed() {
// Skulk (This creature can't be blocked by creatures with greater power.)
// When Uninvited Geist deals combat damage to a player, transform it.
addCard(Zone.BATTLEFIELD, playerA, "Uninvited Geist"); // Creature 2/2 {2}{U}
// Transformed side: Unimpeded Trespasser - Creature 3/3
// Unimpeded Trespasser can't be blocked.
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
// Enchant creature
// Whenever enchanted creature attacks, you may put a token onto the battlefield that's a copy of that creature. Exile that token at the end of combat.
addCard(Zone.HAND, playerB, "Mirror Mockery"); // {1}{U}
attack(1, playerA, "Uninvited Geist");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Mirror Mockery", "Unimpeded Trespasser");
attack(3, playerA, "Unimpeded Trespasser");
setStopAt(3, PhaseStep.COMBAT_DAMAGE);
execute();
assertLife(playerB, 15);
assertPermanentCount(playerB, "Mirror Mockery", 1);
assertPermanentCount(playerA, "Unimpeded Trespasser", 1);
assertPermanentCount(playerB, "Unimpeded Trespasser", 1);
assertPowerToughness(playerB, "Unimpeded Trespasser", 3, 3);
}
}

View file

@ -70,7 +70,12 @@ public class CopyTokenFunction implements Function<Token, Card> {
MorphAbility.setPermanentToFaceDownCreature(target);
return target;
} else {
sourceObj = ((PermanentCard) source).getCard();
if (((PermanentCard) source).isTransformed() && source.getSecondCardFace() != null) {
sourceObj = ((PermanentCard) source).getSecondCardFace();
} else {
sourceObj = ((PermanentCard) source).getCard();
}
target.setOriginalExpansionSetCode(source.getExpansionSetCode());
target.setOriginalCardNumber(source.getCardNumber());
target.setCopySourceCard((Card) sourceObj);