mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
refactor: clean up static filters for sacrifice targets (#12120)
* simplify sacrifice target filters, part 1 * minor cleanup * adjust SacrificeXTargetCost * adjust Arctic Merfolk * more cleanup * remove unused * adjust filters not used for sacrifice * fix Hew the Entwood * fix Nahiri's Lithoforming * remove unused * remove another * cleanup more * fix MegatronDestructiveForce * remove next * next batch of replacements * remove next * rename filter to match text * finish removing * use existing static filter
This commit is contained in:
parent
5c9d1cd205
commit
8853e7d875
372 changed files with 489 additions and 712 deletions
|
|
@ -14,7 +14,7 @@ import mage.target.common.TargetSacrifice;
|
|||
*/
|
||||
public class SacrificeXTargetCost extends VariableCostImpl implements SacrificeCost {
|
||||
|
||||
protected final FilterPermanent filter;
|
||||
private final FilterPermanent filter;
|
||||
private final int minValue;
|
||||
|
||||
public SacrificeXTargetCost(FilterPermanent filter) {
|
||||
|
|
@ -29,7 +29,7 @@ public class SacrificeXTargetCost extends VariableCostImpl implements SacrificeC
|
|||
super(useAsAdditionalCost ? VariableCostType.ADDITIONAL : VariableCostType.NORMAL,
|
||||
filter.getMessage() + " to sacrifice");
|
||||
this.text = (useAsAdditionalCost ? "as an additional cost to cast this spell, sacrifice " : "Sacrifice ") + xText + ' ' + filter.getMessage();
|
||||
this.filter = filter;
|
||||
this.filter = TargetSacrifice.makeFilter(filter);
|
||||
this.minValue = minValue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -401,12 +401,6 @@ public final class StaticFilters {
|
|||
FILTER_CONTROLLED_PERMANENTS.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_SHORT_TEXT = new FilterControlledPermanent("permanent");
|
||||
|
||||
static {
|
||||
FILTER_CONTROLLED_PERMANENT_SHORT_TEXT.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_ARTIFACT = new FilterControlledArtifactPermanent();
|
||||
|
||||
static {
|
||||
|
|
@ -435,16 +429,6 @@ public final class StaticFilters {
|
|||
FILTER_CONTROLLED_PERMANENT_ARTIFACT_OR_CREATURE.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterControlledPermanent FILTER_CONTROLLED_ARTIFACT_OR_CREATURE_SHORT_TEXT = new FilterControlledPermanent("artifact or creature");
|
||||
|
||||
static {
|
||||
FILTER_CONTROLLED_ARTIFACT_OR_CREATURE_SHORT_TEXT.add(Predicates.or(
|
||||
CardType.ARTIFACT.getPredicate(),
|
||||
CardType.CREATURE.getPredicate()
|
||||
));
|
||||
FILTER_CONTROLLED_ARTIFACT_OR_CREATURE_SHORT_TEXT.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterControlledPermanent FILTER_CONTROLLED_ARTIFACT_OR_OTHER_CREATURE = new FilterControlledPermanent("another creature or an artifact");
|
||||
|
||||
static {
|
||||
|
|
@ -460,34 +444,15 @@ public final class StaticFilters {
|
|||
FILTER_CONTROLLED_ANOTHER_ARTIFACT.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterControlledPermanent FILTER_CONTROLLED_ANOTHER_ARTIFACT_SHORT_TEXT = new FilterControlledPermanent("another artifact");
|
||||
public static final FilterControlledPermanent FILTER_CONTROLLED_ANOTHER_CREATURE_OR_ARTIFACT = new FilterControlledPermanent("another creature or artifact you control");
|
||||
|
||||
static {
|
||||
FILTER_CONTROLLED_ANOTHER_ARTIFACT_SHORT_TEXT.add(AnotherPredicate.instance);
|
||||
FILTER_CONTROLLED_ANOTHER_ARTIFACT_SHORT_TEXT.add(CardType.ARTIFACT.getPredicate());
|
||||
FILTER_CONTROLLED_ANOTHER_ARTIFACT_SHORT_TEXT.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterControlledPermanent FILTER_CONTROLLED_ANOTHER_ARTIFACT_OR_CREATURE = new FilterControlledPermanent("another creature or artifact you control");
|
||||
|
||||
static {
|
||||
FILTER_CONTROLLED_ANOTHER_ARTIFACT_OR_CREATURE.add(AnotherPredicate.instance);
|
||||
FILTER_CONTROLLED_ANOTHER_ARTIFACT_OR_CREATURE.add(Predicates.or(
|
||||
FILTER_CONTROLLED_ANOTHER_CREATURE_OR_ARTIFACT.add(AnotherPredicate.instance);
|
||||
FILTER_CONTROLLED_ANOTHER_CREATURE_OR_ARTIFACT.add(Predicates.or(
|
||||
CardType.ARTIFACT.getPredicate(),
|
||||
CardType.CREATURE.getPredicate()
|
||||
));
|
||||
FILTER_CONTROLLED_ANOTHER_ARTIFACT_OR_CREATURE.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterControlledPermanent FILTER_CONTROLLED_ANOTHER_CREATURE_OR_ARTIFACT_SHORT_TEXT = new FilterControlledPermanent("another creature or artifact");
|
||||
|
||||
static {
|
||||
FILTER_CONTROLLED_ANOTHER_CREATURE_OR_ARTIFACT_SHORT_TEXT.add(AnotherPredicate.instance);
|
||||
FILTER_CONTROLLED_ANOTHER_CREATURE_OR_ARTIFACT_SHORT_TEXT.add(Predicates.or(
|
||||
CardType.ARTIFACT.getPredicate(),
|
||||
CardType.CREATURE.getPredicate()
|
||||
));
|
||||
FILTER_CONTROLLED_ANOTHER_CREATURE_OR_ARTIFACT_SHORT_TEXT.setLockedFilter(true);
|
||||
FILTER_CONTROLLED_ANOTHER_CREATURE_OR_ARTIFACT.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_ENCHANTMENT = new FilterControlledEnchantmentPermanent();
|
||||
|
|
@ -502,14 +467,6 @@ public final class StaticFilters {
|
|||
FILTER_CONTROLLED_PERMANENT_AN_ENCHANTMENT.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterControlledPermanent FILTER_CONTROLLED_ANOTHER_ENCHANTMENT_SHORT_TEXT = new FilterControlledPermanent("another enchantment");
|
||||
|
||||
static {
|
||||
FILTER_CONTROLLED_ANOTHER_ENCHANTMENT_SHORT_TEXT.add(AnotherPredicate.instance);
|
||||
FILTER_CONTROLLED_ANOTHER_ENCHANTMENT_SHORT_TEXT.add(CardType.ENCHANTMENT.getPredicate());
|
||||
FILTER_CONTROLLED_ANOTHER_ENCHANTMENT_SHORT_TEXT.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_LAND = new FilterControlledLandPermanent();
|
||||
|
||||
static {
|
||||
|
|
@ -633,13 +590,6 @@ public final class StaticFilters {
|
|||
FILTER_CONTROLLED_CREATURE.setLockedFilter(true);
|
||||
}
|
||||
|
||||
// Used for sacrifice targets that don't need the "you control" text
|
||||
public static final FilterControlledCreaturePermanent FILTER_CONTROLLED_CREATURE_SHORT_TEXT = new FilterControlledCreaturePermanent("a creature");
|
||||
|
||||
static {
|
||||
FILTER_CONTROLLED_CREATURE_SHORT_TEXT.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterControlledCreaturePermanent FILTER_CONTROLLED_CREATURES = new FilterControlledCreaturePermanent("creatures you control");
|
||||
|
||||
static {
|
||||
|
|
@ -735,13 +685,6 @@ public final class StaticFilters {
|
|||
FILTER_LANDS_NONBASIC.setLockedFilter(true);
|
||||
}
|
||||
|
||||
// Used for sacrifice targets that don't need the "you control" text
|
||||
public static final FilterControlledLandPermanent FILTER_CONTROLLED_LAND_SHORT_TEXT = new FilterControlledLandPermanent("a land");
|
||||
|
||||
static {
|
||||
FILTER_CONTROLLED_LAND_SHORT_TEXT.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterCreaturePermanent FILTER_PERMANENT_CREATURE = new FilterCreaturePermanent();
|
||||
|
||||
static {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public final class ObNixilisOfTheBlackOathEmblem extends Emblem {
|
|||
Effect effect = new GainLifeEffect(xValue);
|
||||
effect.setText("You gain X life");
|
||||
Ability ability = new SimpleActivatedAbility(Zone.COMMAND, effect, new ManaCostsImpl<>("{1}{B}"));
|
||||
ability.addCost(new SacrificeTargetCost(StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT));
|
||||
ability.addCost(new SacrificeTargetCost(StaticFilters.FILTER_PERMANENT_CREATURE));
|
||||
effect = new DrawCardSourceControllerEffect(xValue);
|
||||
effect.setText("and draw X cards, where X is the sacrificed creature's power");
|
||||
ability.addEffect(effect);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue