mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
Updated cards which target cards with attribute x
This commit is contained in:
parent
b3712b88c7
commit
dcddc91144
10 changed files with 53 additions and 59 deletions
|
|
@ -79,11 +79,7 @@ public class DeepfireElemental extends CardImpl {
|
||||||
if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) {
|
if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) {
|
||||||
int xValue = ability.getManaCostsToPay().getX();
|
int xValue = ability.getManaCostsToPay().getX();
|
||||||
FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy();
|
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.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||||
filter2.setMessage(message.toString());
|
|
||||||
ability.getTargets().clear();
|
ability.getTargets().clear();
|
||||||
ability.getTargets().add(new TargetPermanent(filter2));
|
ability.getTargets().add(new TargetPermanent(filter2));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.Target;
|
import mage.target.TargetCard;
|
||||||
import mage.target.common.TargetCardInOpponentsGraveyard;
|
import mage.target.common.TargetCardInOpponentsGraveyard;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -58,6 +58,14 @@ import mage.target.common.TargetCardInOpponentsGraveyard;
|
||||||
*/
|
*/
|
||||||
public class GethLordOfTheVault extends CardImpl {
|
public class GethLordOfTheVault extends CardImpl {
|
||||||
|
|
||||||
|
private static final FilterCard filter = new FilterCard("artifact or creature card with converted mana cost X from an opponent's graveyard");
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(Predicates.or(
|
||||||
|
new CardTypePredicate(CardType.ARTIFACT),
|
||||||
|
new CardTypePredicate(CardType.CREATURE)));
|
||||||
|
}
|
||||||
|
|
||||||
public GethLordOfTheVault(UUID ownerId, CardSetInfo setInfo) {
|
public GethLordOfTheVault(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{B}");
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{B}");
|
||||||
addSuperType(SuperType.LEGENDARY);
|
addSuperType(SuperType.LEGENDARY);
|
||||||
|
|
@ -72,23 +80,20 @@ 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.
|
// {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.
|
// 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}"));
|
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GethLordOfTheVaultEffect(), new ManaCostsImpl("{X}{B}"));
|
||||||
ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_NONPERM);
|
ability.setTargetAdjustment(TargetAdjustment.GETH);
|
||||||
ability.addTarget(new TargetCardInOpponentsGraveyard(new FilterCard("artifact or creature card with converted mana cost X from an opponent's graveyard")));
|
ability.addTarget(new TargetCardInOpponentsGraveyard(filter));
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void adjustTargets(Ability ability, Game game) {
|
public void adjustTargets(Ability ability, Game game) {
|
||||||
if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_NONPERM) {
|
if (ability.getTargetAdjustment() == TargetAdjustment.GETH) {
|
||||||
int xValue = ability.getManaCostsToPay().getX();
|
int xValue = ability.getManaCostsToPay().getX();
|
||||||
|
TargetCard oldTarget = (TargetCard) ability.getTargets().get(0);
|
||||||
|
FilterCard filter2 = oldTarget.getFilter().copy();
|
||||||
|
filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||||
ability.getTargets().clear();
|
ability.getTargets().clear();
|
||||||
FilterCard filter = new FilterCard("artifact or creature card with converted mana cost " + xValue + " from an opponent's graveyard");
|
ability.getTargets().add(new TargetCardInOpponentsGraveyard(filter2));
|
||||||
filter.add(Predicates.or(
|
|
||||||
new CardTypePredicate(CardType.ARTIFACT),
|
|
||||||
new CardTypePredicate(CardType.CREATURE)));
|
|
||||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
|
||||||
Target target = new TargetCardInOpponentsGraveyard(filter);
|
|
||||||
ability.addTarget(target);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,14 +79,13 @@ public class GorillaShaman extends CardImpl {
|
||||||
public void adjustTargets(Ability ability, Game game) {
|
public void adjustTargets(Ability ability, Game game) {
|
||||||
if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) {
|
if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) {
|
||||||
int xValue = ability.getManaCostsToPay().getX();
|
int xValue = ability.getManaCostsToPay().getX();
|
||||||
FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy();
|
TargetPermanent oldTarget = (TargetPermanent) ability.getTargets().get(0);
|
||||||
StringBuilder message = new StringBuilder(filter2.getMessage());
|
int minTargets = oldTarget.getMinNumberOfTargets();
|
||||||
message.setLength(message.length() - 1);
|
int maxTargets = oldTarget.getMaxNumberOfTargets();
|
||||||
message.append(xValue);
|
FilterPermanent filter2 = oldTarget.getFilter().copy();
|
||||||
filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||||
filter2.setMessage(message.toString());
|
|
||||||
ability.getTargets().clear();
|
ability.getTargets().clear();
|
||||||
ability.getTargets().add(new TargetPermanent(filter2));
|
ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, filter2, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,11 +79,7 @@ public class HearthKami extends CardImpl {
|
||||||
if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) {
|
if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) {
|
||||||
int xValue = ability.getManaCostsToPay().getX();
|
int xValue = ability.getManaCostsToPay().getX();
|
||||||
FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy();
|
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.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||||
filter2.setMessage(message.toString());
|
|
||||||
ability.getTargets().clear();
|
ability.getTargets().clear();
|
||||||
ability.getTargets().add(new TargetPermanent(filter2));
|
ability.getTargets().add(new TargetPermanent(filter2));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,11 +102,7 @@ public class LinessaZephyrMage extends CardImpl {
|
||||||
if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) {
|
if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) {
|
||||||
int xValue = ability.getManaCostsToPay().getX();
|
int xValue = ability.getManaCostsToPay().getX();
|
||||||
FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy();
|
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.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||||
filter2.setMessage(message.toString());
|
|
||||||
ability.getTargets().clear();
|
ability.getTargets().clear();
|
||||||
ability.getTargets().add(new TargetPermanent(filter2));
|
ability.getTargets().add(new TargetPermanent(filter2));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,19 +33,20 @@ import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.Effect;
|
|
||||||
import mage.abilities.effects.common.combat.CantBeBlockedTargetEffect;
|
import mage.abilities.effects.common.combat.CantBeBlockedTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
import mage.constants.ComparisonType;
|
import mage.constants.ComparisonType;
|
||||||
|
import mage.constants.TargetAdjustment;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.FilterPermanent;
|
||||||
|
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||||
import mage.filter.predicate.mageobject.PowerPredicate;
|
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.TargetPermanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -53,11 +54,14 @@ import mage.target.common.TargetCreaturePermanent;
|
||||||
*/
|
*/
|
||||||
public class MinamoSightbender extends CardImpl {
|
public class MinamoSightbender extends CardImpl {
|
||||||
|
|
||||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power X or less");
|
private static final FilterPermanent filter = new FilterPermanent("creature with power X or less");
|
||||||
private final UUID originalId;
|
|
||||||
|
static {
|
||||||
|
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||||
|
}
|
||||||
|
|
||||||
public MinamoSightbender(UUID ownerId, CardSetInfo setInfo) {
|
public MinamoSightbender(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}");
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
|
||||||
this.subtype.add(SubType.HUMAN);
|
this.subtype.add(SubType.HUMAN);
|
||||||
this.subtype.add(SubType.WIZARD);
|
this.subtype.add(SubType.WIZARD);
|
||||||
|
|
||||||
|
|
@ -67,34 +71,30 @@ public class MinamoSightbender extends CardImpl {
|
||||||
//TODO: Make ability properly copiable
|
//TODO: Make ability properly copiable
|
||||||
// {X}, {T}: Target creature with power X or less can't be blocked this turn.
|
// {X}, {T}: Target creature with power X or less can't be blocked this turn.
|
||||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CantBeBlockedTargetEffect(), new ManaCostsImpl("{X}"));
|
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CantBeBlockedTargetEffect(), new ManaCostsImpl("{X}"));
|
||||||
Target target = new TargetCreaturePermanent(filter);
|
Target target = new TargetPermanent(filter);
|
||||||
|
ability.setTargetAdjustment(TargetAdjustment.X_POWER_LEQ);
|
||||||
ability.addTarget(target);
|
ability.addTarget(target);
|
||||||
ability.addCost(new TapSourceCost());
|
ability.addCost(new TapSourceCost());
|
||||||
originalId = ability.getOriginalId();
|
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void adjustTargets(Ability ability, Game game) {
|
public void adjustTargets(Ability ability, Game game) {
|
||||||
if (ability.getOriginalId().equals(originalId)) {
|
if (ability.getTargetAdjustment() == TargetAdjustment.X_POWER_LEQ) {
|
||||||
for (Effect effect : ability.getEffects()) {
|
int xValue = ability.getManaCostsToPay().getX();
|
||||||
if (effect instanceof CantBeBlockedTargetEffect) {
|
TargetPermanent oldTarget = (TargetPermanent) ability.getTargets().get(0);
|
||||||
int manaX = ability.getManaCostsToPay().getX();
|
int minTargets = oldTarget.getMinNumberOfTargets();
|
||||||
ability.getTargets().clear();
|
int maxTargets = oldTarget.getMaxNumberOfTargets();
|
||||||
FilterCreaturePermanent newFilter = new FilterCreaturePermanent(new StringBuilder("creature with power ").append(manaX).append(" or less").toString());
|
FilterPermanent filter2 = oldTarget.getFilter().copy();
|
||||||
filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, manaX + 1));
|
filter2.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1));
|
||||||
Target target = new TargetCreaturePermanent(newFilter);
|
ability.getTargets().clear();
|
||||||
ability.addTarget(target);
|
ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, filter2, false));
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MinamoSightbender(final MinamoSightbender card) {
|
public MinamoSightbender(final MinamoSightbender card) {
|
||||||
super(card);
|
super(card);
|
||||||
this.originalId = card.originalId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -81,11 +81,7 @@ public class Plaguebearer extends CardImpl {
|
||||||
if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) {
|
if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) {
|
||||||
int xValue = ability.getManaCostsToPay().getX();
|
int xValue = ability.getManaCostsToPay().getX();
|
||||||
FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy();
|
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.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||||
filter2.setMessage(message.toString());
|
|
||||||
ability.getTargets().clear();
|
ability.getTargets().clear();
|
||||||
ability.getTargets().add(new TargetPermanent(filter2));
|
ability.getTargets().add(new TargetPermanent(filter2));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,5 +6,5 @@ package mage.constants;
|
||||||
*/
|
*/
|
||||||
public enum TargetAdjustment {
|
public enum TargetAdjustment {
|
||||||
|
|
||||||
NONE, X_TARGETS, X_CMC_EQUAL_PERM, X_CMC_EQUAL_NONPERM, DEFENDING_PLAYER
|
NONE, X_TARGETS, X_CMC_EQUAL_PERM, GETH, DEFENDING_PLAYER,X_POWER_LEQ
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,7 @@ public interface Target extends Serializable {
|
||||||
boolean isNotTarget();
|
boolean isNotTarget();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* controls if it will be checked, if the target can be targeted from
|
* controls if it will be checked, if the target can be targeted from source
|
||||||
* source
|
|
||||||
*
|
*
|
||||||
* @param notTarget true = do not check for protection, false = check for
|
* @param notTarget true = do not check for protection, false = check for
|
||||||
* protection
|
* protection
|
||||||
|
|
@ -113,6 +112,8 @@ public interface Target extends Serializable {
|
||||||
|
|
||||||
int getNumberOfTargets();
|
int getNumberOfTargets();
|
||||||
|
|
||||||
|
int getMinNumberOfTargets();
|
||||||
|
|
||||||
int getMaxNumberOfTargets();
|
int getMaxNumberOfTargets();
|
||||||
|
|
||||||
void setMinNumberOfTargets(int minNumberofTargets);
|
void setMinNumberOfTargets(int minNumberofTargets);
|
||||||
|
|
@ -157,8 +158,8 @@ public interface Target extends Serializable {
|
||||||
void setTargetTag(int tag);
|
void setTargetTag(int tag);
|
||||||
|
|
||||||
Target getOriginalTarget();
|
Target getOriginalTarget();
|
||||||
|
|
||||||
// used for cards like Spellskite
|
// used for cards like Spellskite
|
||||||
void setTargetAmount(UUID targetId, int amount, Game game);
|
void setTargetAmount(UUID targetId, int amount, Game game);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,11 @@ public abstract class TargetImpl implements Target {
|
||||||
return this.minNumberOfTargets;
|
return this.minNumberOfTargets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMinNumberOfTargets() {
|
||||||
|
return this.minNumberOfTargets;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxNumberOfTargets() {
|
public int getMaxNumberOfTargets() {
|
||||||
return this.maxNumberOfTargets;
|
return this.maxNumberOfTargets;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue