From b7cd8f8c6e846a2318f799f8dce9b37f9f5edf70 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Mon, 8 May 2023 17:59:17 -0400 Subject: [PATCH] [MAT] Implement Rocco, Street Chef --- .../src/mage/cards/r/RoccoStreetChef.java | 123 ++++++++++++++++++ .../sets/MarchOfTheMachineTheAftermath.java | 1 + 2 files changed, 124 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/r/RoccoStreetChef.java diff --git a/Mage.Sets/src/mage/cards/r/RoccoStreetChef.java b/Mage.Sets/src/mage/cards/r/RoccoStreetChef.java new file mode 100644 index 0000000000..d3c2dc719a --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RoccoStreetChef.java @@ -0,0 +1,123 @@ +package mage.cards.r; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.token.TreasureToken; +import mage.players.Player; +import mage.target.common.TargetCreaturePermanent; +import mage.util.CardUtil; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class RoccoStreetChef extends CardImpl { + + public RoccoStreetChef(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}{G}{W}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.ELF); + this.subtype.add(SubType.DRUID); + this.power = new MageInt(2); + this.toughness = new MageInt(4); + + // At the beginning of your end step, each player exiles the top card of their library. Until your next end step, each player may play the card they exiled this way. + this.addAbility(new BeginningOfEndStepTriggeredAbility( + new RoccoStreetChefEffect(), TargetController.YOU, false + )); + + // Whenever a player plays a land from exile or casts a spell from exile, you put a +1/+1 counter on target creature and create a Food token. + this.addAbility(new RoccoStreetChefTriggeredAbility()); + } + + private RoccoStreetChef(final RoccoStreetChef card) { + super(card); + } + + @Override + public RoccoStreetChef copy() { + return new RoccoStreetChef(this); + } +} + +class RoccoStreetChefEffect extends OneShotEffect { + + RoccoStreetChefEffect() { + super(Outcome.Benefit); + staticText = "each player exiles the top card of their library. " + + "Until your next end step, each player may play the card they exiled this way"; + } + + private RoccoStreetChefEffect(final RoccoStreetChefEffect effect) { + super(effect); + } + + @Override + public RoccoStreetChefEffect copy() { + return new RoccoStreetChefEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { + Player player = game.getPlayer(playerId); + if (player == null) { + continue; + } + Card card = player.getLibrary().getFromTop(game); + if (card == null) { + continue; + } + player.moveCards(card, Zone.EXILED, source, game); + CardUtil.makeCardPlayable( + game, source, card, Duration.UntilYourNextEndStep, + false, playerId, null + ); + } + return true; + } +} + +class RoccoStreetChefTriggeredAbility extends TriggeredAbilityImpl { + + RoccoStreetChefTriggeredAbility() { + super(Zone.BATTLEFIELD, new AddCountersTargetEffect(CounterType.P1P1.createInstance()), true); + this.addEffect(new CreateTokenEffect(new TreasureToken()).concatBy("and")); + this.addTarget(new TargetCreaturePermanent()); + this.setTriggerPhrase("Whenever a player plays a land from exile or casts a spell from exile, "); + } + + private RoccoStreetChefTriggeredAbility(final RoccoStreetChefTriggeredAbility ability) { + super(ability); + } + + @Override + public RoccoStreetChefTriggeredAbility copy() { + return new RoccoStreetChefTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.LAND_PLAYED + || event.getType() == GameEvent.EventType.SPELL_CAST; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + return event.getZone() == Zone.EXILED; + } +} diff --git a/Mage.Sets/src/mage/sets/MarchOfTheMachineTheAftermath.java b/Mage.Sets/src/mage/sets/MarchOfTheMachineTheAftermath.java index fe3b7f0791..a90abb4be8 100644 --- a/Mage.Sets/src/mage/sets/MarchOfTheMachineTheAftermath.java +++ b/Mage.Sets/src/mage/sets/MarchOfTheMachineTheAftermath.java @@ -53,6 +53,7 @@ public final class MarchOfTheMachineTheAftermath extends ExpansionSet { cards.add(new SetCardInfo("Plargg and Nassari", 18, Rarity.RARE, mage.cards.p.PlarggAndNassari.class)); cards.add(new SetCardInfo("Rebuild the City", 43, Rarity.RARE, mage.cards.r.RebuildTheCity.class)); cards.add(new SetCardInfo("Reckless Handling", 19, Rarity.UNCOMMON, mage.cards.r.RecklessHandling.class)); + cards.add(new SetCardInfo("Rocco, Street Chef", 44, Rarity.RARE, mage.cards.r.RoccoStreetChef.class)); cards.add(new SetCardInfo("Samut, Vizier of Naktamun", 45, Rarity.MYTHIC, mage.cards.s.SamutVizierOfNaktamun.class)); cards.add(new SetCardInfo("Sarkhan, Soul Aflame", 46, Rarity.MYTHIC, mage.cards.s.SarkhanSoulAflame.class)); cards.add(new SetCardInfo("Sigarda, Font of Blessings", 47, Rarity.RARE, mage.cards.s.SigardaFontOfBlessings.class));