From 03a6891a9aadead2b4a0a03ca2eca094eb5abaf3 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 18 Apr 2020 20:52:56 -0400 Subject: [PATCH] Implemented Fireflux Squad --- Mage.Sets/src/mage/cards/f/FirefluxSquad.java | 111 ++++++++++++++++++ .../src/mage/sets/Commander2020Edition.java | 1 + 2 files changed, 112 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/f/FirefluxSquad.java diff --git a/Mage.Sets/src/mage/cards/f/FirefluxSquad.java b/Mage.Sets/src/mage/cards/f/FirefluxSquad.java new file mode 100644 index 0000000000..a8ee0e5add --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FirefluxSquad.java @@ -0,0 +1,111 @@ +package mage.cards.f; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.HasteAbility; +import mage.cards.*; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.predicate.permanent.AttackingPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class FirefluxSquad extends CardImpl { + + private static final FilterPermanent filter = new FilterControlledCreaturePermanent(""); + + static { + filter.add(AnotherPredicate.instance); + filter.add(AttackingPredicate.instance); + } + + public FirefluxSquad(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.SOLDIER); + this.power = new MageInt(4); + this.toughness = new MageInt(3); + + // Haste + this.addAbility(HasteAbility.getInstance()); + + // Whenever Fireflux Squad attacks, you may exile another target attacking creature you control. If you do, reveal cards from the top of your library until you reveal a creature card. Put that card onto the battlefield tapped and attacking and the rest on the bottom of your library in a random order. + Ability ability = new AttacksTriggeredAbility(new FirefluxSquadEffect(), true); + ability.addTarget(new TargetPermanent(filter)); + this.addAbility(ability); + } + + private FirefluxSquad(final FirefluxSquad card) { + super(card); + } + + @Override + public FirefluxSquad copy() { + return new FirefluxSquad(this); + } +} + +class FirefluxSquadEffect extends OneShotEffect { + + FirefluxSquadEffect() { + super(Outcome.Benefit); + staticText = "exile another target attacking creature you control. If you do, " + + "reveal cards from the top of your library until you reveal a creature card. " + + "Put that card onto the battlefield tapped and attacking " + + "and the rest on the bottom of your library in a random order."; + } + + private FirefluxSquadEffect(final FirefluxSquadEffect effect) { + super(effect); + } + + @Override + public FirefluxSquadEffect copy() { + return new FirefluxSquadEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Permanent permanent = game.getPermanent(source.getFirstTarget()); + if (player == null || permanent == null) { + return false; + } + player.moveCards(permanent, Zone.EXILED, source, game); + Card toBattlefield = null; + Cards cards = new CardsImpl(); + for (Card card : player.getLibrary().getCards(game)) { + cards.add(card); + if (card != null && card.isCreature()) { + toBattlefield = card; + break; + } + } + player.revealCards(source, cards, game); + if (toBattlefield == null) { + return player.putCardsOnBottomOfLibrary(cards, game, source, false); + } + player.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game, true, false, true, null); + permanent = game.getPermanent(toBattlefield.getId()); + if (permanent != null) { + cards.remove(toBattlefield); + game.getCombat().addAttackingCreature(permanent.getId(), game); + } + return player.putCardsOnBottomOfLibrary(cards, game, source, false); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Commander2020Edition.java b/Mage.Sets/src/mage/sets/Commander2020Edition.java index 52358217dd..8319384e4f 100644 --- a/Mage.Sets/src/mage/sets/Commander2020Edition.java +++ b/Mage.Sets/src/mage/sets/Commander2020Edition.java @@ -130,6 +130,7 @@ public final class Commander2020Edition extends ExpansionSet { cards.add(new SetCardInfo("Exotic Orchard", 273, Rarity.RARE, mage.cards.e.ExoticOrchard.class)); cards.add(new SetCardInfo("Fierce Guardianship", 35, Rarity.RARE, mage.cards.f.FierceGuardianship.class)); cards.add(new SetCardInfo("Find // Finality", 212, Rarity.RARE, mage.cards.f.FindFinality.class)); + cards.add(new SetCardInfo("Fireflux Squad", 51, Rarity.RARE, mage.cards.f.FirefluxSquad.class)); cards.add(new SetCardInfo("Flawless Maneuver", 26, Rarity.RARE, mage.cards.f.FlawlessManeuver.class)); cards.add(new SetCardInfo("Fluctuator", 241, Rarity.RARE, mage.cards.f.Fluctuator.class)); cards.add(new SetCardInfo("Forgotten Cave", 274, Rarity.UNCOMMON, mage.cards.f.ForgottenCave.class));