[MOM] Implement Furnace Goblin

This commit is contained in:
theelk801 2023-04-04 09:03:09 -04:00
parent c23f48e2ad
commit 3a48b64cd7
2 changed files with 83 additions and 0 deletions

View file

@ -0,0 +1,82 @@
package mage.cards.f;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.keyword.IncubateEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.game.Game;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class FurnaceGremlin extends CardImpl {
public FurnaceGremlin(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.subtype.add(SubType.PHYREXIAN);
this.subtype.add(SubType.GREMLIN);
this.power = new MageInt(1);
this.toughness = new MageInt(2);
// {1}{R}: Furnace Gremlin gets +1/+0 until end of turn.
this.addAbility(new SimpleActivatedAbility(
new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl<>("{1}{R}")
));
// When Furnace Gremlin dies, incubate X, where X is Furnace Gremlin's power.
this.addAbility(new DiesSourceTriggeredAbility(new FurnaceGremlinEffect()));
}
private FurnaceGremlin(final FurnaceGremlin card) {
super(card);
}
@Override
public FurnaceGremlin copy() {
return new FurnaceGremlin(this);
}
}
class FurnaceGremlinEffect extends OneShotEffect {
FurnaceGremlinEffect() {
super(Outcome.Benefit);
staticText = "incubate X, where X is {this}'s power";
}
private FurnaceGremlinEffect(final FurnaceGremlinEffect effect) {
super(effect);
}
@Override
public FurnaceGremlinEffect copy() {
return new FurnaceGremlinEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int power = Optional
.ofNullable(source.getSourcePermanentOrLKI(game))
.filter(Objects::nonNull)
.map(MageObject::getPower)
.map(MageInt::getValue)
.orElse(0);
return new IncubateEffect(power).apply(game, source);
}
}

View file

@ -55,6 +55,7 @@ public final class MarchOfTheMachine extends ExpansionSet {
cards.add(new SetCardInfo("Faerie Mastermind", 58, Rarity.RARE, mage.cards.f.FaerieMastermind.class));
cards.add(new SetCardInfo("Fairgrounds Trumpeter", 335, Rarity.COMMON, mage.cards.f.FairgroundsTrumpeter.class));
cards.add(new SetCardInfo("Forest", 281, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Furnace Gremlin", 139, Rarity.UNCOMMON, mage.cards.f.FurnaceGremlin.class));
cards.add(new SetCardInfo("Gift of Compleation", 106, Rarity.UNCOMMON, mage.cards.g.GiftOfCompleation.class));
cards.add(new SetCardInfo("Glissa, Herald of Predation", 226, Rarity.RARE, mage.cards.g.GlissaHeraldOfPredation.class));
cards.add(new SetCardInfo("Glistening Dawn", 187, Rarity.RARE, mage.cards.g.GlisteningDawn.class));