mirror of
https://github.com/correl/mage.git
synced 2024-12-26 19:16:54 +00:00
* MIracle - Fixed a problem with miracle casting costs.
This commit is contained in:
parent
170ad083c7
commit
d9ede35857
2 changed files with 49 additions and 49 deletions
|
@ -40,15 +40,14 @@ import mage.game.permanent.token.AngelToken;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author noxx
|
* @author noxx
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public class EntreatTheAngels extends CardImpl {
|
public class EntreatTheAngels extends CardImpl {
|
||||||
|
|
||||||
public EntreatTheAngels(UUID ownerId, CardSetInfo setInfo) {
|
public EntreatTheAngels(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{X}{X}{W}{W}{W}");
|
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{X}{W}{W}{W}");
|
||||||
|
|
||||||
|
// Create X 4/4 white Angel creature tokens with flying.
|
||||||
// create X 4/4 white Angel creature tokens with flying.
|
|
||||||
this.getSpellAbility().addEffect(new CreateTokenEffect(new AngelToken(), new ManacostVariableValue()));
|
this.getSpellAbility().addEffect(new CreateTokenEffect(new AngelToken(), new ManacostVariableValue()));
|
||||||
|
|
||||||
// Miracle {X}{W}{W}
|
// Miracle {X}{W}{W}
|
||||||
|
|
|
@ -24,11 +24,11 @@
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.abilities.keyword;
|
package mage.abilities.keyword;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.costs.mana.ManaCost;
|
import mage.abilities.costs.mana.ManaCost;
|
||||||
import mage.abilities.costs.mana.ManaCosts;
|
import mage.abilities.costs.mana.ManaCosts;
|
||||||
|
@ -45,59 +45,65 @@ import mage.watchers.common.MiracleWatcher;
|
||||||
/**
|
/**
|
||||||
* 702.92. Miracle
|
* 702.92. Miracle
|
||||||
*
|
*
|
||||||
* 702.92a Miracle is a static ability linked to a triggered ability (see rule 603.10).
|
* 702.92a Miracle is a static ability linked to a triggered ability (see rule
|
||||||
* "Miracle [cost]" means "You may reveal this card from your hand as you draw it if
|
* 603.10). "Miracle [cost]" means "You may reveal this card from your hand as
|
||||||
* it's the first card you've drawn this turn. When you reveal this card this way,
|
* you draw it if it's the first card you've drawn this turn. When you reveal
|
||||||
* you may cast it by paying [cost] rather than its mana cost."
|
* this card this way, you may cast it by paying [cost] rather than its mana
|
||||||
|
* cost."
|
||||||
*
|
*
|
||||||
* 702.92b If a player chooses to reveal a card using its miracle ability, he or she
|
* 702.92b If a player chooses to reveal a card using its miracle ability, he or
|
||||||
* plays with that card revealed until that card leaves his or her hand, that ability
|
* she plays with that card revealed until that card leaves his or her hand,
|
||||||
* resolves, or that ability otherwise leaves the stack.
|
* that ability resolves, or that ability otherwise leaves the stack.
|
||||||
*
|
*
|
||||||
* You can cast a card for its miracle cost only as the miracle triggered ability resolves.
|
* You can cast a card for its miracle cost only as the miracle triggered
|
||||||
* If you don't want to cast it at that time (or you can't cast it, perhaps because
|
* ability resolves. If you don't want to cast it at that time (or you can't
|
||||||
* there are no legal targets available), you won't be able to cast it later for the miracle cost.
|
* cast it, perhaps because there are no legal targets available), you won't be
|
||||||
|
* able to cast it later for the miracle cost.
|
||||||
*
|
*
|
||||||
* RULINGS:
|
* RULINGS: You still draw the card, whether you use the miracle ability or not.
|
||||||
* You still draw the card, whether you use the miracle ability or not. Any ability that
|
* Any ability that triggers whenever you draw a card, for example, will
|
||||||
* triggers whenever you draw a card, for example, will trigger. If you don't cast the card
|
* trigger. If you don't cast the card using its miracle ability, it will remain
|
||||||
* using its miracle ability, it will remain in your hand.
|
* in your hand.
|
||||||
*
|
*
|
||||||
* You can reveal and cast a card with miracle on any turn, not just your own, if it's the
|
* You can reveal and cast a card with miracle on any turn, not just your own,
|
||||||
* first card you've drawn that turn.
|
* if it's the first card you've drawn that turn.
|
||||||
*
|
*
|
||||||
* You don't have to reveal a drawn card with miracle if you don't wish to cast it at that time.
|
* You don't have to reveal a drawn card with miracle if you don't wish to cast
|
||||||
|
* it at that time.
|
||||||
*
|
*
|
||||||
* You can cast a card for its miracle cost only as the miracle triggered ability resolves.
|
* You can cast a card for its miracle cost only as the miracle triggered
|
||||||
* If you don't want to cast it at that time (or you can't cast it, perhaps because there are
|
* ability resolves. If you don't want to cast it at that time (or you can't
|
||||||
* no legal targets available), you won't be able to cast it later for the miracle cost.
|
* cast it, perhaps because there are no legal targets available), you won't be
|
||||||
|
* able to cast it later for the miracle cost.
|
||||||
*
|
*
|
||||||
* You cast the card with miracle during the resolution of the triggered ability. Ignore any timing
|
* You cast the card with miracle during the resolution of the triggered
|
||||||
* restrictions based on the card's type.
|
* ability. Ignore any timing restrictions based on the card's type.
|
||||||
*
|
*
|
||||||
* It's important to reveal a card with miracle before it is mixed with the other cards in your hand.
|
* It's important to reveal a card with miracle before it is mixed with the
|
||||||
|
* other cards in your hand.
|
||||||
*
|
*
|
||||||
* Multiple card draws are always treated as a sequence of individual card draws. For example, if
|
* Multiple card draws are always treated as a sequence of individual card
|
||||||
* you haven't drawn any cards yet during a turn and cast a spell that instructs you to draw three
|
* draws. For example, if you haven't drawn any cards yet during a turn and cast
|
||||||
* cards, you'll draw them one at a time. Only the first card drawn this way may be revealed and cast
|
* a spell that instructs you to draw three cards, you'll draw them one at a
|
||||||
* using its miracle ability.
|
* time. Only the first card drawn this way may be revealed and cast using its
|
||||||
|
* miracle ability.
|
||||||
*
|
*
|
||||||
* If the card with miracle leaves your hand before the triggered ability resolves, you won't be able
|
* If the card with miracle leaves your hand before the triggered ability
|
||||||
* to cast it using its miracle ability.
|
* resolves, you won't be able to cast it using its miracle ability.
|
||||||
*
|
*
|
||||||
* You draw your opening hand before any turn begins. Cards you draw for your opening hand
|
* You draw your opening hand before any turn begins. Cards you draw for your
|
||||||
* can't be cast using miracle.
|
* opening hand can't be cast using miracle.
|
||||||
*
|
*
|
||||||
* @author noxx, LevelX2
|
* @author noxx, LevelX2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class MiracleAbility extends TriggeredAbilityImpl {
|
public class MiracleAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
private static final String staticRule = " <i>(You may cast this card for its miracle cost when you draw it if it's the first card you drew this turn.)</i>";
|
private static final String staticRule = " <i>(You may cast this card for its miracle cost when you draw it if it's the first card you drew this turn.)</i>";
|
||||||
private String ruleText;
|
private String ruleText;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public MiracleAbility(Card card, ManaCosts miracleCosts) {
|
public MiracleAbility(Card card, ManaCosts miracleCosts) {
|
||||||
super(Zone.HAND, new MiracleEffect((ManaCosts<ManaCost>)miracleCosts), true);
|
super(Zone.HAND, new MiracleEffect((ManaCosts<ManaCost>) miracleCosts), true);
|
||||||
addWatcher(new MiracleWatcher());
|
addWatcher(new MiracleWatcher());
|
||||||
ruleText = "Miracle " + miracleCosts.getText() + staticRule;
|
ruleText = "Miracle " + miracleCosts.getText() + staticRule;
|
||||||
}
|
}
|
||||||
|
@ -161,17 +167,12 @@ class MiracleEffect extends OneShotEffect {
|
||||||
// use target pointer here, so it's the same card that triggered the event (not gone back to library e.g.)
|
// use target pointer here, so it's the same card that triggered the event (not gone back to library e.g.)
|
||||||
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||||
if (controller != null && card != null) {
|
if (controller != null && card != null) {
|
||||||
ManaCosts<ManaCost> costRef = card.getSpellAbility().getManaCostsToPay();
|
SpellAbility abilityToCast = card.getSpellAbility().copy();
|
||||||
|
ManaCosts<ManaCost> costRef = abilityToCast.getManaCostsToPay();
|
||||||
// replace with the new cost
|
// replace with the new cost
|
||||||
costRef.clear();
|
costRef.clear();
|
||||||
costRef.add(miracleCosts);
|
costRef.add(miracleCosts);
|
||||||
controller.cast(card.getSpellAbility(), game, false);
|
controller.cast(abilityToCast, game, false);
|
||||||
|
|
||||||
// Reset the casting costs (in case the player cancels cast and plays the card later)
|
|
||||||
costRef.clear();
|
|
||||||
for (ManaCost manaCost : card.getSpellAbility().getManaCosts()) {
|
|
||||||
costRef.add(manaCost);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue