diff --git a/Mage.Sets/src/mage/cards/l/LifecraftEngine.java b/Mage.Sets/src/mage/cards/l/LifecraftEngine.java new file mode 100644 index 00000000000..dae3206bb16 --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LifecraftEngine.java @@ -0,0 +1,101 @@ +package mage.cards.l; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AsEntersBattlefieldAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.common.ChooseCreatureTypeEffect; +import mage.abilities.effects.common.continuous.BoostAllOfChosenSubtypeEffect; +import mage.abilities.keyword.CrewAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +import java.util.List; +import java.util.UUID; + +/** + * @author jackd149 + */ +public final class LifecraftEngine extends CardImpl { + + public LifecraftEngine(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); + + this.subtype.add(SubType.VEHICLE); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // As this Vehicle enters, choose a creature type. + this.addAbility(new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.BoostCreature))); + + // Vehicle creatures you control are the chosen creature type in addition to their other types. + this.addAbility(new SimpleStaticAbility(new LifecraftEngineAddSubTypeAllEffect())); + + // Each creature you control of the chosen type other than this Vehicle gets +1/+1. + BoostAllOfChosenSubtypeEffect effect = new BoostAllOfChosenSubtypeEffect(1, 1, Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED, true); + effect.setText("Each creature you control of the chosen type other than this Vehicle gets +1/+1."); + this.addAbility(new SimpleStaticAbility(effect)); + + // Crew 3 + this.addAbility(new CrewAbility(3)); + } + + private LifecraftEngine(final LifecraftEngine card) { + super(card); + } + + @Override + public LifecraftEngine copy() { + return new LifecraftEngine(this); + } +} + +class LifecraftEngineAddSubTypeAllEffect extends ContinuousEffectImpl { + + static FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent(); + + static { + filter.add(SubType.VEHICLE.getPredicate()); + } + + public LifecraftEngineAddSubTypeAllEffect() { + super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit); + + staticText = "Vehicle creatures you control are the chosen type in addition to their other types."; + } + + private LifecraftEngineAddSubTypeAllEffect(final LifecraftEngineAddSubTypeAllEffect effect) { + super(effect); + } + + @Override + public LifecraftEngineAddSubTypeAllEffect copy() { + return new LifecraftEngineAddSubTypeAllEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + UUID controllerId = source.getControllerId(); + Player controller = game.getPlayer(controllerId); + SubType subType = ChooseCreatureTypeEffect.getChosenCreatureType(source.getSourceId(), game); + if (controller == null || subType == null) { + return false; + } + + List creatures = game.getBattlefield().getAllActivePermanents( + filter, controllerId, game); + for (Permanent creature : creatures) { + if (creature != null) { + creature.addSubType(game, subType); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Aetherdrift.java b/Mage.Sets/src/mage/sets/Aetherdrift.java index dda61f211f5..9e5c09d6335 100644 --- a/Mage.Sets/src/mage/sets/Aetherdrift.java +++ b/Mage.Sets/src/mage/sets/Aetherdrift.java @@ -133,6 +133,7 @@ public final class Aetherdrift extends ExpansionSet { cards.add(new SetCardInfo("Kickoff Celebrations", 135, Rarity.COMMON, mage.cards.k.KickoffCelebrations.class)); cards.add(new SetCardInfo("Lagorin, Soul of Alacria", 211, Rarity.UNCOMMON, mage.cards.l.LagorinSoulOfAlacria.class)); cards.add(new SetCardInfo("Leonin Surveyor", 18, Rarity.COMMON, mage.cards.l.LeoninSurveyor.class)); + cards.add(new SetCardInfo("Lifecraft Engine", 234, Rarity.RARE, mage.cards.l.LifecraftEngine.class)); cards.add(new SetCardInfo("Lightning Strike", 136, Rarity.COMMON, mage.cards.l.LightningStrike.class)); cards.add(new SetCardInfo("Lightshield Parry", 19, Rarity.COMMON, mage.cards.l.LightshieldParry.class)); cards.add(new SetCardInfo("Lightwheel Enhancements", 20, Rarity.COMMON, mage.cards.l.LightwheelEnhancements.class));