mirror of
https://github.com/magefree/mage.git
synced 2025-12-30 15:32:08 -08:00
[WOE] Implement Rotisserie Elemental (#10944)
This commit is contained in:
parent
ef482ad178
commit
4d3daaa5fa
4 changed files with 86 additions and 7 deletions
|
|
@ -2,6 +2,8 @@ package mage.abilities.effects.common;
|
|||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect;
|
||||
import mage.cards.Card;
|
||||
|
|
@ -17,7 +19,7 @@ import java.util.Set;
|
|||
|
||||
public class ExileTopXMayPlayUntilEndOfTurnEffect extends OneShotEffect {
|
||||
|
||||
private final int amount;
|
||||
private final DynamicValue amount;
|
||||
private final boolean showHint;
|
||||
private final Duration duration;
|
||||
|
||||
|
|
@ -30,15 +32,27 @@ public class ExileTopXMayPlayUntilEndOfTurnEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
public ExileTopXMayPlayUntilEndOfTurnEffect(int amount, boolean showHint, Duration duration) {
|
||||
this(StaticValue.get(amount), showHint, duration);
|
||||
}
|
||||
|
||||
public ExileTopXMayPlayUntilEndOfTurnEffect(DynamicValue amount) {
|
||||
this(amount, false);
|
||||
}
|
||||
|
||||
public ExileTopXMayPlayUntilEndOfTurnEffect(DynamicValue amount, boolean showHint) {
|
||||
this(amount, showHint, Duration.EndOfTurn);
|
||||
}
|
||||
|
||||
public ExileTopXMayPlayUntilEndOfTurnEffect(DynamicValue amount, boolean showHint, Duration duration) {
|
||||
super(Outcome.Benefit);
|
||||
this.amount = amount;
|
||||
this.amount = amount.copy();
|
||||
this.showHint = showHint;
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
private ExileTopXMayPlayUntilEndOfTurnEffect(final ExileTopXMayPlayUntilEndOfTurnEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount;
|
||||
this.amount = effect.amount.copy();
|
||||
this.showHint = effect.showHint;
|
||||
this.duration = effect.duration;
|
||||
}
|
||||
|
|
@ -54,7 +68,8 @@ public class ExileTopXMayPlayUntilEndOfTurnEffect extends OneShotEffect {
|
|||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
Set<Card> cards = controller.getLibrary().getTopCards(game, amount);
|
||||
int resolvedAmount = amount.calculate(game, source, this);
|
||||
Set<Card> cards = controller.getLibrary().getTopCards(game, resolvedAmount);
|
||||
if (cards.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -74,15 +89,17 @@ public class ExileTopXMayPlayUntilEndOfTurnEffect extends OneShotEffect {
|
|||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder("exile the top ");
|
||||
if (amount == 1) {
|
||||
if (amount.toString().equals("1")) {
|
||||
sb.append("card of your library. ");
|
||||
} else {
|
||||
sb.append(CardUtil.numberToText(amount));
|
||||
sb.append(CardUtil.numberToText(amount.toString()));
|
||||
sb.append(" cards of your library. ");
|
||||
}
|
||||
sb.append(CardUtil.getTextWithFirstCharUpperCase(duration.toString()));
|
||||
sb.append(", you may play ");
|
||||
sb.append(amount == 1 ? "that card" : amount == 2 ? "those cards" : "cards exiled this way");
|
||||
sb.append(amount.toString().equals("1") ? "that card"
|
||||
: amount.toString().equals("2") ? "those cards" // That is weird.
|
||||
: "cards exiled this way");
|
||||
|
||||
if (showHint) {
|
||||
sb.append(". <i>(You still pay its costs. You can play a land this way only if you have an available land play remaining.)</i>");
|
||||
|
|
|
|||
|
|
@ -176,6 +176,7 @@ public enum CounterType {
|
|||
SHELL("shell"),
|
||||
SHIELD("shield"),
|
||||
SHRED("shred"),
|
||||
SKEWER("skewer"),
|
||||
SLEEP("sleep"),
|
||||
SLIME("slime"),
|
||||
SLUMBER("slumber"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue