From 4546766c1ad635a7984fd9c5d42644cf88b21c43 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 17 Sep 2022 21:38:22 -0400 Subject: [PATCH] [40K] Implemented Canoptek Scarab Swarm --- .../src/mage/cards/c/CanoptekScarabSwarm.java | 91 +++++++++++++++++++ Mage.Sets/src/mage/sets/Warhammer40000.java | 1 + .../permanent/token/InsectColorlessToken.java | 34 +++++++ 3 files changed, 126 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/CanoptekScarabSwarm.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/InsectColorlessToken.java diff --git a/Mage.Sets/src/mage/cards/c/CanoptekScarabSwarm.java b/Mage.Sets/src/mage/cards/c/CanoptekScarabSwarm.java new file mode 100644 index 0000000000..bc4c9df7a8 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CanoptekScarabSwarm.java @@ -0,0 +1,91 @@ +package mage.cards.c; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.predicate.Predicates; +import mage.game.Game; +import mage.game.permanent.token.InsectColorlessToken; +import mage.players.Player; +import mage.target.TargetPlayer; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class CanoptekScarabSwarm extends CardImpl { + + public CanoptekScarabSwarm(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}"); + + this.subtype.add(SubType.INSECT); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Feeder Mandibles -- When Canoptek Scarab Swarm enters the battlefield, exile target player's graveyard. For each artifact or land card exiled this way, create a 1/1 colorless Insect artifact creature token with flying. + Ability ability = new EntersBattlefieldTriggeredAbility(new CanoptekScarabSwarmEffect()); + ability.addTarget(new TargetPlayer()); + this.addAbility(ability.withFlavorWord("Feeder Mandibles")); + } + + private CanoptekScarabSwarm(final CanoptekScarabSwarm card) { + super(card); + } + + @Override + public CanoptekScarabSwarm copy() { + return new CanoptekScarabSwarm(this); + } +} + +class CanoptekScarabSwarmEffect extends OneShotEffect { + + private static final FilterCard filter = new FilterCard(); + + static { + filter.add(Predicates.or( + CardType.ARTIFACT.getPredicate(), + CardType.LAND.getPredicate() + )); + } + + CanoptekScarabSwarmEffect() { + super(Outcome.Benefit); + staticText = "exile target player's graveyard. For each artifact or land card exiled this way, " + + "create a 1/1 colorless Insect artifact creature token with flying"; + } + + private CanoptekScarabSwarmEffect(final CanoptekScarabSwarmEffect effect) { + super(effect); + } + + @Override + public CanoptekScarabSwarmEffect copy() { + return new CanoptekScarabSwarmEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); + if (player == null) { + return false; + } + int count = player.getGraveyard().count(filter, game); + player.moveCards(player.getGraveyard(), Zone.EXILED, source, game); + new InsectColorlessToken().putOntoBattlefield(count, game, source); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Warhammer40000.java b/Mage.Sets/src/mage/sets/Warhammer40000.java index 16ca32327b..02564d36b2 100644 --- a/Mage.Sets/src/mage/sets/Warhammer40000.java +++ b/Mage.Sets/src/mage/sets/Warhammer40000.java @@ -50,6 +50,7 @@ public final class Warhammer40000 extends ExpansionSet { cards.add(new SetCardInfo("Bred for the Hunt", 222, Rarity.UNCOMMON, mage.cards.b.BredForTheHunt.class)); cards.add(new SetCardInfo("Broodlord", 89, Rarity.RARE, mage.cards.b.Broodlord.class)); cards.add(new SetCardInfo("Caged Sun", 231, Rarity.RARE, mage.cards.c.CagedSun.class)); + cards.add(new SetCardInfo("Canoptek Scarab Swarm", 150, Rarity.RARE, mage.cards.c.CanoptekScarabSwarm.class)); cards.add(new SetCardInfo("Canoptek Spyder", 151, Rarity.RARE, mage.cards.c.CanoptekSpyder.class)); cards.add(new SetCardInfo("Cave of Temptation", 267, Rarity.COMMON, mage.cards.c.CaveOfTemptation.class)); cards.add(new SetCardInfo("Chaos Defiler", 110, Rarity.RARE, mage.cards.c.ChaosDefiler.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/InsectColorlessToken.java b/Mage/src/main/java/mage/game/permanent/token/InsectColorlessToken.java new file mode 100644 index 0000000000..1caf1ec038 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/InsectColorlessToken.java @@ -0,0 +1,34 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.keyword.FlyingAbility; +import mage.constants.CardType; +import mage.constants.SubType; + +import java.util.Arrays; + +/** + * @author TheElk801 + */ +public final class InsectColorlessToken extends TokenImpl { + + public InsectColorlessToken() { + super("Insect Token", "1/1 colorless Insect creature token with flying"); + cardType.add(CardType.CREATURE); + subtype.add(SubType.INSECT); + power = new MageInt(1); + toughness = new MageInt(1); + + addAbility(FlyingAbility.getInstance()); + + availableImageSetCodes = Arrays.asList("40K"); + } + + public InsectColorlessToken(final InsectColorlessToken token) { + super(token); + } + + public InsectColorlessToken copy() { + return new InsectColorlessToken(this); + } +} \ No newline at end of file