From ca5318e814edd98f7134eb2875771a35ce8eb2fe Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Thu, 4 Nov 2021 11:56:22 -0500 Subject: [PATCH] [VOW] Implemented Crawling Infestation --- .../src/mage/cards/c/CrawlingInfestation.java | 81 +++++++++++++++++++ .../src/mage/sets/InnistradCrimsonVow.java | 1 + 2 files changed, 82 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/CrawlingInfestation.java diff --git a/Mage.Sets/src/mage/cards/c/CrawlingInfestation.java b/Mage.Sets/src/mage/cards/c/CrawlingInfestation.java new file mode 100644 index 0000000000..fc5511c845 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CrawlingInfestation.java @@ -0,0 +1,81 @@ +package mage.cards.c; + +import java.util.UUID; + +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.MillCardsControllerEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.token.InsectToken; + +/** + * + * @author weirddan455 + */ +public final class CrawlingInfestation extends CardImpl { + + public CrawlingInfestation(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}"); + + // At the beginning of your upkeep, you may mill two cards. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new MillCardsControllerEffect(2), TargetController.YOU, true)); + + // Whenever one or more creature cards are put into your graveyard from anywhere during your turn, create a 1/1 green Insect creature token. This ability triggers only once each turn. + this.addAbility(new CrawlingInfestationTriggeredAbility()); + } + + private CrawlingInfestation(final CrawlingInfestation card) { + super(card); + } + + @Override + public CrawlingInfestation copy() { + return new CrawlingInfestation(this); + } +} + +class CrawlingInfestationTriggeredAbility extends TriggeredAbilityImpl { + + public CrawlingInfestationTriggeredAbility() { + super(Zone.BATTLEFIELD, new CreateTokenEffect(new InsectToken())); + this.setTriggersOnce(true); + } + + private CrawlingInfestationTriggeredAbility(final CrawlingInfestationTriggeredAbility ability) { + super(ability); + } + + @Override + public CrawlingInfestationTriggeredAbility copy() { + return new CrawlingInfestationTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ZONE_CHANGE; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.getToZone() == Zone.GRAVEYARD && game.isActivePlayer(controllerId)) { + Card card = game.getCard(zEvent.getTargetId()); + return card != null && !card.isCopy() && card.isCreature(game) && card.isOwnedBy(controllerId); + } + return false; + } + + @Override + public String getTriggerPhrase() { + return "Whenever one or more creature cards are put into your graveyard from anywhere during your turn, "; + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java b/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java index bdfd4d40c6..c2fe88c378 100644 --- a/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java +++ b/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java @@ -58,6 +58,7 @@ public final class InnistradCrimsonVow extends ExpansionSet { cards.add(new SetCardInfo("Cobbled Lancer", 52, Rarity.UNCOMMON, mage.cards.c.CobbledLancer.class)); cards.add(new SetCardInfo("Consuming Tide", 53, Rarity.RARE, mage.cards.c.ConsumingTide.class)); cards.add(new SetCardInfo("Courier Bat", 102, Rarity.COMMON, mage.cards.c.CourierBat.class)); + cards.add(new SetCardInfo("Crawling Infestation", 193, Rarity.UNCOMMON, mage.cards.c.CrawlingInfestation.class)); cards.add(new SetCardInfo("Dawnhart Disciple", 196, Rarity.COMMON, mage.cards.d.DawnhartDisciple.class)); cards.add(new SetCardInfo("Dawnhart Geist", 8, Rarity.UNCOMMON, mage.cards.d.DawnhartGeist.class)); cards.add(new SetCardInfo("Daybreak Combatants", 153, Rarity.COMMON, mage.cards.d.DaybreakCombatants.class));