diff --git a/Mage.Sets/src/mage/sets/coldsnap/MartyrOfSands.java b/Mage.Sets/src/mage/sets/coldsnap/MartyrOfSands.java index 4c9f1bfc66..faea6ea009 100644 --- a/Mage.Sets/src/mage/sets/coldsnap/MartyrOfSands.java +++ b/Mage.Sets/src/mage/sets/coldsnap/MartyrOfSands.java @@ -54,6 +54,7 @@ import mage.target.common.TargetCardInHand; public class MartyrOfSands extends CardImpl { private static final FilterCard filter = new FilterCard("X white cards from your hand"); + static { filter.add(new ColorPredicate(ObjectColor.WHITE)); } @@ -64,7 +65,6 @@ public class MartyrOfSands extends CardImpl { this.subtype.add("Human"); this.subtype.add("Cleric"); - this.color.setWhite(true); this.power = new MageInt(1); this.toughness = new MageInt(1); diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/PossibilityStorm.java b/Mage.Sets/src/mage/sets/dragonsmaze/PossibilityStorm.java index 65582a40ad..c587eab6fb 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/PossibilityStorm.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/PossibilityStorm.java @@ -29,17 +29,17 @@ package mage.sets.dragonsmaze; import java.util.List; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; +import mage.MageObject; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.ExileZone; import mage.game.Game; import mage.game.events.GameEvent; @@ -61,8 +61,6 @@ public class PossibilityStorm extends CardImpl { super(ownerId, 34, "Possibility Storm", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}{R}"); this.expansionSetCode = "DGM"; - this.color.setRed(true); - // 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 // player may cast that card without paying its mana cost. Then he or she puts all cards exiled with @@ -96,9 +94,14 @@ class PossibilityStormTriggeredAbility extends TriggeredAbilityImpl { return new PossibilityStormTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.SPELL_CAST && event.getZone() == Zone.HAND) { + if (event.getZone() == Zone.HAND) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null) { for (Effect effect : this.getEffects()) { @@ -130,22 +133,24 @@ class PossibilityStormEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source)); - if (spell != null) { - if (spell.moveToExile(source.getSourceId(), "Possibility Storm Exile", source.getSourceId(), game)) { - Player player = game.getPlayer(spell.getControllerId()); - if (player != null && player.getLibrary().size() > 0) { - Library library = player.getLibrary(); + MageObject sourceObject = source.getSourceObject(game); + if (sourceObject != null && spell != null) { + Player spellController = game.getPlayer(spell.getControllerId()); + if (spellController != null && + spellController.moveCardToExileWithInfo(spell, source.getSourceId(), sourceObject.getName(), source.getSourceId(), game, Zone.STACK)) { + if (spellController.getLibrary().size() > 0) { + Library library = spellController.getLibrary(); Card card; do { card = library.removeFromTop(game); if (card != null) { - card.moveToExile(source.getSourceId(), "Possibility Storm Exile", source.getSourceId(), game); + spellController.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getName(), source.getSourceId(), game, Zone.LIBRARY); } } while (library.size() > 0 && card != null && !sharesType(card, spell.getCardType())); if (card != null && sharesType(card, spell.getCardType())) { - if(player.chooseUse(Outcome.PlayForFree, new StringBuilder("Cast ").append(card.getName()).append(" without paying cost?").toString(), game)) { - player.cast(card.getSpellAbility(), game, true); + if (spellController.chooseUse(Outcome.PlayForFree, new StringBuilder("Cast ").append(card.getName()).append(" without paying cost?").toString(), game)) { + spellController.cast(card.getSpellAbility(), game, true); } } @@ -154,7 +159,7 @@ class PossibilityStormEffect extends OneShotEffect { while (exile.size() > 0) { card = exile.getRandom(game); exile.remove(card.getId()); - card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, false); + spellController.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.EXILED, false, false); } } diff --git a/Mage.Sets/src/mage/sets/timespiral/TeferiMageOfZhalfir.java b/Mage.Sets/src/mage/sets/timespiral/TeferiMageOfZhalfir.java index a44e564089..e512296b4a 100644 --- a/Mage.Sets/src/mage/sets/timespiral/TeferiMageOfZhalfir.java +++ b/Mage.Sets/src/mage/sets/timespiral/TeferiMageOfZhalfir.java @@ -61,12 +61,12 @@ public class TeferiMageOfZhalfir extends CardImpl { this.subtype.add("Human"); this.subtype.add("Wizard"); - this.color.setBlue(true); this.power = new MageInt(3); this.toughness = new MageInt(4); // Flash this.addAbility(FlashAbility.getInstance()); + // Creature cards you own that aren't on the battlefield have flash. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TeferiMageOfZhalfirAddFlashEffect())); @@ -152,13 +152,18 @@ class TeferiMageOfZhalfirReplacementEffect extends ContinuousRuleModifyingEffect } return null; } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.CAST_SPELL; + } + + @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == GameEvent.EventType.CAST_SPELL) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null && controller.hasOpponent(event.getPlayerId(), game)) { - return !game.canPlaySorcery(event.getPlayerId()); - } + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null && controller.hasOpponent(event.getPlayerId(), game)) { + return !game.canPlaySorcery(event.getPlayerId()); } return false; } diff --git a/Mage/src/mage/abilities/costs/common/RevealTargetFromHandCost.java b/Mage/src/mage/abilities/costs/common/RevealTargetFromHandCost.java index f5b131fa78..23c0fd4333 100644 --- a/Mage/src/mage/abilities/costs/common/RevealTargetFromHandCost.java +++ b/Mage/src/mage/abilities/costs/common/RevealTargetFromHandCost.java @@ -49,7 +49,7 @@ public class RevealTargetFromHandCost extends CostImpl { this.text = (target.getNumberOfTargets() == 0 ?"you may ":"") + "reveal " + target.getTargetName(); } - public RevealTargetFromHandCost(RevealTargetFromHandCost cost) { + public RevealTargetFromHandCost(final RevealTargetFromHandCost cost) { super(cost); this.convertedManaCosts = cost.convertedManaCosts; this.numberCardsRevealed = cost.numberCardsRevealed; @@ -69,12 +69,12 @@ public class RevealTargetFromHandCost extends CostImpl { numberCardsRevealed++; cards.add(card); } - player.revealCards("card cost", cards, game); - paid = true; - return paid; } - if (!paid && targets.get(0).getNumberOfTargets() == 0) { - paid = true; // e.g. for optional additional costs. example: Dragonlord's Prerogative + if (numberCardsRevealed > 0 ) { + player.revealCards("card cost", cards, game); + } + if (targets.get(0).getNumberOfTargets() <= numberCardsRevealed) { + paid = true; // e.g. for optional additional costs. example: Dragonlord's Prerogative also true if 0 cards shown return paid; } }