[C21] Implemented Ruin Grinder

This commit is contained in:
Evan Kranzler 2021-04-11 21:06:29 -04:00
parent 34443f829d
commit 75dcf16f65
2 changed files with 89 additions and 0 deletions

View file

@ -0,0 +1,88 @@
package mage.cards.r;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.MenaceAbility;
import mage.abilities.keyword.MountaincyclingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.game.Game;
import mage.players.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class RuinGrinder extends CardImpl {
public RuinGrinder(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{5}{R}");
this.subtype.add(SubType.CONSTRUCT);
this.power = new MageInt(7);
this.toughness = new MageInt(4);
// Menace
this.addAbility(new MenaceAbility());
// When Ruin Grinder dies, each player may discard their hand and draw seven cards.
this.addAbility(new DiesSourceTriggeredAbility(new RuinGrinderEffect()));
// Mountaincycling {2}
this.addAbility(new MountaincyclingAbility(new ManaCostsImpl<>("{2}")));
}
private RuinGrinder(final RuinGrinder card) {
super(card);
}
@Override
public RuinGrinder copy() {
return new RuinGrinder(this);
}
}
class RuinGrinderEffect extends OneShotEffect {
RuinGrinderEffect() {
super(Outcome.Benefit);
staticText = "each player may discard their hand and draw seven cards";
}
private RuinGrinderEffect(final RuinGrinderEffect effect) {
super(effect);
}
@Override
public RuinGrinderEffect copy() {
return new RuinGrinderEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
List<Player> wheelers = new ArrayList<>();
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(source.getSourceId());
if (player != null && player.chooseUse(
Outcome.DrawCard, "Discard your hand and draw seven?", source, game
)) {
game.informPlayers(player.getName() + " chooses to discard their hand and draw seven");
wheelers.add(player);
}
}
for (Player player : wheelers) {
player.discard(player.getHand(), false, source, game);
player.drawCards(7, source, game);
}
return true;
}
}

View file

@ -182,6 +182,7 @@ public final class Commander2021Edition extends ExpansionSet {
cards.add(new SetCardInfo("Rite of Replication", 128, Rarity.RARE, mage.cards.r.RiteOfReplication.class));
cards.add(new SetCardInfo("Rousing Refrain", 56, Rarity.RARE, mage.cards.r.RousingRefrain.class));
cards.add(new SetCardInfo("Rout", 101, Rarity.RARE, mage.cards.r.Rout.class));
cards.add(new SetCardInfo("Ruin Grinder", 57, Rarity.RARE, mage.cards.r.RuinGrinder.class));
cards.add(new SetCardInfo("Sanctum Gargoyle", 102, Rarity.COMMON, mage.cards.s.SanctumGargoyle.class));
cards.add(new SetCardInfo("Scavenger Grounds", 314, Rarity.RARE, mage.cards.s.ScavengerGrounds.class));
cards.add(new SetCardInfo("Scrap Trawler", 260, Rarity.RARE, mage.cards.s.ScrapTrawler.class));