forked from External/mage
TargetAmount refactors (#13128)
* Add minimum and maximum target counts as parameters for TargetAmount and its subclasses; update/add several rules comments (and one actual text) for clarity; remove unused imports * Get amount+description from target instead of parameters for DistributeCountersEffect and DamageMultiEffect; additions to TargetImpl.getDescription to accommodate * Create separate method to check if "any number" phrasing should be used, override it in TargetAmount * Check instanceof TargetAmount before casting * Add new constructors to chain off of for TargetCreaturePermanentAmount & TargetCreatureOrPlaneswalkerAmount * Fix text for Storm the Seedcore * Use Integer.MAX_VALUE instead of 0 to represent no maximum targets * Add comment about getUseAnyNumber() * Use amount-only constructors in some TargetAmount subclasses, add clarifying documentation * Fix a few calls * Require more specific filters
This commit is contained in:
parent
960c26a291
commit
73b63d14ad
123 changed files with 444 additions and 365 deletions
|
|
@ -1,6 +1,6 @@
|
|||
package mage.target.common;
|
||||
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledCreatureOrPlaneswalkerPermanent;
|
||||
import mage.filter.common.FilterCreatureOrPlaneswalkerPermanent;
|
||||
|
||||
/**
|
||||
|
|
@ -11,12 +11,62 @@ public class TargetCreatureOrPlaneswalkerAmount extends TargetPermanentAmount {
|
|||
private static final FilterCreatureOrPlaneswalkerPermanent defaultFilter
|
||||
= new FilterCreatureOrPlaneswalkerPermanent("target creatures and/or planeswalkers");
|
||||
|
||||
/**
|
||||
* <b>IMPORTANT</b>: Use more specific constructor if {@code amount} is not always the same number!<br>
|
||||
* {@code minNumberOfTargets} defaults to zero for {@code amount} > 3, otherwise to one, in line with typical templating.<br>
|
||||
* {@code maxNumberOfTargets} defaults to {@code amount}.<br>
|
||||
* {@code filter} defaults to all creature and planeswalker permanents. ("target creatures and/or planeswalkers")
|
||||
*
|
||||
* @see TargetCreatureOrPlaneswalkerAmount#TargetCreatureOrPlaneswalkerAmount(int, int, int, FilterCreatureOrPlaneswalkerPermanent)
|
||||
*/
|
||||
public TargetCreatureOrPlaneswalkerAmount(int amount) {
|
||||
super(amount, defaultFilter);
|
||||
this(amount, defaultFilter);
|
||||
}
|
||||
|
||||
public TargetCreatureOrPlaneswalkerAmount(int amount, FilterPermanent filter) {
|
||||
super(amount, filter);
|
||||
/**
|
||||
* <b>IMPORTANT</b>: Use more specific constructor if {@code amount} is not always the same number!<br>
|
||||
* {@code minNumberOfTargets} defaults to zero for {@code amount} > 3, otherwise to one, in line with typical templating.<br>
|
||||
* {@code maxNumberOfTargets} defaults to {@code amount}.
|
||||
*
|
||||
* @see TargetCreatureOrPlaneswalkerAmount#TargetCreatureOrPlaneswalkerAmount(int, int, int, FilterCreatureOrPlaneswalkerPermanent)
|
||||
*/
|
||||
public TargetCreatureOrPlaneswalkerAmount(int amount, FilterCreatureOrPlaneswalkerPermanent filter) {
|
||||
this(amount, amount > 3 ? 0 : 1, amount, filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@code filter} defaults to all creature and planeswalker permanents. ("target creatures and/or planeswalkers")
|
||||
*
|
||||
* @see TargetCreatureOrPlaneswalkerAmount#TargetCreatureOrPlaneswalkerAmount(int, int, int, FilterCreatureOrPlaneswalkerPermanent)
|
||||
*/
|
||||
public TargetCreatureOrPlaneswalkerAmount(int amount, int minNumberOfTargets, int maxNumberOfTargets) {
|
||||
this(amount, minNumberOfTargets, maxNumberOfTargets, defaultFilter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param amount Amount of stuff (e.g. damage, counters) to distribute.
|
||||
* @param minNumberOfTargets Minimum number of targets.
|
||||
* @param maxNumberOfTargets Maximum number of targets. If no lower max is needed, set to {@code amount}.
|
||||
* @param filter Filter for creatures and/or planeswalkers that something will be distributed amongst.
|
||||
*/
|
||||
public TargetCreatureOrPlaneswalkerAmount(int amount, int minNumberOfTargets, int maxNumberOfTargets, FilterCreatureOrPlaneswalkerPermanent filter) {
|
||||
super(amount, minNumberOfTargets, maxNumberOfTargets, filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* <b>IMPORTANT</b>: Use more specific constructor if {@code amount} is not always the same number!
|
||||
*
|
||||
* @see TargetCreatureOrPlaneswalkerAmount#TargetCreatureOrPlaneswalkerAmount(int, FilterCreatureOrPlaneswalkerPermanent)
|
||||
*/
|
||||
public TargetCreatureOrPlaneswalkerAmount(int amount, FilterControlledCreatureOrPlaneswalkerPermanent filter) {
|
||||
this(amount, amount > 3 ? 0 : 1, amount, filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see TargetCreatureOrPlaneswalkerAmount#TargetCreatureOrPlaneswalkerAmount(int, int, int, FilterCreatureOrPlaneswalkerPermanent)
|
||||
*/
|
||||
public TargetCreatureOrPlaneswalkerAmount(int amount, int minNumberOfTargets, int maxNumberOfTargets, FilterControlledCreatureOrPlaneswalkerPermanent filter) {
|
||||
super(amount, minNumberOfTargets, maxNumberOfTargets, filter);
|
||||
}
|
||||
|
||||
private TargetCreatureOrPlaneswalkerAmount(final TargetCreatureOrPlaneswalkerAmount target) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue