From 80793c3cb5dce378832ef0a9a6fadca0897898a7 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Mon, 16 Jan 2023 17:12:37 -0500 Subject: [PATCH] [ONE] Implement Tyvar, Jubilant Brawler --- .../mage/cards/t/TyvarJubilantBrawler.java | 131 ++++++++++++++++++ .../src/mage/sets/PhyrexiaAllWillBeOne.java | 1 + 2 files changed, 132 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/TyvarJubilantBrawler.java diff --git a/Mage.Sets/src/mage/cards/t/TyvarJubilantBrawler.java b/Mage.Sets/src/mage/cards/t/TyvarJubilantBrawler.java new file mode 100644 index 0000000000..e7d25fce2c --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TyvarJubilantBrawler.java @@ -0,0 +1,131 @@ +package mage.cards.t; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.LoyaltyAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.AsThoughEffectImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.MillCardsControllerEffect; +import mage.abilities.effects.common.UntapTargetEffect; +import mage.cards.Card; +import mage.constants.*; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.filter.common.FilterCreatureCard; +import mage.filter.predicate.mageobject.ManaValuePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInYourGraveyard; +import mage.target.common.TargetCreaturePermanent; + +import static mage.constants.Outcome.Benefit; + +/** + * @author TheElk801 + */ +public final class TyvarJubilantBrawler extends CardImpl { + + public TyvarJubilantBrawler(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{1}{B}{G}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.TYVAR); + this.setStartingLoyalty(3); + + // You may activate abilities of creatures you control as though those creatures had haste. + this.addAbility(new SimpleStaticAbility(new TyvarJubilantBrawlerHasteEffect())); + + // +1: Untap up to one target creature. + Ability ability = new LoyaltyAbility(new UntapTargetEffect(), 1); + ability.addTarget(new TargetCreaturePermanent(0, 1)); + this.addAbility(ability); + + // -2: Mill three cards, then you may return a creature card with mana value 2 or less from your graveyard to the battlefield. + ability = new LoyaltyAbility(new MillCardsControllerEffect(3), -2); + ability.addEffect(new TyvarJubilantBrawlerReturnEffect()); + this.addAbility(ability); + } + + private TyvarJubilantBrawler(final TyvarJubilantBrawler card) { + super(card); + } + + @Override + public TyvarJubilantBrawler copy() { + return new TyvarJubilantBrawler(this); + } +} + +class TyvarJubilantBrawlerHasteEffect extends AsThoughEffectImpl { + + public TyvarJubilantBrawlerHasteEffect() { + super(AsThoughEffectType.ACTIVATE_HASTE, Duration.WhileOnBattlefield, Outcome.Benefit); + staticText = "you may activate abilities of creatures you control as though those creatures had haste"; + } + + public TyvarJubilantBrawlerHasteEffect(final TyvarJubilantBrawlerHasteEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public TyvarJubilantBrawlerHasteEffect copy() { + return new TyvarJubilantBrawlerHasteEffect(this); + } + + @Override + public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) { + Permanent permanent = game.getPermanent(sourceId); + return permanent != null + && permanent.isCreature(game) + && permanent.isControlledBy(source.getControllerId()); + } +} + +class TyvarJubilantBrawlerReturnEffect extends OneShotEffect { + + private static final FilterCard filter + = new FilterCreatureCard("creature card with mana value 2 or less from your graveyard"); + + static { + filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, 3)); + } + + TyvarJubilantBrawlerReturnEffect() { + super(Outcome.Benefit); + staticText = ", then you may return a creature card " + + "with mana value 2 or less from your graveyard to the battlefield"; + } + + private TyvarJubilantBrawlerReturnEffect(final TyvarJubilantBrawlerReturnEffect effect) { + super(effect); + } + + @Override + public TyvarJubilantBrawlerReturnEffect copy() { + return new TyvarJubilantBrawlerReturnEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + TargetCard target = new TargetCardInYourGraveyard(0, 1, filter); + target.setNotTarget(true); + player.choose(outcome, target, source, game); + Card card = game.getCard(target.getFirstTarget()); + return card != null && player.moveCards(card, Zone.BATTLEFIELD, source, game); + } +} diff --git a/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java b/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java index bbe357c220..bb65b19e43 100644 --- a/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java +++ b/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java @@ -54,6 +54,7 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet { cards.add(new SetCardInfo("Swamp", 274, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Tablet of Compleation", 245, Rarity.RARE, mage.cards.t.TabletOfCompleation.class)); cards.add(new SetCardInfo("The Monumental Facade", 255, Rarity.RARE, mage.cards.t.TheMonumentalFacade.class)); + cards.add(new SetCardInfo("Tyvar, Jubilant Brawler", 218, Rarity.RARE, mage.cards.t.TyvarJubilantBrawler.class)); cards.add(new SetCardInfo("Unctus Grand Metatect", 75, Rarity.RARE, mage.cards.u.UnctusGrandMetatect.class)); cards.add(new SetCardInfo("Urabrask's Forge", 153, Rarity.RARE, mage.cards.u.UrabrasksForge.class)); cards.add(new SetCardInfo("Venser, Corpse Puppet", 219, Rarity.RARE, mage.cards.v.VenserCorpsePuppet.class));