diff --git a/Mage.Sets/src/mage/cards/t/TheNecrobloom.java b/Mage.Sets/src/mage/cards/t/TheNecrobloom.java new file mode 100644 index 00000000000..d8bcf612d77 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TheNecrobloom.java @@ -0,0 +1,111 @@ +package mage.cards.t; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.LandfallAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.keyword.DredgeAbility; +import mage.cards.Card; +import mage.constants.*; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.token.PlantToken; +import mage.game.permanent.token.ZombieToken; +import mage.players.Player; + +/** + * + * @author Grath + */ +public final class TheNecrobloom extends CardImpl { + + public TheNecrobloom(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{B}{G}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.PLANT); + this.power = new MageInt(2); + this.toughness = new MageInt(7); + + // Landfall -- Whenever a land enters the battlefield under your control, create a 0/1 green Plant creature + // token. If you control seven or more lands with different names, create a 2/2 black Zombie creature token + // instead. + this.addAbility(new LandfallAbility(new ConditionalOneShotEffect( + new CreateTokenEffect(new ZombieToken()), + new CreateTokenEffect(new PlantToken()), + TheNecrobloomCondition.instance, "create a 0/1 green Plant creature token. If you control " + + "seven or more lands with different names, create 2/2 black Zombie creature token instead" + ))); + + // Land cards in your graveyard have dredge 2. + this.addAbility(new SimpleStaticAbility(new TheNecrobloomDredgeEffect())); + } + + private TheNecrobloom(final TheNecrobloom card) { + super(card); + } + + @Override + public TheNecrobloom copy() { + return new TheNecrobloom(this); + } +} + +enum TheNecrobloomCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + return game + .getBattlefield() + .getAllActivePermanents(StaticFilters.FILTER_LAND, source.getControllerId(), game) + .stream() + .map(permanent -> permanent.getName()) + .filter(s -> s.length() > 0) + .distinct() + .count() > 6; + } +} + +class TheNecrobloomDredgeEffect extends ContinuousEffectImpl { + + TheNecrobloomDredgeEffect() { + super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); + this.staticText = "Land cards in your graveyard have dredge 2."; + } + + private TheNecrobloomDredgeEffect(final TheNecrobloomDredgeEffect effect) { + super(effect); + } + + @Override + public TheNecrobloomDredgeEffect copy() { + return new TheNecrobloomDredgeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + for (Card card : player.getGraveyard().getCards(StaticFilters.FILTER_CARD_LAND, game)) { + Ability ability = new DredgeAbility(2); + ability.setSourceId(card.getId()); + ability.setControllerId(card.getOwnerId()); + game.getState().addOtherAbility(card, ability); + } + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/ModernHorizons3.java b/Mage.Sets/src/mage/sets/ModernHorizons3.java index 4c84c1e2f3e..719cab2868f 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons3.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons3.java @@ -141,6 +141,7 @@ public final class ModernHorizons3 extends ExpansionSet { cards.add(new SetCardInfo("Tamiyo, Seasoned Scholar", 242, Rarity.MYTHIC, mage.cards.t.TamiyoSeasonedScholar.class)); cards.add(new SetCardInfo("Temperamental Oozewagg", 172, Rarity.COMMON, mage.cards.t.TemperamentalOozewagg.class)); cards.add(new SetCardInfo("Tempest Harvester", 73, Rarity.COMMON, mage.cards.t.TempestHarvester.class)); + cards.add(new SetCardInfo("The Necrobloom", 194, Rarity.RARE, mage.cards.t.TheNecrobloom.class)); cards.add(new SetCardInfo("Thraben Charm", 45, Rarity.COMMON, mage.cards.t.ThrabenCharm.class)); cards.add(new SetCardInfo("Toxic Deluge", 277, Rarity.RARE, mage.cards.t.ToxicDeluge.class)); cards.add(new SetCardInfo("Trickster's Elk", 175, Rarity.UNCOMMON, mage.cards.t.TrickstersElk.class));