diff --git a/Mage.Sets/src/mage/cards/d/DodgyJalopy.java b/Mage.Sets/src/mage/cards/d/DodgyJalopy.java new file mode 100644 index 00000000000..f7e4d7292f0 --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DodgyJalopy.java @@ -0,0 +1,87 @@ +package mage.cards.d; + +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.SetPowerSourceEffect; +import mage.abilities.keyword.CrewAbility; +import mage.abilities.keyword.ScavengeAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class DodgyJalopy extends CardImpl { + + public DodgyJalopy(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}{G}"); + + this.subtype.add(SubType.VEHICLE); + this.power = new MageInt(0); + this.toughness = new MageInt(5); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // Dodgy Jalopy's power is equal to the highest mana value among creatures you control. + this.addAbility(new SimpleStaticAbility( + Zone.ALL, new SetPowerSourceEffect(DodgyJalopyValue.instance, Duration.EndOfGame) + )); + + // Crew 3 + this.addAbility(new CrewAbility(3)); + + // Scavenge {2}{G} + this.addAbility(new ScavengeAbility(new ManaCostsImpl<>("{2}{G}"))); + } + + private DodgyJalopy(final DodgyJalopy card) { + super(card); + } + + @Override + public DodgyJalopy copy() { + return new DodgyJalopy(this); + } +} + +enum DodgyJalopyValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return game + .getBattlefield() + .getActivePermanents( + StaticFilters.FILTER_CONTROLLED_CREATURE, + sourceAbility.getControllerId(), sourceAbility, game + ).stream() + .mapToInt(MageObject::getManaValue) + .max() + .orElse(0); + } + + @Override + public DodgyJalopyValue copy() { + return this; + } + + @Override + public String getMessage() { + return "the highest mana value among creatures you control"; + } +} diff --git a/Mage.Sets/src/mage/sets/NewCapennaCommander.java b/Mage.Sets/src/mage/sets/NewCapennaCommander.java index d66ff18e92e..f5ba9f4176d 100644 --- a/Mage.Sets/src/mage/sets/NewCapennaCommander.java +++ b/Mage.Sets/src/mage/sets/NewCapennaCommander.java @@ -97,6 +97,7 @@ public final class NewCapennaCommander extends ExpansionSet { cards.add(new SetCardInfo("Dig Through Time", 219, Rarity.RARE, mage.cards.d.DigThroughTime.class)); cards.add(new SetCardInfo("Dimir Signet", 365, Rarity.COMMON, mage.cards.d.DimirSignet.class)); cards.add(new SetCardInfo("Disciple of Bolas", 247, Rarity.RARE, mage.cards.d.DiscipleOfBolas.class)); + cards.add(new SetCardInfo("Dodgy Jalopy", 58, Rarity.RARE, mage.cards.d.DodgyJalopy.class)); cards.add(new SetCardInfo("Double Vision", 267, Rarity.RARE, mage.cards.d.DoubleVision.class)); cards.add(new SetCardInfo("Dragonlord Ojutai", 337, Rarity.MYTHIC, mage.cards.d.DragonlordOjutai.class)); cards.add(new SetCardInfo("Drana, Liberator of Malakir", 248, Rarity.MYTHIC, mage.cards.d.DranaLiberatorOfMalakir.class));