forked from External/mage
refactor: improved target usage, replaced setNotTarget by withNotTarget
This commit is contained in:
parent
dbaa51f462
commit
4b3a19b4d5
385 changed files with 434 additions and 429 deletions
|
|
@ -28,12 +28,17 @@ public interface Target extends Serializable {
|
|||
boolean isNotTarget();
|
||||
|
||||
/**
|
||||
* controls if it will be checked, if the target can be targeted from source
|
||||
* Mark it as non target (e.g. card's rules do not contain a "target" word)
|
||||
* <p>
|
||||
* Non targeted abilities are unaffected by protection/hexproof and other target related effects
|
||||
* Non targeted spells can't be fizzled on resolve with invalid targets
|
||||
* Non targeted spells chooses targets on resolve, targeted spells chooses targets on activate
|
||||
* All costs must be non targeted
|
||||
*
|
||||
* @param notTarget true = do not check for protection, false = check for
|
||||
* protection
|
||||
* @param notTarget
|
||||
* @return
|
||||
*/
|
||||
void setNotTarget(boolean notTarget);
|
||||
Target withNotTarget(boolean notTarget);
|
||||
|
||||
// methods for targets
|
||||
boolean canChoose(UUID sourceControllerId, Ability source, Game game);
|
||||
|
|
@ -181,7 +186,6 @@ public interface Target extends Serializable {
|
|||
* - The minimum and maximum number of targets is the same (i.e. effect does not have "up to" in its name)
|
||||
* - The number of valid targets is equal to the number of targets still left to be specified
|
||||
*
|
||||
*
|
||||
* @param abilityControllerId
|
||||
* @param source
|
||||
* @param game
|
||||
|
|
|
|||
|
|
@ -546,8 +546,9 @@ public abstract class TargetImpl implements Target {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setNotTarget(boolean notTarget) {
|
||||
public TargetImpl withNotTarget(boolean notTarget) {
|
||||
this.notTarget = notTarget;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class TargetCardInGraveyard extends TargetCard {
|
|||
|
||||
public TargetCardInGraveyard(int minNumTargets, int maxNumTargets, FilterCard filter, boolean notTarget) {
|
||||
super(minNumTargets, maxNumTargets, Zone.GRAVEYARD, filter);
|
||||
this.setNotTarget(notTarget);
|
||||
this.withNotTarget(notTarget);
|
||||
}
|
||||
|
||||
protected TargetCardInGraveyard(final TargetCardInGraveyard target) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class TargetCardInHand extends TargetCard {
|
|||
|
||||
public TargetCardInHand(int minNumTargets, int maxNumTargets, FilterCard filter) {
|
||||
super(minNumTargets, maxNumTargets, Zone.HAND, filter);
|
||||
setNotTarget(true);
|
||||
withNotTarget(true);
|
||||
}
|
||||
|
||||
protected TargetCardInHand(final TargetCardInHand target) {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class TargetCardInLibrary extends TargetCard {
|
|||
// with a certain card type or color, that player isn't required to find some or all of those cards
|
||||
// even if they're present in that zone.
|
||||
this.setRequired(!filter.hasPredicates());
|
||||
this.setNotTarget(true);
|
||||
this.withNotTarget(true);
|
||||
this.librarySearchLimit = Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class TargetCardInYourGraveyard extends TargetCard {
|
|||
|
||||
public TargetCardInYourGraveyard(int minNumTarget, int maxNumTargets, FilterCard filter, boolean notTarget) {
|
||||
super(minNumTarget, maxNumTargets, Zone.GRAVEYARD, filter);
|
||||
this.setNotTarget(notTarget);
|
||||
this.withNotTarget(notTarget);
|
||||
}
|
||||
|
||||
protected TargetCardInYourGraveyard(final TargetCardInYourGraveyard target) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue