From 95d30d9085bb5a7b568afa0ee6d61911b5d743d5 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 5 Nov 2014 00:19:17 +0100 Subject: [PATCH] * Fixed a bug that continuous effects of cards that were put onto battlefield not under owner control could be applied using the owner as controller. Fixes #604 (I guess). --- .../org/mage/test/cards/control/PutIntoPlayEffectsTest.java | 6 +++++- Mage/src/mage/cards/CardImpl.java | 2 ++ Mage/src/mage/game/permanent/Battlefield.java | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/control/PutIntoPlayEffectsTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/control/PutIntoPlayEffectsTest.java index 222d5cefa5f..3d549a25b9a 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/control/PutIntoPlayEffectsTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/control/PutIntoPlayEffectsTest.java @@ -47,6 +47,9 @@ public class PutIntoPlayEffectsTest extends CardTestPlayerBase { @Test public void testLordOfTheVoid() { skipInitShuffling(); + // You may play an additional land on each of your turns. + // Play with the top card of your library revealed. + // You may play the top card of your library if it's a land card. addCard(Zone.LIBRARY, playerA, "Oracle of Mul Daya", 4); // Whenever Lord of the Void deals combat damage to a player, exile the top seven cards // of that player's library, then put a creature card from among them @@ -63,8 +66,9 @@ public class PutIntoPlayEffectsTest extends CardTestPlayerBase { assertLife(playerA, 13); assertPermanentCount(playerB, "Oracle of Mul Daya", 1); - Assert.assertTrue("Top card of the library of player B should be reveled.", playerB.isTopCardRevealed()); Assert.assertFalse("Top card of the library of player A should not be reveled.", playerA.isTopCardRevealed()); + Assert.assertTrue("Top card of the library of player B should be reveled.", playerB.isTopCardRevealed()); + } /* diff --git a/Mage/src/mage/cards/CardImpl.java b/Mage/src/mage/cards/CardImpl.java index ab070cfe7c8..510bb90ff90 100644 --- a/Mage/src/mage/cards/CardImpl.java +++ b/Mage/src/mage/cards/CardImpl.java @@ -544,6 +544,8 @@ public abstract class CardImpl extends MageObjectImpl implements Card { PermanentCard permanent = new PermanentCard(this, controllerId); // reset is done to end continuous effects from previous instances of that permanent (e.g undying) game.resetForSourceId(permanent.getId()); + // make sure the controller of all continuous effects of this card are switched to the current controller + game.getContinuousEffects().setController(objectId, controllerId); game.addPermanent(permanent); game.setZone(objectId, Zone.BATTLEFIELD); game.setScopeRelevant(true); diff --git a/Mage/src/mage/game/permanent/Battlefield.java b/Mage/src/mage/game/permanent/Battlefield.java index 3123a0c330c..c8f24c097d7 100644 --- a/Mage/src/mage/game/permanent/Battlefield.java +++ b/Mage/src/mage/game/permanent/Battlefield.java @@ -428,6 +428,7 @@ public class Battlefield implements Serializable { * control changed events after all control change effects have been applied * * @param game + * @return */ public boolean fireControlChangeEvents(Game game) { boolean controlChanged = false;