* Martyr of Sands - Fixed that a player got only a maximum of 3 life also if he tried to reveal more cards.

This commit is contained in:
LevelX2 2015-03-22 22:03:59 +01:00
parent 0e350af7a2
commit 5915259e96
4 changed files with 40 additions and 30 deletions

View file

@ -54,6 +54,7 @@ import mage.target.common.TargetCardInHand;
public class MartyrOfSands extends CardImpl { public class MartyrOfSands extends CardImpl {
private static final FilterCard filter = new FilterCard("X white cards from your hand"); private static final FilterCard filter = new FilterCard("X white cards from your hand");
static { static {
filter.add(new ColorPredicate(ObjectColor.WHITE)); filter.add(new ColorPredicate(ObjectColor.WHITE));
} }
@ -64,7 +65,6 @@ public class MartyrOfSands extends CardImpl {
this.subtype.add("Human"); this.subtype.add("Human");
this.subtype.add("Cleric"); this.subtype.add("Cleric");
this.color.setWhite(true);
this.power = new MageInt(1); this.power = new MageInt(1);
this.toughness = new MageInt(1); this.toughness = new MageInt(1);

View file

@ -29,17 +29,17 @@ package mage.sets.dragonsmaze;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import mage.MageObject;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; 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.ExileZone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; 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}"); super(ownerId, 34, "Possibility Storm", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}{R}");
this.expansionSetCode = "DGM"; 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 // 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 // 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 // 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); return new PossibilityStormTriggeredAbility(this);
} }
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.SPELL_CAST;
}
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { 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()); Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null) { if (spell != null) {
for (Effect effect : this.getEffects()) { for (Effect effect : this.getEffects()) {
@ -130,22 +133,24 @@ class PossibilityStormEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source)); Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
if (spell != null) { MageObject sourceObject = source.getSourceObject(game);
if (spell.moveToExile(source.getSourceId(), "Possibility Storm Exile", source.getSourceId(), game)) { if (sourceObject != null && spell != null) {
Player player = game.getPlayer(spell.getControllerId()); Player spellController = game.getPlayer(spell.getControllerId());
if (player != null && player.getLibrary().size() > 0) { if (spellController != null &&
Library library = player.getLibrary(); spellController.moveCardToExileWithInfo(spell, source.getSourceId(), sourceObject.getName(), source.getSourceId(), game, Zone.STACK)) {
if (spellController.getLibrary().size() > 0) {
Library library = spellController.getLibrary();
Card card; Card card;
do { do {
card = library.removeFromTop(game); card = library.removeFromTop(game);
if (card != null) { 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())); } while (library.size() > 0 && card != null && !sharesType(card, spell.getCardType()));
if (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)) { if (spellController.chooseUse(Outcome.PlayForFree, new StringBuilder("Cast ").append(card.getName()).append(" without paying cost?").toString(), game)) {
player.cast(card.getSpellAbility(), game, true); spellController.cast(card.getSpellAbility(), game, true);
} }
} }
@ -154,7 +159,7 @@ class PossibilityStormEffect extends OneShotEffect {
while (exile.size() > 0) { while (exile.size() > 0) {
card = exile.getRandom(game); card = exile.getRandom(game);
exile.remove(card.getId()); exile.remove(card.getId());
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, false); spellController.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.EXILED, false, false);
} }
} }

View file

@ -61,12 +61,12 @@ public class TeferiMageOfZhalfir extends CardImpl {
this.subtype.add("Human"); this.subtype.add("Human");
this.subtype.add("Wizard"); this.subtype.add("Wizard");
this.color.setBlue(true);
this.power = new MageInt(3); this.power = new MageInt(3);
this.toughness = new MageInt(4); this.toughness = new MageInt(4);
// Flash // Flash
this.addAbility(FlashAbility.getInstance()); this.addAbility(FlashAbility.getInstance());
// Creature cards you own that aren't on the battlefield have flash. // Creature cards you own that aren't on the battlefield have flash.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TeferiMageOfZhalfirAddFlashEffect())); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TeferiMageOfZhalfirAddFlashEffect()));
@ -152,13 +152,18 @@ class TeferiMageOfZhalfirReplacementEffect extends ContinuousRuleModifyingEffect
} }
return null; return null;
} }
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.CAST_SPELL;
}
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.CAST_SPELL) { Player controller = game.getPlayer(source.getControllerId());
Player controller = game.getPlayer(source.getControllerId()); if (controller != null && controller.hasOpponent(event.getPlayerId(), game)) {
if (controller != null && controller.hasOpponent(event.getPlayerId(), game)) { return !game.canPlaySorcery(event.getPlayerId());
return !game.canPlaySorcery(event.getPlayerId());
}
} }
return false; return false;
} }

View file

@ -49,7 +49,7 @@ public class RevealTargetFromHandCost extends CostImpl {
this.text = (target.getNumberOfTargets() == 0 ?"you may ":"") + "reveal " + target.getTargetName(); this.text = (target.getNumberOfTargets() == 0 ?"you may ":"") + "reveal " + target.getTargetName();
} }
public RevealTargetFromHandCost(RevealTargetFromHandCost cost) { public RevealTargetFromHandCost(final RevealTargetFromHandCost cost) {
super(cost); super(cost);
this.convertedManaCosts = cost.convertedManaCosts; this.convertedManaCosts = cost.convertedManaCosts;
this.numberCardsRevealed = cost.numberCardsRevealed; this.numberCardsRevealed = cost.numberCardsRevealed;
@ -69,12 +69,12 @@ public class RevealTargetFromHandCost extends CostImpl {
numberCardsRevealed++; numberCardsRevealed++;
cards.add(card); cards.add(card);
} }
player.revealCards("card cost", cards, game);
paid = true;
return paid;
} }
if (!paid && targets.get(0).getNumberOfTargets() == 0) { if (numberCardsRevealed > 0 ) {
paid = true; // e.g. for optional additional costs. example: Dragonlord's Prerogative 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; return paid;
} }
} }