[WOE] Implement Rotisserie Elemental (#10944)

This commit is contained in:
Susucre 2023-08-23 02:19:25 +02:00 committed by GitHub
parent ef482ad178
commit 4d3daaa5fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 86 additions and 7 deletions

View file

@ -0,0 +1,60 @@
package mage.cards.r;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CountersSourceCount;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.ExileTopXMayPlayUntilEndOfTurnEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.MenaceAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.counters.CounterType;
import java.util.UUID;
/**
* @author Susucr
*/
public final class RotisserieElemental extends CardImpl {
private static final DynamicValue xValue = new CountersSourceCount(CounterType.SKEWER);
public RotisserieElemental(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}");
this.subtype.add(SubType.ELEMENTAL);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Menace
this.addAbility(new MenaceAbility(false));
// Whenever Rotisserie Elemental deals combat damage to a player, put a skewer counter on Rotisserie Elemental. Then you may sacrifice it. If you do, exile the top X cards of your library, where X is the number of skewer counters on Rotisserie Elemental. You may play those cards this turn.
Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(
new AddCountersSourceEffect(CounterType.SKEWER.createInstance()),
false
);
ability.addEffect(new DoIfCostPaid(
new ExileTopXMayPlayUntilEndOfTurnEffect(xValue)
.setText("exile the top X cards of your library, where X is the number of skewer counters "
+ "on {this}. You may play those cards this turn"),
new SacrificeSourceCost().setText("sacrifice it")
).concatBy("Then"));
this.addAbility(ability);
}
private RotisserieElemental(final RotisserieElemental card) {
super(card);
}
@Override
public RotisserieElemental copy() {
return new RotisserieElemental(this);
}
}

View file

@ -126,6 +126,7 @@ public final class WildsOfEldraine extends ExpansionSet {
cards.add(new SetCardInfo("Return Triumphant", 26, Rarity.COMMON, mage.cards.r.ReturnTriumphant.class));
cards.add(new SetCardInfo("Return from the Wilds", 181, Rarity.COMMON, mage.cards.r.ReturnFromTheWilds.class));
cards.add(new SetCardInfo("Rootrider Faun", 182, Rarity.COMMON, mage.cards.r.RootriderFaun.class));
cards.add(new SetCardInfo("Rotisserie Elemental", 148, Rarity.RARE, mage.cards.r.RotisserieElemental.class));
cards.add(new SetCardInfo("Rowan's Grim Search", 104, Rarity.COMMON, mage.cards.r.RowansGrimSearch.class));
cards.add(new SetCardInfo("Rowan, Scion of War", 211, Rarity.MYTHIC, mage.cards.r.RowanScionOfWar.class));
cards.add(new SetCardInfo("Royal Treatment", 183, Rarity.UNCOMMON, mage.cards.r.RoyalTreatment.class));

View file

@ -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>");

View file

@ -176,6 +176,7 @@ public enum CounterType {
SHELL("shell"),
SHIELD("shield"),
SHRED("shred"),
SKEWER("skewer"),
SLEEP("sleep"),
SLIME("slime"),
SLUMBER("slumber"),