From a71f33df9d284b7d578d4c6929015fbc12290ea4 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 3 Nov 2021 08:46:57 -0400 Subject: [PATCH] [VOW] Implemented Old Rutstein --- Mage.Sets/src/mage/cards/o/OldRutstein.java | 119 ++++++++++++++++++ .../src/mage/sets/InnistradCrimsonVow.java | 1 + 2 files changed, 120 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/o/OldRutstein.java diff --git a/Mage.Sets/src/mage/cards/o/OldRutstein.java b/Mage.Sets/src/mage/cards/o/OldRutstein.java new file mode 100644 index 0000000000..b69e178e12 --- /dev/null +++ b/Mage.Sets/src/mage/cards/o/OldRutstein.java @@ -0,0 +1,119 @@ +package mage.cards.o; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.constants.*; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.token.BloodToken; +import mage.game.permanent.token.InsectToken; +import mage.game.permanent.token.TreasureToken; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class OldRutstein extends CardImpl { + + public OldRutstein(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{G}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.PEASANT); + this.power = new MageInt(1); + this.toughness = new MageInt(4); + + // When Old Rutstein enters the battlefield or at the beginning of your upkeep, mill a card. If a land card is milled this way, create a Treasure token. If a creature card is milled this way, create a 1/1 green Insect creature token. If a noncreature, nonland card is milled this way, create a Blood token. + this.addAbility(new OldRutsteinTriggeredAbility()); + } + + private OldRutstein(final OldRutstein card) { + super(card); + } + + @Override + public OldRutstein copy() { + return new OldRutstein(this); + } +} + +class OldRutsteinTriggeredAbility extends TriggeredAbilityImpl { + + OldRutsteinTriggeredAbility() { + super(Zone.BATTLEFIELD, new OldRutsteinEffect()); + } + + private OldRutsteinTriggeredAbility(final OldRutsteinTriggeredAbility ability) { + super(ability); + } + + @Override + public OldRutsteinTriggeredAbility copy() { + return new OldRutsteinTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD + || event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { + return event.getTargetId().equals(getSourceId()); + } + return game.isActivePlayer(getControllerId()); + } + + @Override + public String getRule() { + return "When {this} enters the battlefield or at the beginning of your upkeep, mill a card. " + + "If a land card is milled this way, create a Treasure token. " + + "If a creature card is milled this way, create a 1/1 green Insect creature token. " + + "If a noncreature, nonland card is milled this way, create a Blood token."; + } +} + +class OldRutsteinEffect extends OneShotEffect { + + OldRutsteinEffect() { + super(Outcome.Benefit); + } + + private OldRutsteinEffect(final OldRutsteinEffect effect) { + super(effect); + } + + @Override + public OldRutsteinEffect copy() { + return new OldRutsteinEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Cards cards = player.millCards(1, source, game); + if (cards.getCards(game).stream().anyMatch(card -> card.isLand(game))) { + new TreasureToken().putOntoBattlefield(1, game, source, source.getControllerId()); + } + if (cards.getCards(game).stream().anyMatch(card -> card.isCreature(game))) { + new InsectToken().putOntoBattlefield(1, game, source, source.getControllerId()); + } + if (cards.getCards(game).stream().anyMatch(card -> !card.isCreature(game) && !card.isLand(game))) { + new BloodToken().putOntoBattlefield(1, game, source, source.getControllerId()); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java b/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java index 223809be14..076c73e1db 100644 --- a/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java +++ b/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java @@ -91,6 +91,7 @@ public final class InnistradCrimsonVow extends ExpansionSet { cards.add(new SetCardInfo("Mindleech Ghoul", 122, Rarity.COMMON, mage.cards.m.MindleechGhoul.class)); cards.add(new SetCardInfo("Mountain", 274, Rarity.LAND, mage.cards.basiclands.Mountain.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Mulch", 210, Rarity.COMMON, mage.cards.m.Mulch.class)); + cards.add(new SetCardInfo("Old Rutstein", 244, Rarity.RARE, mage.cards.o.OldRutstein.class)); cards.add(new SetCardInfo("Olivia, Crimson Bride", 245, Rarity.MYTHIC, mage.cards.o.OliviaCrimsonBride.class)); cards.add(new SetCardInfo("Overcharged Amalgam", 71, Rarity.RARE, mage.cards.o.OverchargedAmalgam.class)); cards.add(new SetCardInfo("Packsong Pup", 213, Rarity.UNCOMMON, mage.cards.p.PacksongPup.class));