diff --git a/Mage.Sets/src/mage/cards/p/PoppetFactory.java b/Mage.Sets/src/mage/cards/p/PoppetFactory.java new file mode 100644 index 0000000000..b4a7985bb2 --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/PoppetFactory.java @@ -0,0 +1,102 @@ +package mage.cards.p; + +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.common.TransformSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.permanent.TokenPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class PoppetFactory extends CardImpl { + + public PoppetFactory(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, ""); + + this.color.setBlue(true); + this.nightCard = true; + this.transformable = true; + + // Creature tokens you control lose all abilities and have base power and toughness 3/3. + this.addAbility(new SimpleStaticAbility(new PoppetFactoryEffect())); + + // At the beginning of your upkeep, you may transform Poppet Factory. + this.addAbility(new BeginningOfUpkeepTriggeredAbility( + new TransformSourceEffect(false), TargetController.YOU, true + )); + } + + private PoppetFactory(final PoppetFactory card) { + super(card); + } + + @Override + public PoppetFactory copy() { + return new PoppetFactory(this); + } +} + +class PoppetFactoryEffect extends ContinuousEffectImpl { + + private static final FilterPermanent filter = new FilterControlledCreaturePermanent(); + + static { + filter.add(TokenPredicate.TRUE); + } + + PoppetFactoryEffect() { + super(Duration.WhileOnBattlefield, Outcome.LoseAbility); + staticText = "creature tokens you control lose all abilities and have base power and toughness 3/3"; + } + + private PoppetFactoryEffect(final PoppetFactoryEffect effect) { + super(effect); + } + + @Override + public PoppetFactoryEffect copy() { + return new PoppetFactoryEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + return false; + } + + @Override + public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { + for (Permanent permanent : game.getBattlefield().getActivePermanents( + filter, source.getControllerId(), source.getSourceId(), game + )) { + switch (layer) { + case AbilityAddingRemovingEffects_6: + permanent.removeAllAbilities(source.getSourceId(), game); + break; + case PTChangingEffects_7: + if (sublayer == SubLayer.SetPT_7b) { + permanent.getPower().setValue(3); + permanent.getToughness().setValue(3); + } + break; + } + } + return true; + } + + @Override + public boolean hasLayer(Layer layer) { + return layer == Layer.PTChangingEffects_7 + || layer == Layer.AbilityAddingRemovingEffects_6; + } +} diff --git a/Mage.Sets/src/mage/cards/p/PoppetStitcher.java b/Mage.Sets/src/mage/cards/p/PoppetStitcher.java new file mode 100644 index 0000000000..7cd11c4d79 --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/PoppetStitcher.java @@ -0,0 +1,74 @@ +package mage.cards.p; + +import mage.MageInt; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.condition.Condition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.TransformSourceEffect; +import mage.abilities.hint.Hint; +import mage.abilities.hint.ValueHint; +import mage.abilities.keyword.TransformAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.ComparisonType; +import mage.constants.SubType; +import mage.constants.TargetController; +import mage.filter.StaticFilters; +import mage.game.permanent.token.ZombieDecayedToken; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class PoppetStitcher extends CardImpl { + + private static final Condition condition = new PermanentsOnTheBattlefieldCondition( + StaticFilters.FILTER_CREATURE_TOKEN, ComparisonType.MORE_THAN, 2 + ); + private static final Hint hint = new ValueHint( + "Creature tokens you control", new PermanentsOnBattlefieldCount(StaticFilters.FILTER_CREATURE_TOKEN) + ); + + public PoppetStitcher(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + this.transformable = true; + this.secondSideCardClazz = mage.cards.p.PoppetFactory.class; + + // Whenever you cast an instant or sorcery spell, create a 2/2 black Zombie creature token with decayed. + this.addAbility(new SpellCastControllerTriggeredAbility( + new CreateTokenEffect(new ZombieDecayedToken()), + StaticFilters.FILTER_SPELL_AN_INSTANT_OR_SORCERY, false + )); + + // At the beginning of your upkeep, if you control three or more creature tokens, you may transform Poppet Sticher. + this.addAbility(new TransformAbility()); + this.addAbility(new ConditionalInterveningIfTriggeredAbility( + new BeginningOfUpkeepTriggeredAbility( + new TransformSourceEffect(true), + TargetController.YOU, true + ), condition, "At the beginning of your upkeep, " + + "if you control three or more creature tokens, you may transform {this}." + ).addHint(hint)); + } + + private PoppetStitcher(final PoppetStitcher card) { + super(card); + } + + @Override + public PoppetStitcher copy() { + return new PoppetStitcher(this); + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java index cb19ced775..af99cc4636 100644 --- a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java +++ b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java @@ -57,6 +57,8 @@ public final class InnistradMidnightHunt extends ExpansionSet { cards.add(new SetCardInfo("Pithing Needle", 257, Rarity.RARE, mage.cards.p.PithingNeedle.class)); cards.add(new SetCardInfo("Plains", 268, Rarity.LAND, mage.cards.basiclands.Plains.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Play with Fire", 154, Rarity.UNCOMMON, mage.cards.p.PlayWithFire.class)); + cards.add(new SetCardInfo("Poppet Factory", 71, Rarity.MYTHIC, mage.cards.p.PoppetFactory.class)); + cards.add(new SetCardInfo("Poppet Stitcher", 71, Rarity.MYTHIC, mage.cards.p.PoppetStitcher.class)); cards.add(new SetCardInfo("Rite of Harmony", 236, Rarity.RARE, mage.cards.r.RiteOfHarmony.class)); cards.add(new SetCardInfo("Rockfall Vale", 266, Rarity.RARE, mage.cards.r.RockfallVale.class)); cards.add(new SetCardInfo("Saryth, the Viper's Fang", 197, Rarity.RARE, mage.cards.s.SarythTheVipersFang.class)); diff --git a/Utils/mtg-cards-data.txt b/Utils/mtg-cards-data.txt index 20d298f095..20e2633361 100644 --- a/Utils/mtg-cards-data.txt +++ b/Utils/mtg-cards-data.txt @@ -42185,7 +42185,7 @@ Hook-Haunt Drifter|Innistrad: Midnight Hunt|42|C||Creature - Spirit|1|2|Flying$I Consider|Innistrad: Midnight Hunt|44|C|{U}|Instant|||Look at the top card of your library. You may put that card into your graveyard.$Draw a card.| Dissipate|Innistrad: Midnight Hunt|49|U|{1}{U}{U}|Instant|||Counter target spell. If that spell is countered this way, exile it instead of putting it into its owner's graveyard.| Ominous Roost|Innistrad: Midnight Hunt|65|U|{2}{U}|Enchantment|||When Ominous Roost enters the battlefield or whenever you cast a spell from your graveyard, create a 1/1 blue Bird creature token with flying and "This creature can block only creatures with flying."| -Poppet Sticher|Innistrad: Midnight Hunt|71l|M|{2}{U}|Creature - Human Wizard|2|3|Whenever you cast an instant or sorcery spell, create a 2/2 black Zombie creature token with decayed.$At the beginning of your upkeep, if you control three or more creature tokens, you may transform Poppet Sticher.| +Poppet Stitcher|Innistrad: Midnight Hunt|71l|M|{2}{U}|Creature - Human Wizard|2|3|Whenever you cast an instant or sorcery spell, create a 2/2 black Zombie creature token with decayed.$At the beginning of your upkeep, if you control three or more creature tokens, you may transform Poppet Sticher.| Poppet Factory|Innistrad: Midnight Hunt|71l|M||Artifact|||Creature tokens you control lose all abilities and have base power and toughness 3/3.$At the beginning of your upkeep, you may transform Poppet Factory.| Secrets of the Key|Innistrad: Midnight Hunt|73|C|{U}|Instant|||Investigate. If this spell was cast from a graveyard, investigate twice instead.$Flashback {3}{U}| Stormrider Spirit|Innistrad: Midnight Hunt|79|C|{4}{U}|Creature - Spirit|3|3|Flash$Flying|