mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
updated abilities that target permanents with cmc x
This commit is contained in:
parent
856dcb54d5
commit
8ae2bf6c08
6 changed files with 87 additions and 66 deletions
|
@ -38,13 +38,13 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
/**
|
||||
|
@ -53,8 +53,6 @@ import mage.target.TargetPermanent;
|
|||
*/
|
||||
public class DeepfireElemental extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent("artifact or creature with converted mana cost X");
|
||||
|
||||
static {
|
||||
|
@ -62,7 +60,7 @@ public class DeepfireElemental extends CardImpl {
|
|||
}
|
||||
|
||||
public DeepfireElemental(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{B}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{R}");
|
||||
this.subtype.add(SubType.ELEMENTAL);
|
||||
|
||||
this.power = new MageInt(4);
|
||||
|
@ -72,25 +70,27 @@ public class DeepfireElemental extends CardImpl {
|
|||
// {X}{X}{1}: Destroy target artifact or creature with converted mana cost X.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{X}{X}{1}"));
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
originalId = ability.getOriginalId();
|
||||
ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_PERM);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy();
|
||||
StringBuilder message = new StringBuilder(filter2.getMessage());
|
||||
message.setLength(message.length() - 1);
|
||||
message.append(xValue);
|
||||
filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
filter2.setMessage(message.toString());
|
||||
ability.getTargets().clear();
|
||||
FilterPermanent newFilter = filter.copy();
|
||||
newFilter.setMessage(new StringBuilder("artifact or creature with converted mana cost {").append(ability.getManaCostsToPay().getX()).append('}').toString());
|
||||
newFilter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, ability.getManaCostsToPay().getX()));
|
||||
Target target = new TargetPermanent(newFilter);
|
||||
ability.addTarget(target);
|
||||
ability.getTargets().add(new TargetPermanent(filter2));
|
||||
}
|
||||
}
|
||||
|
||||
public DeepfireElemental(final DeepfireElemental card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -42,6 +42,7 @@ import mage.constants.SubType;
|
|||
import mage.constants.ComparisonType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
|
@ -57,8 +58,6 @@ import mage.target.common.TargetCardInOpponentsGraveyard;
|
|||
*/
|
||||
public class GethLordOfTheVault extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
|
||||
public GethLordOfTheVault(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{B}");
|
||||
addSuperType(SuperType.LEGENDARY);
|
||||
|
@ -73,14 +72,14 @@ public class GethLordOfTheVault extends CardImpl {
|
|||
// {X}{B}: Put target artifact or creature card with converted mana cost X from an opponent's graveyard onto the battlefield under your control tapped.
|
||||
// Then that player puts the top X cards of his or her library into his or her graveyard.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GethLordOfTheVaultEffect(), new ManaCostsImpl("{X}{B}"));
|
||||
originalId = ability.getOriginalId();
|
||||
ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_NONPERM);
|
||||
ability.addTarget(new TargetCardInOpponentsGraveyard(new FilterCard("artifact or creature card with converted mana cost X from an opponent's graveyard")));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_NONPERM) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
ability.getTargets().clear();
|
||||
FilterCard filter = new FilterCard("artifact or creature card with converted mana cost " + xValue + " from an opponent's graveyard");
|
||||
|
@ -95,7 +94,6 @@ public class GethLordOfTheVault extends CardImpl {
|
|||
|
||||
public GethLordOfTheVault(final GethLordOfTheVault card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -38,13 +38,13 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterArtifactPermanent;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
/**
|
||||
|
@ -53,10 +53,15 @@ import mage.target.TargetPermanent;
|
|||
*/
|
||||
public class GorillaShaman extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
private static final FilterPermanent filter = new FilterPermanent("noncreature artifact with converted mana cost X");
|
||||
|
||||
static {
|
||||
filter.add(new CardTypePredicate(CardType.ARTIFACT));
|
||||
filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
|
||||
}
|
||||
|
||||
public GorillaShaman(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}");
|
||||
this.subtype.add(SubType.APE);
|
||||
this.subtype.add(SubType.SHAMAN);
|
||||
this.power = new MageInt(1);
|
||||
|
@ -65,27 +70,28 @@ public class GorillaShaman extends CardImpl {
|
|||
//TODO: Make ability properly copiable
|
||||
// {X}{X}{1}: Destroy target noncreature artifact with converted mana cost X.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{X}{X}{1}"));
|
||||
ability.addTarget(new TargetPermanent(new FilterArtifactPermanent("noncreature artifact with converted mana cost X")));
|
||||
originalId = ability.getOriginalId();
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_PERM);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy();
|
||||
StringBuilder message = new StringBuilder(filter2.getMessage());
|
||||
message.setLength(message.length() - 1);
|
||||
message.append(xValue);
|
||||
filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
filter2.setMessage(message.toString());
|
||||
ability.getTargets().clear();
|
||||
FilterArtifactPermanent filter = new FilterArtifactPermanent(new StringBuilder("noncreature artifact with converted mana cost ").append(xValue).toString());
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
|
||||
Target target = new TargetPermanent(filter);
|
||||
ability.addTarget(target);
|
||||
ability.getTargets().add(new TargetPermanent(filter2));
|
||||
}
|
||||
}
|
||||
|
||||
public GorillaShaman(final GorillaShaman card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,11 +39,12 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterArtifactPermanent;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
/**
|
||||
|
@ -51,7 +52,11 @@ import mage.target.TargetPermanent;
|
|||
*/
|
||||
public class HearthKami extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
private static final FilterPermanent filter = new FilterPermanent("artifact with converted mana cost X");
|
||||
|
||||
static {
|
||||
filter.add(new CardTypePredicate(CardType.ARTIFACT));
|
||||
}
|
||||
|
||||
public HearthKami(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
|
||||
|
@ -64,26 +69,28 @@ public class HearthKami extends CardImpl {
|
|||
// {X}, Sacrifice Hearth Kami: Destroy target artifact with converted mana cost X.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{X}"));
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
ability.addTarget(new TargetPermanent(new FilterArtifactPermanent("artifact with converted mana cost X")));
|
||||
originalId = ability.getOriginalId();
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_PERM);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy();
|
||||
StringBuilder message = new StringBuilder(filter2.getMessage());
|
||||
message.setLength(message.length() - 1);
|
||||
message.append(xValue);
|
||||
filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
filter2.setMessage(message.toString());
|
||||
ability.getTargets().clear();
|
||||
FilterArtifactPermanent filter = new FilterArtifactPermanent(new StringBuilder("artifact with converted mana cost ").append(xValue).toString());
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
Target target = new TargetPermanent(filter);
|
||||
ability.addTarget(target);
|
||||
ability.getTargets().add(new TargetPermanent(filter2));
|
||||
}
|
||||
}
|
||||
|
||||
public HearthKami(final HearthKami card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -43,19 +43,20 @@ import mage.constants.SubType;
|
|||
import mage.constants.ComparisonType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -63,10 +64,14 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
*/
|
||||
public class LinessaZephyrMage extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
private static final FilterPermanent filter = new FilterPermanent("creature with converted mana cost X");
|
||||
|
||||
static {
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
}
|
||||
|
||||
public LinessaZephyrMage(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}");
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.WIZARD);
|
||||
|
@ -74,12 +79,12 @@ public class LinessaZephyrMage extends CardImpl {
|
|||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
//TODO: Make ability properly copiable
|
||||
//TODO: Make ability properly copiable
|
||||
// {X}{U}{U}, {tap}: Return target creature with converted mana cost X to its owner's hand.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), new ManaCostsImpl("{X}{U}{U}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
originalId = ability.getOriginalId();
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_PERM);
|
||||
this.addAbility(ability);
|
||||
|
||||
// Grandeur - Discard another card named Linessa, Zephyr Mage: Target player returns a creature he or she controls to its owner's hand, then repeats this process for an artifact, an enchantment, and a land.
|
||||
|
@ -90,17 +95,20 @@ public class LinessaZephyrMage extends CardImpl {
|
|||
|
||||
public LinessaZephyrMage(final LinessaZephyrMage card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy();
|
||||
StringBuilder message = new StringBuilder(filter2.getMessage());
|
||||
message.setLength(message.length() - 1);
|
||||
message.append(xValue);
|
||||
filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
filter2.setMessage(message.toString());
|
||||
ability.getTargets().clear();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with converted mana cost " + xValue);
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
ability.getTargets().add(new TargetCreaturePermanent(filter));
|
||||
ability.getTargets().add(new TargetPermanent(filter2));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,13 +39,14 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
/**
|
||||
|
@ -54,15 +55,15 @@ import mage.target.TargetPermanent;
|
|||
*/
|
||||
public class Plaguebearer extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nonblack creature");
|
||||
private static final FilterPermanent filter = new FilterPermanent("nonblack creature with converted mana cost X");
|
||||
|
||||
static {
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
filter.add(Predicates.not(new ColorPredicate(ObjectColor.BLACK)));
|
||||
}
|
||||
|
||||
public Plaguebearer(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}");
|
||||
this.subtype.add(SubType.ZOMBIE);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
|
@ -71,26 +72,27 @@ public class Plaguebearer extends CardImpl {
|
|||
// {X}{X}{B}: Destroy target nonblack creature with converted mana cost X.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{X}{X}{B}"));
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
originalId = ability.getOriginalId();
|
||||
ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_PERM);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy();
|
||||
StringBuilder message = new StringBuilder(filter2.getMessage());
|
||||
message.setLength(message.length() - 1);
|
||||
message.append(xValue);
|
||||
filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
filter2.setMessage(message.toString());
|
||||
ability.getTargets().clear();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent(new StringBuilder("nonblack creature with converted mana cost ").append(xValue).toString());
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
filter.add(Predicates.not(new ColorPredicate(ObjectColor.BLACK)));
|
||||
Target target = new TargetPermanent(filter);
|
||||
ability.addTarget(target);
|
||||
ability.getTargets().add(new TargetPermanent(filter2));
|
||||
}
|
||||
}
|
||||
|
||||
public Plaguebearer(final Plaguebearer card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue