[ROE] Fix Reality Spasm so targets are chosen on casting rather than on resolution

This commit is contained in:
Alex W. Jackson 2022-04-05 08:39:07 -04:00
parent 42f0b5ce17
commit ad4b6a8e29
3 changed files with 24 additions and 116 deletions

View file

@ -16,20 +16,19 @@ import java.util.UUID;
*/
public class UntapTargetEffect extends OneShotEffect {
protected boolean useOnlyTargetPointer;
public UntapTargetEffect() {
this(true);
this((String) null);
}
public UntapTargetEffect(boolean useOnlyTargetPointer) {
public UntapTargetEffect(String text) {
super(Outcome.Untap);
this.useOnlyTargetPointer = useOnlyTargetPointer;
if (text != null) {
this.staticText = text;
}
}
public UntapTargetEffect(final UntapTargetEffect effect) {
super(effect);
this.useOnlyTargetPointer = effect.useOnlyTargetPointer;
}
@Override
@ -39,21 +38,10 @@ public class UntapTargetEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
if (!useOnlyTargetPointer && source.getTargets().size() > 1) {
source.getTargets().forEach((target) -> {
for (UUID targetId : target.getTargets()) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
permanent.untap(game);
}
}
});
} else {
for (UUID target : targetPointer.getTargets(game, source)) {
Permanent permanent = game.getPermanent(target);
if (permanent != null) {
permanent.untap(game);
}
for (UUID target : targetPointer.getTargets(game, source)) {
Permanent permanent = game.getPermanent(target);
if (permanent != null) {
permanent.untap(game);
}
}
return true;
@ -88,4 +76,4 @@ public class UntapTargetEffect extends OneShotEffect {
return sb.toString();
}
}
}