From ebfba73c617aa3f4375a1384c6146734e75add77 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 14 Apr 2020 22:40:47 -0400 Subject: [PATCH] Implemented Winota, Joiner of Forces --- .../mage/cards/w/WinotaJoinerOfForces.java | 112 ++++++++++++++++++ .../src/mage/sets/IkoriaLairOfBehemoths.java | 1 + 2 files changed, 113 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/w/WinotaJoinerOfForces.java diff --git a/Mage.Sets/src/mage/cards/w/WinotaJoinerOfForces.java b/Mage.Sets/src/mage/cards/w/WinotaJoinerOfForces.java new file mode 100644 index 0000000000..9f78f63676 --- /dev/null +++ b/Mage.Sets/src/mage/cards/w/WinotaJoinerOfForces.java @@ -0,0 +1,112 @@ +package mage.cards.w; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksCreatureYouControlTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.IndestructibleAbility; +import mage.cards.*; +import mage.constants.*; +import mage.filter.FilterCard; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterCreatureCard; +import mage.filter.predicate.Predicates; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCardInLibrary; +import mage.target.targetpointer.FixedTarget; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class WinotaJoinerOfForces extends CardImpl { + + private static final FilterControlledCreaturePermanent filter + = new FilterControlledCreaturePermanent("non-Human creature you control"); + + static { + filter.add(Predicates.not(SubType.HUMAN.getPredicate())); + } + + public WinotaJoinerOfForces(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{W}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.WARRIOR); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Whenever a non-Human creature you control attacks, look at the top six cards of your library. You may put a Human creature card from among them onto the battlefield tapped and attacking. It gains indestructible until end of turn. Put the rest of the cards on the bottom of your library in a random order. + this.addAbility(new AttacksCreatureYouControlTriggeredAbility( + new WinotaJoinerOfForcesEffect(), false, filter + )); + } + + private WinotaJoinerOfForces(final WinotaJoinerOfForces card) { + super(card); + } + + @Override + public WinotaJoinerOfForces copy() { + return new WinotaJoinerOfForces(this); + } +} + +class WinotaJoinerOfForcesEffect extends OneShotEffect { + + private static final FilterCard filter = new FilterCreatureCard("Human creature card"); + + static { + filter.add(SubType.HUMAN.getPredicate()); + } + + WinotaJoinerOfForcesEffect() { + super(Outcome.Benefit); + staticText = "look at the top six cards of your library. " + + "You may put a Human creature card from among them onto the battlefield tapped and attacking. " + + "It gains indestructible until end of turn. " + + "Put the rest of the cards on the bottom of your library in a random order."; + } + + private WinotaJoinerOfForcesEffect(final WinotaJoinerOfForcesEffect effect) { + super(effect); + } + + @Override + public WinotaJoinerOfForcesEffect copy() { + return new WinotaJoinerOfForcesEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 6)); + TargetCardInLibrary targetCardInLibrary = new TargetCardInLibrary(0, 1, filter); + player.choose(outcome, cards, targetCardInLibrary, game); + Card card = game.getCard(targetCardInLibrary.getFirstTarget()); + if (card == null || !player.moveCards( + card, Zone.BATTLEFIELD, source, game, true, + false, true, null + )) { + return player.putCardsOnBottomOfLibrary(cards, game, source, false); + } + Permanent permanent = game.getPermanent(card.getId()); + if (permanent == null) { + return player.putCardsOnBottomOfLibrary(cards, game, source, false); + } + game.getCombat().addAttackingCreature(permanent.getId(), game); + cards.remove(card); + game.addEffect(new GainAbilityTargetEffect( + IndestructibleAbility.getInstance(), Duration.EndOfTurn + ).setTargetPointer(new FixedTarget(permanent, game)), source); + return player.putCardsOnBottomOfLibrary(cards, game, source, false); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java b/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java index 039f232ddb..f6c35085bf 100644 --- a/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java +++ b/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java @@ -322,6 +322,7 @@ public final class IkoriaLairOfBehemoths extends ExpansionSet { cards.add(new SetCardInfo("Wind-Scarred Crag", 258, Rarity.COMMON, mage.cards.w.WindScarredCrag.class)); cards.add(new SetCardInfo("Wingfold Pteron", 71, Rarity.COMMON, mage.cards.w.WingfoldPteron.class)); cards.add(new SetCardInfo("Wingspan Mentor", 72, Rarity.UNCOMMON, mage.cards.w.WingspanMentor.class)); + cards.add(new SetCardInfo("Winota, Joiner of Forces", 216, Rarity.MYTHIC, mage.cards.w.WinotaJoinerOfForces.class)); cards.add(new SetCardInfo("Yidaro, Wandering Monster", 141, Rarity.RARE, mage.cards.y.YidaroWanderingMonster.class)); cards.add(new SetCardInfo("Zagoth Crystal", 242, Rarity.UNCOMMON, mage.cards.z.ZagothCrystal.class)); cards.add(new SetCardInfo("Zagoth Mamba", 106, Rarity.UNCOMMON, mage.cards.z.ZagothMamba.class));