mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
* Fixed a bug that countered spells of creatures with the ability going back to library if going to graveyard (e.g. Legacy Waepon) stayed in hand or caused a java bug instead of going to library.
This commit is contained in:
parent
eb6e7f9b46
commit
d7c23bbfc0
3 changed files with 43 additions and 1 deletions
|
@ -56,7 +56,7 @@ public class ManaDrain extends CardImpl {
|
||||||
this.expansionSetCode = "VMA";
|
this.expansionSetCode = "VMA";
|
||||||
|
|
||||||
this.color.setBlue(true);
|
this.color.setBlue(true);
|
||||||
|
|
||||||
// Counter target spell. At the beginning of your next main phase, add {X} to your mana pool, where X is that spell's converted mana cost.
|
// Counter target spell. At the beginning of your next main phase, add {X} to your mana pool, where X is that spell's converted mana cost.
|
||||||
this.getSpellAbility().addTarget(new TargetSpell());
|
this.getSpellAbility().addTarget(new TargetSpell());
|
||||||
this.getSpellAbility().addEffect(new ManaDrainCounterEffect());
|
this.getSpellAbility().addEffect(new ManaDrainCounterEffect());
|
||||||
|
|
|
@ -30,6 +30,7 @@ package org.mage.test.cards.replacement;
|
||||||
|
|
||||||
import mage.constants.PhaseStep;
|
import mage.constants.PhaseStep;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
@ -286,6 +287,43 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
|
||||||
assertGraveyardCount(playerB, "Pillarfield Ox", 1);
|
assertGraveyardCount(playerB, "Pillarfield Ox", 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Test that a countered spell of a card that goes always to library back
|
||||||
|
* instead of into the graveyard.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCounterAndMoveToLibrary() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Plains", 7);
|
||||||
|
// Legacy Weapon - Artifact {7}
|
||||||
|
// {W}{U}{B}{R}{G}: Exile target permanent.
|
||||||
|
// If Legacy Weapon would be put into a graveyard from anywhere, reveal Legacy Weapon and shuffle it into its owner's library instead.
|
||||||
|
addCard(Zone.HAND, playerA, "Legacy Weapon");
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
|
||||||
|
// Counter target spell. At the beginning of your next main phase, add {X} to your mana pool, where X is that spell's converted mana cost.
|
||||||
|
addCard(Zone.HAND, playerB, "Mana Drain");
|
||||||
|
addCard(Zone.HAND, playerB, "Legacy Weapon");
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Legacy Weapon");
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Mana Drain", "Legacy Weapon");
|
||||||
|
|
||||||
|
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Legacy Weapon");
|
||||||
|
setStopAt(2, PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertLife(playerA, 20);
|
||||||
|
assertLife(playerB, 20);
|
||||||
|
|
||||||
|
assertHandCount(playerA, "Legacy Weapon", 0);
|
||||||
|
assertPermanentCount(playerA, "Legacy Weapon", 0);
|
||||||
|
assertGraveyardCount(playerA, "Legacy Weapon", 0);
|
||||||
|
|
||||||
|
assertGraveyardCount(playerB, "Mana Drain", 1);
|
||||||
|
|
||||||
|
assertPermanentCount(playerB, "Legacy Weapon", 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.PermanentCard;
|
import mage.game.permanent.PermanentCard;
|
||||||
|
import mage.game.stack.Spell;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,6 +66,9 @@ public class RevealAndShuffleIntoLibrarySourceEffect extends OneShotEffect {
|
||||||
Player owner = null;
|
Player owner = null;
|
||||||
Cards cards = new CardsImpl();
|
Cards cards = new CardsImpl();
|
||||||
Permanent permanent = null;
|
Permanent permanent = null;
|
||||||
|
if (sourceObject instanceof Spell) {
|
||||||
|
sourceObject = ((Spell)sourceObject).getCard();
|
||||||
|
}
|
||||||
if (sourceObject instanceof Permanent) {
|
if (sourceObject instanceof Permanent) {
|
||||||
permanent = (Permanent) sourceObject;
|
permanent = (Permanent) sourceObject;
|
||||||
owner = game.getPlayer(permanent.getOwnerId());
|
owner = game.getPlayer(permanent.getOwnerId());
|
||||||
|
|
Loading…
Reference in a new issue