[MOC] Implement Guardian Scalelord

This commit is contained in:
theelk801 2023-04-08 21:28:43 -04:00
parent 402cea2697
commit 5e47ebcab1
2 changed files with 87 additions and 0 deletions

View file

@ -0,0 +1,86 @@
package mage.cards.g;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
import mage.abilities.keyword.BackupAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.FilterCard;
import mage.filter.common.FilterNonlandCard;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.filter.predicate.mageobject.PermanentPredicate;
import mage.game.Game;
import mage.target.common.TargetCardInYourGraveyard;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class GuardianScalelord extends CardImpl {
private static final FilterCard filter
= new FilterNonlandCard("nonland permanent card with mana value less than this creature's power");
static {
filter.add(PermanentPredicate.instance);
filter.add(GuardianScalelordPredicate.instance);
}
public GuardianScalelord(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}");
this.subtype.add(SubType.DRAGON);
this.power = new MageInt(3);
this.toughness = new MageInt(4);
// Backup 1
BackupAbility backupAbility = new BackupAbility(this, 1);
this.addAbility(backupAbility);
// Flying
backupAbility.addAbility(FlyingAbility.getInstance());
// Whenever this creature attacks, return target nonland permanent card with mana value X or less from your graveyard to the battlefield, where X is this creature's power.
Ability ability = new AttacksTriggeredAbility(new ReturnFromGraveyardToBattlefieldTargetEffect()
.setText("return target nonland permanent card with mana value X or less " +
"from your graveyard to the battlefield, where X is this creature's power"))
.setTriggerPhrase("Whenever this creature attacks, ");
ability.addTarget(new TargetCardInYourGraveyard(filter));
backupAbility.addAbility(ability);
}
private GuardianScalelord(final GuardianScalelord card) {
super(card);
}
@Override
public GuardianScalelord copy() {
return new GuardianScalelord(this);
}
}
enum GuardianScalelordPredicate implements ObjectSourcePlayerPredicate<Card> {
instance;
@Override
public boolean apply(ObjectSourcePlayer<Card> input, Game game) {
return Optional
.ofNullable(input.getSource().getSourcePermanentOrLKI(game))
.filter(Objects::nonNull)
.map(MageObject::getPower)
.map(MageInt::getValue)
.map(p -> input.getObject().getManaValue() <= p)
.orElse(false);
}
}

View file

@ -124,6 +124,7 @@ public final class MarchOfTheMachineCommander extends ExpansionSet {
cards.add(new SetCardInfo("Goro-Goro and Satoru", 445, Rarity.MYTHIC, mage.cards.g.GoroGoroAndSatoru.class));
cards.add(new SetCardInfo("Graveshifter", 251, Rarity.UNCOMMON, mage.cards.g.Graveshifter.class));
cards.add(new SetCardInfo("Gruul Signet", 358, Rarity.COMMON, mage.cards.g.GruulSignet.class));
cards.add(new SetCardInfo("Guardian Scalelord", 16, Rarity.RARE, mage.cards.g.GuardianScalelord.class));
cards.add(new SetCardInfo("Gyre Sage", 300, Rarity.RARE, mage.cards.g.GyreSage.class));
cards.add(new SetCardInfo("Haakon, Stromgald Scourge", 252, Rarity.RARE, mage.cards.h.HaakonStromgaldScourge.class));
cards.add(new SetCardInfo("Hamza, Guardian of Arashin", 327, Rarity.UNCOMMON, mage.cards.h.HamzaGuardianOfArashin.class));