[MOM] Implement Rona, Herald of Invasion / Rona Tolarian Obliterator

This commit is contained in:
theelk801 2023-04-10 19:50:02 -04:00
parent 6e9319d268
commit de6a09789e
3 changed files with 190 additions and 0 deletions

View file

@ -0,0 +1,64 @@
package mage.cards.r;
import mage.MageInt;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DrawDiscardControllerEffect;
import mage.abilities.effects.common.TransformSourceEffect;
import mage.abilities.effects.common.UntapSourceEffect;
import mage.abilities.keyword.TransformAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterSpell;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class RonaHeraldOfInvasion extends CardImpl {
private static final FilterSpell filter = new FilterSpell("a legendary spell");
static {
filter.add(SuperType.LEGENDARY.getPredicate());
}
public RonaHeraldOfInvasion(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(1);
this.toughness = new MageInt(3);
this.secondSideCardClazz = mage.cards.r.RonaTolarianObliterator.class;
// Whenever you cast a legendary spell, untap Rona, Herald of Invasion.
this.addAbility(new SpellCastControllerTriggeredAbility(new UntapSourceEffect(), filter, false));
// {T}: Draw a card, then discard a card.
this.addAbility(new SimpleActivatedAbility(
new DrawDiscardControllerEffect(1, 1), new TapSourceCost()
));
// {5}{B/P}: Transform Rona. Activate only as a sorcery.
this.addAbility(new TransformAbility());
this.addAbility(new ActivateAsSorceryActivatedAbility(new TransformSourceEffect(), new ManaCostsImpl<>("{5}{B/P}")));
}
private RonaHeraldOfInvasion(final RonaHeraldOfInvasion card) {
super(card);
}
@Override
public RonaHeraldOfInvasion copy() {
return new RonaHeraldOfInvasion(this);
}
}

View file

@ -0,0 +1,124 @@
package mage.cards.r;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class RonaTolarianObliterator extends CardImpl {
public RonaTolarianObliterator(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.PHYREXIAN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(5);
this.toughness = new MageInt(5);
this.color.setBlue(true);
this.color.setBlack(true);
this.nightCard = true;
// Trample
this.addAbility(TrampleAbility.getInstance());
// Whenever a source deals damage to Rona, Tolarian Obliterator, that source's controller exiles a card from their hand at random. If it's a land card, you may put it onto the battlefield under your control. Otherwise, you may cast it without paying its mana cost.
this.addAbility(new RonaTolarianObliteratorTriggeredAbility());
}
private RonaTolarianObliterator(final RonaTolarianObliterator card) {
super(card);
}
@Override
public RonaTolarianObliterator copy() {
return new RonaTolarianObliterator(this);
}
}
class RonaTolarianObliteratorTriggeredAbility extends TriggeredAbilityImpl {
RonaTolarianObliteratorTriggeredAbility() {
super(Zone.BATTLEFIELD, new RonaTolarianObliteratorEffect());
}
private RonaTolarianObliteratorTriggeredAbility(final RonaTolarianObliteratorTriggeredAbility ability) {
super(ability);
}
@Override
public RonaTolarianObliteratorTriggeredAbility copy() {
return new RonaTolarianObliteratorTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getTargetId().equals(getSourceId())) {
this.getEffects().setTargetPointer(new FixedTarget(game.getControllerId(event.getSourceId())));
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever a source deals damage to {this}, that source's controller exiles a card " +
"from their hand at random. If it's a land card, you may put it onto the battlefield " +
"under your control. Otherwise, you may cast it without paying its mana cost.";
}
}
class RonaTolarianObliteratorEffect extends OneShotEffect {
RonaTolarianObliteratorEffect() {
super(Outcome.Benefit);
}
private RonaTolarianObliteratorEffect(final RonaTolarianObliteratorEffect effect) {
super(effect);
}
@Override
public RonaTolarianObliteratorEffect copy() {
return new RonaTolarianObliteratorEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
if (controller == null || player == null) {
return false;
}
Card card = player.getHand().getRandom(game);
if (card == null) {
return false;
}
player.moveCards(card, Zone.EXILED, source, game);
if (!card.isLand(game)) {
return CardUtil.castSpellWithAttributesForFree(controller, source, game, card);
}
return controller.chooseUse(Outcome.PutLandInPlay, "Put " + card.getIdName() + " onto the battlefield?", source, game)
&& controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}

View file

@ -189,6 +189,8 @@ public final class MarchOfTheMachine extends ExpansionSet {
cards.add(new SetCardInfo("Realmbreaker's Grasp", 33, Rarity.COMMON, mage.cards.r.RealmbreakersGrasp.class));
cards.add(new SetCardInfo("Redcap Heelslasher", 161, Rarity.COMMON, mage.cards.r.RedcapHeelslasher.class));
cards.add(new SetCardInfo("Referee Squad", 327, Rarity.UNCOMMON, mage.cards.r.RefereeSquad.class));
cards.add(new SetCardInfo("Rona, Herald of Invasion", 75, Rarity.RARE, mage.cards.r.RonaHeraldOfInvasion.class));
cards.add(new SetCardInfo("Rona, Tolarian Obliterator", 75, Rarity.RARE, mage.cards.r.RonaTolarianObliterator.class));
cards.add(new SetCardInfo("Rugged Highlands", 271, Rarity.COMMON, mage.cards.r.RuggedHighlands.class));
cards.add(new SetCardInfo("Ruins Recluse", 336, Rarity.UNCOMMON, mage.cards.r.RuinsRecluse.class));
cards.add(new SetCardInfo("Saiba Cryptomancer", 76, Rarity.COMMON, mage.cards.s.SaibaCryptomancer.class));