[MOM] Implement Ghalta and Mavren

This commit is contained in:
theelk801 2023-04-17 19:23:55 -04:00
parent d94e699d0e
commit 8c2ee477fa
3 changed files with 142 additions and 0 deletions

View file

@ -0,0 +1,103 @@
package mage.cards.g;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.AttacksWithCreaturesTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterAttackingCreature;
import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.game.Game;
import mage.game.permanent.token.DinosaurXXToken;
import mage.game.permanent.token.IxalanVampireToken;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class GhaltaAndMavren extends CardImpl {
static final FilterPermanent filter = new FilterAttackingCreature("other attacking creatures");
static {
filter.add(AnotherPredicate.instance);
}
private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filter);
public GhaltaAndMavren(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}{W}{W}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.DINOSAUR);
this.subtype.add(SubType.VAMPIRE);
this.power = new MageInt(12);
this.toughness = new MageInt(12);
// Trample
this.addAbility(TrampleAbility.getInstance());
// Whenever you attack, choose one --
// * Create a tapped and attacking X/X green Dinosaur creature token with trample, where X is the greatest power among other attacking creatures.
Ability ability = new AttacksWithCreaturesTriggeredAbility(new GhaltaAndMavrenEffect(), 1);
// * Create X 1/1 white Vampire creature tokens with lifelink, where X is the number of other attacking creatures.
ability.addMode(new Mode(new CreateTokenEffect(new IxalanVampireToken(), xValue)));
this.addAbility(ability);
}
private GhaltaAndMavren(final GhaltaAndMavren card) {
super(card);
}
@Override
public GhaltaAndMavren copy() {
return new GhaltaAndMavren(this);
}
}
class GhaltaAndMavrenEffect extends OneShotEffect {
GhaltaAndMavrenEffect() {
super(Outcome.Benefit);
staticText = "create a tapped and attacking X/X green Dinosaur creature token with trample, " +
"where X is the greatest power among other attacking creatures";
}
private GhaltaAndMavrenEffect(final GhaltaAndMavrenEffect effect) {
super(effect);
}
@Override
public GhaltaAndMavrenEffect copy() {
return new GhaltaAndMavrenEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int power = game
.getBattlefield()
.getActivePermanents(GhaltaAndMavren.filter, source.getControllerId(), source, game)
.stream()
.map(MageObject::getPower)
.mapToInt(MageInt::getValue)
.max()
.orElse(0);
return new DinosaurXXToken(power).putOntoBattlefield(
1, game, source, source.getControllerId(), true, true
);
}
}

View file

@ -128,6 +128,7 @@ public final class MarchOfTheMachine extends ExpansionSet {
cards.add(new SetCardInfo("Furnace-Blessed Conqueror", 38, Rarity.UNCOMMON, mage.cards.f.FurnaceBlessedConqueror.class));
cards.add(new SetCardInfo("Furtive Analyst", 59, Rarity.COMMON, mage.cards.f.FurtiveAnalyst.class));
cards.add(new SetCardInfo("Gargantuan Slabhorn", 240, Rarity.UNCOMMON, mage.cards.g.GargantuanSlabhorn.class));
cards.add(new SetCardInfo("Ghalta and Mavren", 225, Rarity.RARE, mage.cards.g.GhaltaAndMavren.class));
cards.add(new SetCardInfo("Gift of Compleation", 106, Rarity.UNCOMMON, mage.cards.g.GiftOfCompleation.class));
cards.add(new SetCardInfo("Gitaxian Mindstinger", 88, Rarity.COMMON, mage.cards.g.GitaxianMindstinger.class));
cards.add(new SetCardInfo("Gitaxian Spellstalker", 151, Rarity.UNCOMMON, mage.cards.g.GitaxianSpellstalker.class));

View file

@ -0,0 +1,38 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.abilities.keyword.TrampleAbility;
import mage.constants.CardType;
import mage.constants.SubType;
import java.util.Arrays;
/**
* @author TheElk801
*/
public final class DinosaurXXToken extends TokenImpl {
public DinosaurXXToken() {
this(0);
}
public DinosaurXXToken(int xValue) {
super("Dinosaur Token", "X/X green Dinosaur creature token with trample");
cardType.add(CardType.CREATURE);
color.setGreen(true);
subtype.add(SubType.DINOSAUR);
power = new MageInt(xValue);
toughness = new MageInt(xValue);
addAbility(TrampleAbility.getInstance());
availableImageSetCodes = Arrays.asList("MOM");
}
private DinosaurXXToken(final DinosaurXXToken token) {
super(token);
}
public DinosaurXXToken copy() {
return new DinosaurXXToken(this);
}
}