added methods for setting target adjuster

This commit is contained in:
Evan Kranzler 2018-09-17 10:45:22 -04:00
parent 3265b70e2f
commit 8bcf95d996
3 changed files with 27 additions and 2 deletions

View file

@ -1,4 +1,3 @@
package mage.abilities; package mage.abilities;
import java.io.Serializable; import java.io.Serializable;
@ -23,6 +22,7 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import mage.target.Targets; import mage.target.Targets;
import mage.target.targetadjustment.TargetAdjuster;
import mage.watchers.Watcher; import mage.watchers.Watcher;
/** /**
@ -527,6 +527,12 @@ public interface Ability extends Controllable, Serializable {
boolean canFizzle(); boolean canFizzle();
void setTargetAdjuster(TargetAdjuster targetAdjuster);
TargetAdjuster getTargetAdjuster();
void adjustTargets(Game game);
void setTargetAdjustment(TargetAdjustment targetAdjustment); void setTargetAdjustment(TargetAdjustment targetAdjustment);
TargetAdjustment getTargetAdjustment(); TargetAdjustment getTargetAdjustment();

View file

@ -1,4 +1,3 @@
package mage.abilities; package mage.abilities;
import java.util.ArrayList; import java.util.ArrayList;
@ -33,6 +32,7 @@ import mage.game.stack.StackAbility;
import mage.players.Player; import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import mage.target.Targets; import mage.target.Targets;
import mage.target.targetadjustment.TargetAdjuster;
import mage.util.GameLog; import mage.util.GameLog;
import mage.util.ThreadLocalStringBuilder; import mage.util.ThreadLocalStringBuilder;
import mage.watchers.Watcher; import mage.watchers.Watcher;
@ -73,6 +73,7 @@ public abstract class AbilityImpl implements Ability {
protected List<Ability> subAbilities = null; protected List<Ability> subAbilities = null;
protected boolean canFizzle = true; protected boolean canFizzle = true;
protected TargetAdjustment targetAdjustment = TargetAdjustment.NONE; protected TargetAdjustment targetAdjustment = TargetAdjustment.NONE;
protected TargetAdjuster targetAdjuster = null;
public AbilityImpl(AbilityType abilityType, Zone zone) { public AbilityImpl(AbilityType abilityType, Zone zone) {
this.id = UUID.randomUUID(); this.id = UUID.randomUUID();
@ -1233,4 +1234,19 @@ public abstract class AbilityImpl implements Ability {
public TargetAdjustment getTargetAdjustment() { public TargetAdjustment getTargetAdjustment() {
return targetAdjustment; return targetAdjustment;
} }
@Override
public void setTargetAdjuster(TargetAdjuster targetAdjuster) {
this.targetAdjuster = targetAdjuster;
}
@Override
public TargetAdjustment getTargetAdjuster() {
return targetAdjuster;
}
@Override
public void adjustTargets(Game game) {
this.targetAdjuster.adjustTargets(this, game);
}
} }

View file

@ -1,5 +1,8 @@
package mage.target.targetadjustment; package mage.target.targetadjustment;
import mage.abilities.Ability;
import mage.game.Game;
/** /**
* *
* @author TheElk801 * @author TheElk801