mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
- Fixed #8165. There are other cards that handle exiling sequentially, but this is a refactoring starting point.
This commit is contained in:
parent
a1c067a8fb
commit
025395788c
2 changed files with 23 additions and 15 deletions
|
@ -67,7 +67,9 @@ class TaintedPactEffect extends OneShotEffect {
|
||||||
&& controller.getLibrary().hasCards()) {
|
&& controller.getLibrary().hasCards()) {
|
||||||
Card card = controller.getLibrary().getFromTop(game);
|
Card card = controller.getLibrary().getFromTop(game);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
|
// the card move is sequential, not all at once.
|
||||||
controller.moveCards(card, Zone.EXILED, source, game);
|
controller.moveCards(card, Zone.EXILED, source, game);
|
||||||
|
game.getState().processAction(game); // Laelia, the Blade Reforged
|
||||||
// Checks if there was already exiled a card with the same name
|
// Checks if there was already exiled a card with the same name
|
||||||
if (names.contains(card.getName())) {
|
if (names.contains(card.getName())) {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -20,23 +20,27 @@ import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cascade
|
* Cascade A keyword ability that may let a player cast a random extra spell for
|
||||||
* A keyword ability that may let a player cast a random extra spell for no cost. See rule 702.84, “Cascade.”
|
* no cost. See rule 702.84, “Cascade.”
|
||||||
* <p>
|
* <p>
|
||||||
* 702.84. Cascade
|
* 702.84. Cascade
|
||||||
* <p>
|
* <p>
|
||||||
* 702.84a Cascade is a triggered ability that functions only while the spell with cascade is on the stack.
|
* 702.84a Cascade is a triggered ability that functions only while the spell
|
||||||
* “Cascade” means “When you cast this spell, exile cards from the top of your library until you exile a
|
* with cascade is on the stack. “Cascade” means “When you cast this spell,
|
||||||
* nonland card whose converted mana cost is less than this spell’s converted mana cost. You may cast that
|
* exile cards from the top of your library until you exile a nonland card whose
|
||||||
* card without paying its mana cost. Then put all cards exiled this way that weren’t cast on the bottom
|
* converted mana cost is less than this spell’s converted mana cost. You may
|
||||||
* of your library in a random order.”
|
* cast that card without paying its mana cost. Then put all cards exiled this
|
||||||
|
* way that weren’t cast on the bottom of your library in a random order.”
|
||||||
* <p>
|
* <p>
|
||||||
* 702.84b If an effect allows a player to take an action with one or more of the exiled cards “as you cascade,”
|
* 702.84b If an effect allows a player to take an action with one or more of
|
||||||
* the player may take that action after they have finished exiling cards due to the cascade ability. This action
|
* the exiled cards “as you cascade,” the player may take that action after they
|
||||||
* is taken before choosing whether to cast the last exiled card or, if no appropriate card was exiled, before
|
* have finished exiling cards due to the cascade ability. This action is taken
|
||||||
* putting the exiled cards on the bottom of their library in a random order.
|
* before choosing whether to cast the last exiled card or, if no appropriate
|
||||||
|
* card was exiled, before putting the exiled cards on the bottom of their
|
||||||
|
* library in a random order.
|
||||||
* <p>
|
* <p>
|
||||||
* 702.84c If a spell has multiple instances of cascade, each triggers separately.
|
* 702.84c If a spell has multiple instances of cascade, each triggers
|
||||||
|
* separately.
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
|
@ -46,7 +50,6 @@ public class CascadeAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
// can't use singletone due rules:
|
// can't use singletone due rules:
|
||||||
// 702.84c If a spell has multiple instances of cascade, each triggers separately.
|
// 702.84c If a spell has multiple instances of cascade, each triggers separately.
|
||||||
|
|
||||||
private static final String REMINDERTEXT = " <i>(When you cast this spell, "
|
private static final String REMINDERTEXT = " <i>(When you cast this spell, "
|
||||||
+ "exile cards from the top of your library until you exile a "
|
+ "exile cards from the top of your library until you exile a "
|
||||||
+ "nonland card whose mana value is less than this spell's mana value. "
|
+ "nonland card whose mana value is less than this spell's mana value. "
|
||||||
|
@ -124,12 +127,15 @@ class CascadeEffect extends OneShotEffect {
|
||||||
Card cardToCast = null;
|
Card cardToCast = null;
|
||||||
for (Card card : controller.getLibrary().getCards(game)) {
|
for (Card card : controller.getLibrary().getCards(game)) {
|
||||||
cardsToExile.add(card);
|
cardsToExile.add(card);
|
||||||
if (!card.isLand(game) && card.getManaValue() < sourceCost) {
|
// the card move is sequential, not all at once.
|
||||||
|
controller.moveCards(card, Zone.EXILED, source, game);
|
||||||
|
game.getState().processAction(game); // Laelia, the Blade Reforged
|
||||||
|
if (!card.isLand(game)
|
||||||
|
&& card.getManaValue() < sourceCost) {
|
||||||
cardToCast = card;
|
cardToCast = card;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
controller.moveCards(cardsToExile, Zone.EXILED, source, game);
|
|
||||||
controller.getLibrary().reset(); // set back empty draw state if that caused an empty draw
|
controller.getLibrary().reset(); // set back empty draw state if that caused an empty draw
|
||||||
|
|
||||||
// additional replacement effect: As you cascade, you may put a land card from among the exiled cards onto the battlefield tapped
|
// additional replacement effect: As you cascade, you may put a land card from among the exiled cards onto the battlefield tapped
|
||||||
|
|
Loading…
Reference in a new issue