diff --git a/Mage.Sets/src/mage/cards/f/FormlessGenesis.java b/Mage.Sets/src/mage/cards/f/FormlessGenesis.java new file mode 100644 index 00000000000..67ae762731f --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FormlessGenesis.java @@ -0,0 +1,84 @@ +package mage.cards.f; + +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.hint.Hint; +import mage.abilities.hint.ValueHint; +import mage.abilities.keyword.ChangelingAbility; +import mage.abilities.keyword.RetraceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.token.ShapeshifterDeathtouchToken; +import mage.players.Player; + +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class FormlessGenesis extends CardImpl { + + private static final Hint hint = new ValueHint( + "Lands in your graveyard", new CardsInControllerGraveyardCount(StaticFilters.FILTER_CARD_LAND) + ); + + public FormlessGenesis(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.KINDRED, CardType.SORCERY}, "{2}{G}"); + + this.subtype.add(SubType.SHAPESHIFTER); + + // Changeling + this.addAbility(new ChangelingAbility()); + + // Create an X/X colorless Shapeshifter creature token with changeling and deathtouch, where X is the number of land cards in your graveyard. + this.getSpellAbility().addEffect(new FormlessGenesisEffect()); + this.getSpellAbility().addHint(hint); + + // Retrace + this.addAbility(new RetraceAbility(this)); + } + + private FormlessGenesis(final FormlessGenesis card) { + super(card); + } + + @Override + public FormlessGenesis copy() { + return new FormlessGenesis(this); + } +} + +class FormlessGenesisEffect extends OneShotEffect { + + FormlessGenesisEffect() { + super(Outcome.Benefit); + staticText = "create an X/X colorless Shapeshifter creature token with changeling and deathtouch, " + + "where X is the number of land cards in your graveyard"; + } + + private FormlessGenesisEffect(final FormlessGenesisEffect effect) { + super(effect); + } + + @Override + public FormlessGenesisEffect copy() { + return new FormlessGenesisEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int amount = Optional + .ofNullable(game.getPlayer(source.getControllerId())) + .map(Player::getGraveyard) + .map(g -> g.count(StaticFilters.FILTER_CARD_LAND, game)) + .orElse(0); + return new ShapeshifterDeathtouchToken(amount).putOntoBattlefield(1, game, source); + } +} diff --git a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorrorCommander.java b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorrorCommander.java index 1ab3f889832..d93b6d02302 100644 --- a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorrorCommander.java +++ b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorrorCommander.java @@ -111,6 +111,7 @@ public final class DuskmournHouseOfHorrorCommander extends ExpansionSet { cards.add(new SetCardInfo("Flooded Grove", 276, Rarity.RARE, mage.cards.f.FloodedGrove.class)); cards.add(new SetCardInfo("Florian, Voldaren Scion", 217, Rarity.RARE, mage.cards.f.FlorianVoldarenScion.class)); cards.add(new SetCardInfo("Foreboding Ruins", 277, Rarity.RARE, mage.cards.f.ForebodingRuins.class)); + cards.add(new SetCardInfo("Formless Genesis", 34, Rarity.RARE, mage.cards.f.FormlessGenesis.class)); cards.add(new SetCardInfo("Geothermal Bog", 278, Rarity.COMMON, mage.cards.g.GeothermalBog.class)); cards.add(new SetCardInfo("Giant Adephage", 179, Rarity.MYTHIC, mage.cards.g.GiantAdephage.class)); cards.add(new SetCardInfo("Gleeful Arsonist", 27, Rarity.RARE, mage.cards.g.GleefulArsonist.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/ShapeshifterDeathtouchToken.java b/Mage/src/main/java/mage/game/permanent/token/ShapeshifterDeathtouchToken.java new file mode 100644 index 00000000000..32826ef9804 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/ShapeshifterDeathtouchToken.java @@ -0,0 +1,35 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.keyword.ChangelingAbility; +import mage.abilities.keyword.DeathtouchAbility; +import mage.constants.CardType; +import mage.constants.SubType; + +/** + * @author TheElk801 + */ +public final class ShapeshifterDeathtouchToken extends TokenImpl { + + public ShapeshifterDeathtouchToken() { + this(0); + } + + public ShapeshifterDeathtouchToken(int amount) { + super("Shapeshifter Token", "X/X colorless Shapeshifter creature token with changeling and deathtouch"); + cardType.add(CardType.CREATURE); + subtype.add(SubType.SHAPESHIFTER); + power = new MageInt(amount); + toughness = new MageInt(amount); + addAbility(new ChangelingAbility()); + addAbility(DeathtouchAbility.getInstance()); + } + + private ShapeshifterDeathtouchToken(final ShapeshifterDeathtouchToken token) { + super(token); + } + + public ShapeshifterDeathtouchToken copy() { + return new ShapeshifterDeathtouchToken(this); + } +}