forked from External/mage
* Possibility Storm - Fixed a problem with split card moving.
This commit is contained in:
parent
fe4abd26c9
commit
fdd28cde4b
4 changed files with 16 additions and 23 deletions
|
|
@ -56,7 +56,7 @@ import mage.target.targetpointer.FixedTarget;
|
|||
public class PossibilityStorm extends CardImpl {
|
||||
|
||||
public PossibilityStorm(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{R}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}{R}");
|
||||
|
||||
// Whenever a player casts a spell from his or her hand, that player exiles it, then exiles cards from
|
||||
// the top of his or her library until he or she exiles a card that shares a card type with it. That
|
||||
|
|
@ -133,14 +133,14 @@ class PossibilityStormEffect extends OneShotEffect {
|
|||
if (sourceObject != null && spell != null) {
|
||||
Player spellController = game.getPlayer(spell.getControllerId());
|
||||
if (spellController != null
|
||||
&& spellController.moveCardToExileWithInfo(spell, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.STACK, true)) {
|
||||
&& spellController.moveCardsToExile(spell, source, game, true, source.getSourceId(), sourceObject.getIdName())) {
|
||||
if (spellController.getLibrary().size() > 0) {
|
||||
Library library = spellController.getLibrary();
|
||||
Card card;
|
||||
do {
|
||||
card = library.removeFromTop(game);
|
||||
card = library.getFromTop(game);
|
||||
if (card != null) {
|
||||
spellController.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true);
|
||||
spellController.moveCardsToExile(card, source, game, true, source.getSourceId(), sourceObject.getIdName());
|
||||
}
|
||||
} while (library.size() > 0 && card != null && !sharesType(card, spell.getCardType()));
|
||||
|
||||
|
|
@ -154,10 +154,7 @@ class PossibilityStormEffect extends OneShotEffect {
|
|||
|
||||
ExileZone exile = game.getExile().getExileZone(source.getSourceId());
|
||||
if (exile != null) {
|
||||
while (exile.size() > 0) {
|
||||
card = exile.getRandom(game);
|
||||
spellController.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.EXILED, false, false);
|
||||
}
|
||||
spellController.putCardsOnBottomOfLibrary(exile, game, source, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,10 +27,8 @@
|
|||
*/
|
||||
package org.mage.test.cards.triggers;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
|
|
@ -61,7 +59,7 @@ public class PossibilityStormTest extends CardTestPlayerBase {
|
|||
// the top of his or her library until he or she exiles a card that shares a card type with it. That
|
||||
// player may cast that card without paying its mana cost. Then he or she puts all cards exiled with
|
||||
// Possibility Storm on the bottom of his or her library in a random order.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Possibility Storm", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Possibility Storm", 1);
|
||||
|
||||
// {T}: Add {C} to your mana pool.
|
||||
// Morph {2}
|
||||
|
|
@ -78,14 +76,7 @@ public class PossibilityStormTest extends CardTestPlayerBase {
|
|||
|
||||
assertPermanentCount(playerA, "Zoetic Cavern", 0);
|
||||
|
||||
boolean zoeticCavernInLibrary = false;
|
||||
for (Card card : playerA.getLibrary().getCards(currentGame)) {
|
||||
if (card.getName().equals("Zoetic Cavern")) {
|
||||
zoeticCavernInLibrary = true;
|
||||
}
|
||||
}
|
||||
Assert.assertEquals("Zoetic Cavern has to be in the library", true, zoeticCavernInLibrary);
|
||||
|
||||
assertLibraryCount(playerA, "Zoetic Cavern", 1);
|
||||
assertPermanentCount(playerA, "Silvercoat Lion", 1);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -506,6 +506,7 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
* @param cards - list of cards that have to be moved
|
||||
* @param game - game
|
||||
* @param anyOrder - true if player can determine the order of the cards
|
||||
* else random order
|
||||
* @param source - source ability
|
||||
* @return
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -825,8 +825,10 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (!cardsToLibrary.isEmpty()) {
|
||||
Cards cards = new CardsImpl(cardsToLibrary); // prevent possible ConcurrentModificationException
|
||||
if (!anyOrder) {
|
||||
for (UUID objectId : cards) {
|
||||
moveObjectToLibrary(objectId, source == null ? null : source.getSourceId(), game, false, false);
|
||||
while (!cards.isEmpty()) {
|
||||
UUID cardId = cards.getRandom(game).getId();
|
||||
cards.remove(cardId);
|
||||
moveObjectToLibrary(cardId, source == null ? null : source.getSourceId(), game, false, false);
|
||||
}
|
||||
} else {
|
||||
TargetCard target = new TargetCard(Zone.ALL, new FilterCard("card to put on the bottom of your library (last one chosen will be bottommost)"));
|
||||
|
|
@ -864,8 +866,10 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
Cards cards = new CardsImpl(cardsToLibrary); // prevent possible ConcurrentModificationException
|
||||
UUID sourceId = (source == null ? null : source.getSourceId());
|
||||
if (!anyOrder) {
|
||||
for (UUID cardId : cards) {
|
||||
moveObjectToLibrary(cardId, sourceId, game, true, false);
|
||||
while (!cards.isEmpty()) {
|
||||
UUID cardId = cards.getRandom(game).getId();
|
||||
cards.remove(cardId);
|
||||
moveObjectToLibrary(cardId, source == null ? null : source.getSourceId(), game, true, false);
|
||||
}
|
||||
} else {
|
||||
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put on the top of your library (last one chosen will be topmost)"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue