refactor: improved target usage, replaced setNotTarget by withNotTarget

This commit is contained in:
Oleg Agafonov 2023-09-06 22:32:28 +04:00
parent dbaa51f462
commit 4b3a19b4d5
385 changed files with 434 additions and 429 deletions

View file

@ -171,7 +171,7 @@ public abstract class GameCommanderImpl extends GameImpl {
// Paris mulligan - no longer used by default for commander
// Player player = getPlayer(playerId);
// TargetCardInHand target = new TargetCardInHand(1, player.getHand().size(), new FilterCard("card to mulligan"));
// target.setNotTarget(true);
// target.withNotTarget(true);
// target.setRequired(false);
// if (player.choose(Outcome.Exile, player.getHand(), target, this)) {
// int numCards = target.getTargets().size();

View file

@ -2688,7 +2688,7 @@ public abstract class GameImpl implements Game {
continue;
}
Target targetLegendaryToKeep = new TargetPermanent(filterLegendName);
targetLegendaryToKeep.setNotTarget(true);
targetLegendaryToKeep.withNotTarget(true);
targetLegendaryToKeep.setTargetName(legend.getName() + " to keep (Legendary Rule)?");
controller.choose(Outcome.Benefit, targetLegendaryToKeep, null, this);
for (Permanent dupLegend : getBattlefield().getActivePermanents(filterLegendName, legend.getControllerId(), this)) {

View file

@ -1701,7 +1701,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
Player newProtector;
if (opponents.size() > 1) {
TargetPlayer target = new TargetPlayer(new FilterOpponent("protector for " + getName()));
target.setNotTarget(true);
target.withNotTarget(true);
target.setRequired(true);
controller.choose(Outcome.Neutral, target, source, game);
newProtector = game.getPlayer(target.getFirstTarget());

View file

@ -80,7 +80,7 @@ class ReturnSengirNosferatuEffect extends OneShotEffect {
return false;
}
Target target = new TargetCardInExile(filter);
target.setNotTarget(true);
target.withNotTarget(true);
if (!target.canChoose(source.getControllerId(), source, game)) {
return false;
}

View file

@ -379,7 +379,7 @@ public abstract class TokenImpl extends MageObjectImpl implements Token {
}
// select new target
auraTarget.setNotTarget(true);
auraTarget.withNotTarget(true);
if (!controller.choose(auraOutcome, auraTarget, source, game)) {
break;
}