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

@ -2009,7 +2009,7 @@ public class HumanPlayer extends PlayerImpl {
int remainingDamage = damage; int remainingDamage = damage;
while (remainingDamage > 0 && canRespond()) { while (remainingDamage > 0 && canRespond()) {
Target target = new TargetAnyTarget(); Target target = new TargetAnyTarget();
target.setNotTarget(true); target.withNotTarget(true);
if (singleTargetName != null) { if (singleTargetName != null) {
target.setTargetName(singleTargetName); target.setTargetName(singleTargetName);
} }

View file

@ -102,7 +102,7 @@ class AcererakTheArchlichEffect extends OneShotEffect {
continue; continue;
} }
TargetPermanent target = new TargetControlledCreaturePermanent(0, 1); TargetPermanent target = new TargetControlledCreaturePermanent(0, 1);
target.setNotTarget(true); target.withNotTarget(true);
player.choose(Outcome.Sacrifice, target, source, game); player.choose(Outcome.Sacrifice, target, source, game);
Permanent permanent = game.getPermanent(target.getFirstTarget()); Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null && permanent.sacrifice(source, game)) { if (permanent != null && permanent.sacrifice(source, game)) {

View file

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

View file

@ -82,7 +82,7 @@ class AetherbornMarauderEffect extends OneShotEffect {
if (controller.chooseUse(outcome, "Move " + (firstRun ? "any" : "more") + " +1/+1 counters from other permanents you control to " + sourceObject.getLogName() + '?', source, game)) { if (controller.chooseUse(outcome, "Move " + (firstRun ? "any" : "more") + " +1/+1 counters from other permanents you control to " + sourceObject.getLogName() + '?', source, game)) {
firstRun = false; firstRun = false;
TargetControlledPermanent target = new TargetControlledPermanent(filter); TargetControlledPermanent target = new TargetControlledPermanent(filter);
target.setNotTarget(true); target.withNotTarget(true);
if (target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), source, game)) { if (target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), source, game)) {
Permanent fromPermanent = game.getPermanent(target.getFirstTarget()); Permanent fromPermanent = game.getPermanent(target.getFirstTarget());
if (fromPermanent != null) { if (fromPermanent != null) {

View file

@ -85,7 +85,7 @@ class AgitatorAntEffect extends OneShotEffect {
continue; continue;
} }
TargetPermanent targetPermanent = new TargetControlledCreaturePermanent(0, 1); TargetPermanent targetPermanent = new TargetControlledCreaturePermanent(0, 1);
targetPermanent.setNotTarget(true); targetPermanent.withNotTarget(true);
player.choose(Outcome.BoostCreature, targetPermanent, source, game); player.choose(Outcome.BoostCreature, targetPermanent, source, game);
Permanent permanent = game.getPermanent(targetPermanent.getFirstTarget()); Permanent permanent = game.getPermanent(targetPermanent.getFirstTarget());
if (permanent == null || !permanent.addCounters(CounterType.P1P1.createInstance(2), player.getId(), source, game)) { if (permanent == null || !permanent.addCounters(CounterType.P1P1.createInstance(2), player.getId(), source, game)) {

View file

@ -73,12 +73,12 @@ class AgonizingRemorseEffect extends OneShotEffect {
null, "Hand", "Graveyard", source, game)) { null, "Hand", "Graveyard", source, game)) {
target = new TargetCard(Zone.HAND, new FilterNonlandCard("nonland card in " target = new TargetCard(Zone.HAND, new FilterNonlandCard("nonland card in "
+ opponent.getName() + "'s hand")); + opponent.getName() + "'s hand"));
target.setNotTarget(true); target.withNotTarget(true);
cards = opponent.getHand(); cards = opponent.getHand();
} else { } else {
target = new TargetCard(Zone.GRAVEYARD, new FilterCard("card in " target = new TargetCard(Zone.GRAVEYARD, new FilterCard("card in "
+ opponent.getName() + "'s graveyard")); + opponent.getName() + "'s graveyard"));
target.setNotTarget(true); target.withNotTarget(true);
cards = opponent.getGraveyard(); cards = opponent.getGraveyard();
} }
if (controller.choose(outcome, cards, target, source, game)) { if (controller.choose(outcome, cards, target, source, game)) {

View file

@ -81,7 +81,7 @@ class AkroanHorseChangeControlEffect extends OneShotEffect {
return false; return false;
} }
Target target = new TargetOpponent(); Target target = new TargetOpponent();
target.setNotTarget(true); target.withNotTarget(true);
controller.chooseTarget(outcome, target, source, game); controller.chooseTarget(outcome, target, source, game);
ContinuousEffect effect = new AkroanHorseGainControlEffect(Duration.Custom, target.getFirstTarget()); ContinuousEffect effect = new AkroanHorseGainControlEffect(Duration.Custom, target.getFirstTarget());
effect.setTargetPointer(new FixedTarget(source.getSourceId(), game)); effect.setTargetPointer(new FixedTarget(source.getSourceId(), game));

View file

@ -95,7 +95,7 @@ class AraumiOfTheDeadTideCost extends CostImpl {
} }
int oppCount = game.getOpponents(controllerId).size(); int oppCount = game.getOpponents(controllerId).size();
TargetCard target = new TargetCardInYourGraveyard(oppCount, StaticFilters.FILTER_CARD); TargetCard target = new TargetCardInYourGraveyard(oppCount, StaticFilters.FILTER_CARD);
target.setNotTarget(true); target.withNotTarget(true);
player.choose(Outcome.Exile, target, source, game); player.choose(Outcome.Exile, target, source, game);
Cards cards = new CardsImpl(target.getTargets()); Cards cards = new CardsImpl(target.getTargets());
if (cards.size() < oppCount) { if (cards.size() < oppCount) {

View file

@ -63,7 +63,7 @@ class ArdentDustspeakerCost extends CostImpl {
public ArdentDustspeakerCost() { public ArdentDustspeakerCost() {
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(filter); TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(filter);
target.setNotTarget(true); target.withNotTarget(true);
this.addTarget(target); this.addTarget(target);
this.text = "put an instant or sorcery card from your graveyard on the bottom of your library"; this.text = "put an instant or sorcery card from your graveyard on the bottom of your library";
} }

View file

@ -99,7 +99,7 @@ class ArmoredSkyhunterEffect extends OneShotEffect {
return player.putCardsOnBottomOfLibrary(cards, game, source, false); return player.putCardsOnBottomOfLibrary(cards, game, source, false);
} }
TargetPermanent targetPermanent = new TargetControlledCreaturePermanent(0, 1); TargetPermanent targetPermanent = new TargetControlledCreaturePermanent(0, 1);
targetCard.setNotTarget(true); targetCard.withNotTarget(true);
player.choose(outcome, targetPermanent, source, game); player.choose(outcome, targetPermanent, source, game);
Permanent permanent = game.getPermanent(targetPermanent.getFirstTarget()); Permanent permanent = game.getPermanent(targetPermanent.getFirstTarget());
if (permanent != null) { if (permanent != null) {

View file

@ -87,7 +87,7 @@ class AscentOfTheWorthyEffect extends OneShotEffect {
return false; return false;
} }
TargetPermanent target = new TargetControlledCreaturePermanent(); TargetPermanent target = new TargetControlledCreaturePermanent();
target.setNotTarget(true); target.withNotTarget(true);
if (!target.canChoose(source.getControllerId(), source, game)) { if (!target.canChoose(source.getControllerId(), source, game)) {
return false; return false;
} }

View file

@ -76,7 +76,7 @@ class AssemblyHallEffect extends OneShotEffect {
} }
Card cardToReveal = null; Card cardToReveal = null;
Target target = new TargetCardInHand(StaticFilters.FILTER_CARD_CREATURE); Target target = new TargetCardInHand(StaticFilters.FILTER_CARD_CREATURE);
target.setNotTarget(true); target.withNotTarget(true);
if (controller.chooseTarget(outcome, target, source, game)) { if (controller.chooseTarget(outcome, target, source, game)) {
cardToReveal = game.getCard(target.getFirstTarget()); cardToReveal = game.getCard(target.getFirstTarget());
} }

View file

@ -90,7 +90,7 @@ class AstarionsThirstEffect extends OneShotEffect {
break; break;
default: default:
TargetPermanent target = new TargetPermanent(filter); TargetPermanent target = new TargetPermanent(filter);
target.setNotTarget(true); target.withNotTarget(true);
player.choose(outcome, target, source, game); player.choose(outcome, target, source, game);
commander = game.getPermanent(target.getFirstTarget()); commander = game.getPermanent(target.getFirstTarget());
} }

View file

@ -116,7 +116,7 @@ class AuraGraftMoveAuraEffect extends OneShotEffect {
filter.add(new AuraGraftAuraCanEnchantPredicate(enchantment)); // extracts Targets from Aura spell ability filter.add(new AuraGraftAuraCanEnchantPredicate(enchantment)); // extracts Targets from Aura spell ability
filter.add(new CanBeEnchantedByPredicate(enchantment)); // checks for protection filter.add(new CanBeEnchantedByPredicate(enchantment)); // checks for protection
Target target = new TargetPermanent(filter); Target target = new TargetPermanent(filter);
target.setNotTarget(true); target.withNotTarget(true);
if (target.canChoose(controller.getId(), source, game) if (target.canChoose(controller.getId(), source, game)
&& controller.choose(outcome, target, source, game)) { && controller.choose(outcome, target, source, game)) {
Permanent newAttachment = game.getPermanent(target.getFirstTarget()); Permanent newAttachment = game.getPermanent(target.getFirstTarget());

View file

@ -67,7 +67,7 @@ class AuratouchedMageEffect extends OneShotEffect {
filter.add(SubType.AURA.getPredicate()); filter.add(SubType.AURA.getPredicate());
filter.add(new AuraCardCanAttachToLKIPermanentId(source.getSourceId())); filter.add(new AuraCardCanAttachToLKIPermanentId(source.getSourceId()));
TargetCardInLibrary target = new TargetCardInLibrary(filter); TargetCardInLibrary target = new TargetCardInLibrary(filter);
target.setNotTarget(true); target.withNotTarget(true);
if (controller.searchLibrary(target, source, game)) { if (controller.searchLibrary(target, source, game)) {
if (target.getFirstTarget() != null) { if (target.getFirstTarget() != null) {
Card aura = game.getCard(target.getFirstTarget()); Card aura = game.getCard(target.getFirstTarget());

View file

@ -87,7 +87,7 @@ class AuthorOfShadowsEffect extends OneShotEffect {
} }
TargetCard target = new TargetCardInExile(StaticFilters.FILTER_CARD_A_NON_LAND); TargetCard target = new TargetCardInExile(StaticFilters.FILTER_CARD_A_NON_LAND);
target.setNotTarget(true); target.withNotTarget(true);
controller.choose(outcome, cards, target, source, game); controller.choose(outcome, cards, target, source, game);
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());
if (card == null) { if (card == null) {

View file

@ -97,7 +97,7 @@ class AwakenTheMaelstromEffect extends OneShotEffect {
private void makeToken(Player player, Game game, Ability source) { private void makeToken(Player player, Game game, Ability source) {
TargetPermanent target = new TargetControlledCreaturePermanent(); TargetPermanent target = new TargetControlledCreaturePermanent();
target.setNotTarget(true); target.withNotTarget(true);
target.withChooseHint("to copy"); target.withChooseHint("to copy");
if (!target.canChoose(player.getId(), source, game)) { if (!target.canChoose(player.getId(), source, game)) {
return; return;
@ -114,7 +114,7 @@ class AwakenTheMaelstromEffect extends OneShotEffect {
return; return;
} }
TargetPermanentAmount target = new TargetCreaturePermanentAmount(3); TargetPermanentAmount target = new TargetCreaturePermanentAmount(3);
target.setNotTarget(true); target.withNotTarget(true);
target.withChooseHint("to distribute counters"); target.withChooseHint("to distribute counters");
player.choose(outcome, target, source, game); player.choose(outcome, target, source, game);
for (UUID targetId : target.getTargets()) { for (UUID targetId : target.getTargets()) {

View file

@ -81,7 +81,7 @@ class AzraOddsmakerEffect extends OneShotEffect {
} }
Permanent permanent = null; Permanent permanent = null;
TargetCreaturePermanent target = new TargetCreaturePermanent(); TargetCreaturePermanent target = new TargetCreaturePermanent();
target.setNotTarget(true); target.withNotTarget(true);
if (player.choose(Outcome.DrawCard, target, source, game)) { if (player.choose(Outcome.DrawCard, target, source, game)) {
permanent = game.getPermanent(target.getFirstTarget()); permanent = game.getPermanent(target.getFirstTarget());
} }

View file

@ -51,7 +51,7 @@ class BackFromTheBrinkCost extends CostImpl {
public BackFromTheBrinkCost() { public BackFromTheBrinkCost() {
Target target = new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD); Target target = new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD);
target.setNotTarget(true); target.withNotTarget(true);
this.addTarget(target); this.addTarget(target);
this.text = "Exile a creature card from your graveyard and pay its mana cost"; this.text = "Exile a creature card from your graveyard and pay its mana cost";
} }

View file

@ -112,7 +112,7 @@ class BagOfDevouringEffect extends OneShotEffect {
0, result, StaticFilters.FILTER_CARD, 0, result, StaticFilters.FILTER_CARD,
CardUtil.getExileZoneId(game, source) CardUtil.getExileZoneId(game, source)
); );
target.setNotTarget(true); target.withNotTarget(true);
player.choose(outcome, target, source, game); player.choose(outcome, target, source, game);
player.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game); player.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game);
return true; return true;

View file

@ -113,7 +113,7 @@ class BalduvianWarlordUnblockEffect extends OneShotEffect {
FilterAttackingCreature filter = new FilterAttackingCreature("creature attacking " + targetsController.getLogName()); FilterAttackingCreature filter = new FilterAttackingCreature("creature attacking " + targetsController.getLogName());
filter.add(new PermanentInListPredicate(list)); filter.add(new PermanentInListPredicate(list));
TargetPermanent target = new TargetPermanent(filter); TargetPermanent target = new TargetPermanent(filter);
target.setNotTarget(true); target.withNotTarget(true);
if (target.canChoose(controller.getId(), source, game)) { if (target.canChoose(controller.getId(), source, game)) {
while (!target.isChosen() && target.canChoose(controller.getId(), source, game) && controller.canRespond()) { while (!target.isChosen() && target.canChoose(controller.getId(), source, game) && controller.canRespond()) {
controller.chooseTarget(outcome, target, source, game); controller.chooseTarget(outcome, target, source, game);

View file

@ -156,7 +156,7 @@ class BaneAlleyBrokerReturnToHandEffect extends OneShotEffect {
return false; return false;
} }
TargetCardInExile target = new TargetCardInExile(StaticFilters.FILTER_CARD, exile.getId()); TargetCardInExile target = new TargetCardInExile(StaticFilters.FILTER_CARD, exile.getId());
target.setNotTarget(true); target.withNotTarget(true);
player.chooseTarget(outcome, exile, target, source, game); player.chooseTarget(outcome, exile, target, source, game);
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());
if (card == null) { if (card == null) {

View file

@ -163,7 +163,7 @@ class BeamsplitterMageEffect extends OneShotEffect {
filter.add(AnotherPredicate.instance); filter.add(AnotherPredicate.instance);
filter.add(new BeamsplitterMagePredicate(spell)); filter.add(new BeamsplitterMagePredicate(spell));
TargetPermanent target = new TargetPermanent(filter); TargetPermanent target = new TargetPermanent(filter);
target.setNotTarget(true); target.withNotTarget(true);
player.choose(outcome, target, source, game); player.choose(outcome, target, source, game);
Permanent permanent = game.getPermanent(target.getFirstTarget()); Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent == null) { if (permanent == null) {

View file

@ -98,7 +98,7 @@ class BeckoningWillOWispEffect extends OneShotEffect {
return false; return false;
} }
TargetOpponent target = new TargetOpponent(); TargetOpponent target = new TargetOpponent();
target.setNotTarget(true); target.withNotTarget(true);
player.choose(outcome, target, source, game); player.choose(outcome, target, source, game);
Player chosenPlayer = game.getPlayer(target.getFirstTarget()); Player chosenPlayer = game.getPlayer(target.getFirstTarget());
if (chosenPlayer == null) { if (chosenPlayer == null) {

View file

@ -98,7 +98,7 @@ class BerserkersFrenzyEffect extends OneShotEffect {
return false; return false;
} }
TargetPermanent target = new TargetCreaturePermanent(0, Integer.MAX_VALUE); TargetPermanent target = new TargetCreaturePermanent(0, Integer.MAX_VALUE);
target.setNotTarget(true); target.withNotTarget(true);
player.choose(outcome, target, source, game); player.choose(outcome, target, source, game);
game.addEffect(new BlocksIfAbleTargetEffect(Duration.EndOfTurn) game.addEffect(new BlocksIfAbleTargetEffect(Duration.EndOfTurn)
.setTargetPointer(new FixedTargets(new CardsImpl(target.getTargets()), game)), source); .setTargetPointer(new FixedTargets(new CardsImpl(target.getTargets()), game)), source);

View file

@ -81,7 +81,7 @@ class BlackSunsTwilightEffect extends OneShotEffect {
return false; return false;
} }
TargetCard target = new TargetCardInYourGraveyard(filter); TargetCard target = new TargetCardInYourGraveyard(filter);
target.setNotTarget(true); target.withNotTarget(true);
player.choose(outcome, target, source, game); player.choose(outcome, target, source, game);
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());
return card != null && player.moveCards( return card != null && player.moveCards(

View file

@ -79,7 +79,7 @@ class BlessingOfFrostEffect extends OneShotEffect {
int snow = ManaPaidSourceWatcher.getSnowPaid(source.getId(), game); int snow = ManaPaidSourceWatcher.getSnowPaid(source.getId(), game);
if (snow > 0) { if (snow > 0) {
TargetAmount target = new TargetCreaturePermanentAmount(snow, StaticFilters.FILTER_CONTROLLED_CREATURE); TargetAmount target = new TargetCreaturePermanentAmount(snow, StaticFilters.FILTER_CONTROLLED_CREATURE);
target.setNotTarget(true); target.withNotTarget(true);
target.chooseTarget(outcome, player.getId(), source, game); target.chooseTarget(outcome, player.getId(), source, game);
for (UUID targetId : target.getTargets()) { for (UUID targetId : target.getTargets()) {
Permanent permanent = game.getPermanent(targetId); Permanent permanent = game.getPermanent(targetId);

View file

@ -72,7 +72,7 @@ class BloodClockEffect extends OneShotEffect {
return true; return true;
} }
Target target = new TargetControlledPermanent(); Target target = new TargetControlledPermanent();
target.setNotTarget(true); target.withNotTarget(true);
if (!target.canChoose(player.getId(), source, game) if (!target.canChoose(player.getId(), source, game)
|| !player.chooseTarget(outcome, target, source, game)) { || !player.chooseTarget(outcome, target, source, game)) {
return false; return false;

View file

@ -65,7 +65,7 @@ class BloodCurdleEffect extends OneShotEffect {
return false; return false;
} }
Target target = new TargetControlledCreaturePermanent(); Target target = new TargetControlledCreaturePermanent();
target.setNotTarget(true); target.withNotTarget(true);
if (!player.choose(outcome, target, source, game)) { if (!player.choose(outcome, target, source, game)) {
return false; return false;
} }

View file

@ -90,7 +90,7 @@ class BlossomingTortoiseEffect extends OneShotEffect {
return false; return false;
} }
TargetCard target = new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_LAND); TargetCard target = new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_LAND);
target.setNotTarget(true); target.withNotTarget(true);
player.choose(outcome, target, source, game); player.choose(outcome, target, source, game);
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());
return card != null && player.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null); return card != null && player.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);

View file

@ -99,7 +99,7 @@ class BlotOutEffect extends OneShotEffect {
return false; return false;
} }
TargetPermanent target = new TargetPermanent(filter); TargetPermanent target = new TargetPermanent(filter);
target.setNotTarget(true); target.withNotTarget(true);
opponent.choose(outcome, target, source, game); opponent.choose(outcome, target, source, game);
Permanent permanent = game.getPermanent(target.getFirstTarget()); Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent == null) { if (permanent == null) {

View file

@ -64,7 +64,7 @@ class BodyDoubleCopyEffect extends OneShotEffect {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
if (player != null) { if (player != null) {
Target target = new TargetCardInGraveyard(new FilterCreatureCard("creature card in a graveyard")); Target target = new TargetCardInGraveyard(new FilterCreatureCard("creature card in a graveyard"));
target.setNotTarget(true); target.withNotTarget(true);
if (target.canChoose(source.getControllerId(), source, game)) { if (target.canChoose(source.getControllerId(), source, game)) {
player.choose(outcome, target, source, game); player.choose(outcome, target, source, game);
Card copyFromCard = game.getCard(target.getFirstTarget()); Card copyFromCard = game.getCard(target.getFirstTarget());

View file

@ -79,7 +79,7 @@ class BreachTheMultiverseEffect extends OneShotEffect {
} }
Cards cards = new CardsImpl(); Cards cards = new CardsImpl();
TargetCard target = new TargetCardInGraveyard(filter); TargetCard target = new TargetCardInGraveyard(filter);
target.setNotTarget(true); target.withNotTarget(true);
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId); Player player = game.getPlayer(playerId);
if (player == null || player.getGraveyard().count(filter, game) < 1) { if (player == null || player.getGraveyard().count(filter, game) < 1) {

View file

@ -70,7 +70,7 @@ class EnteringReturnFromGraveyardToBattlefieldEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
Target target = new TargetCardInGraveyard(StaticFilters.FILTER_CARD_CREATURE); Target target = new TargetCardInGraveyard(StaticFilters.FILTER_CARD_CREATURE);
target.setNotTarget(true); target.withNotTarget(true);
if (target.canChoose(source.getControllerId(), source, game) if (target.canChoose(source.getControllerId(), source, game)
&& controller.chooseTarget(outcome, target, source, game)) { && controller.chooseTarget(outcome, target, source, game)) {
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());

View file

@ -120,7 +120,7 @@ class BreathOfFuryEffect extends OneShotEffect {
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature you control that could be enchanted by " + enchantment.getName()); FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature you control that could be enchanted by " + enchantment.getName());
filter.add(new CanBeEnchantedByPredicate(enchantment)); filter.add(new CanBeEnchantedByPredicate(enchantment));
Target target = new TargetControlledCreaturePermanent(filter); Target target = new TargetControlledCreaturePermanent(filter);
target.setNotTarget(true); target.withNotTarget(true);
// It's important to check that the creature was successfully sacrificed here. Effects that prevent sacrifice will also prevent Breath of Fury's effect from working. // It's important to check that the creature was successfully sacrificed here. Effects that prevent sacrifice will also prevent Breath of Fury's effect from working.
// Commanders going to the command zone and Rest in Peace style replacement effects don't make Permanent.sacrifice return false. // Commanders going to the command zone and Rest in Peace style replacement effects don't make Permanent.sacrifice return false.
if (enchantedCreature != null && controller != null if (enchantedCreature != null && controller != null

View file

@ -130,7 +130,7 @@ class BreenaTheDemagogueEffect extends OneShotEffect {
return false; return false;
} }
TargetPermanent target = new TargetControlledCreaturePermanent(); TargetPermanent target = new TargetControlledCreaturePermanent();
target.setNotTarget(true); target.withNotTarget(true);
player.choose(outcome, target, source, game); player.choose(outcome, target, source, game);
Permanent permanent = game.getPermanent(target.getFirstTarget()); Permanent permanent = game.getPermanent(target.getFirstTarget());
return permanent != null && permanent.addCounters( return permanent != null && permanent.addCounters(

View file

@ -87,7 +87,7 @@ class BronzehideLionReturnEffect extends OneShotEffect {
return false; return false;
} }
TargetPermanent target = new TargetControlledCreaturePermanent(); TargetPermanent target = new TargetControlledCreaturePermanent();
target.setNotTarget(true); target.withNotTarget(true);
if (controller.choose(outcome, target, source, game) if (controller.choose(outcome, target, source, game)
&& game.getPermanent(target.getFirstTarget()) != null) { && game.getPermanent(target.getFirstTarget()) != null) {
game.getState().setValue("attachTo:" + source.getSourceId(), target.getFirstTarget()); game.getState().setValue("attachTo:" + source.getSourceId(), target.getFirstTarget());

View file

@ -92,7 +92,7 @@ class BrudicladTelchorEngineerEffect extends OneShotEffect {
if (effect.apply(game, source)) { if (effect.apply(game, source)) {
TargetControlledPermanent target = new TargetControlledPermanent(0, 1, filter, true); TargetControlledPermanent target = new TargetControlledPermanent(0, 1, filter, true);
target.setNotTarget(true); target.withNotTarget(true);
if (controller.chooseUse(outcome, "Select a token to copy?", source, game) if (controller.chooseUse(outcome, "Select a token to copy?", source, game)
&& controller.choose(Outcome.Neutral, target, source, game)) { && controller.choose(Outcome.Neutral, target, source, game)) {
Permanent toCopyFromPermanent = game.getPermanent(target.getFirstTarget()); Permanent toCopyFromPermanent = game.getPermanent(target.getFirstTarget());

View file

@ -101,7 +101,7 @@ class BrunaLightOfAlabasterEffect extends OneShotEffect {
&& countBattlefield > 0 && countBattlefield > 0
&& controller.chooseUse(Outcome.Benefit, "Attach an Aura from the battlefield?", source, game)) { && controller.chooseUse(Outcome.Benefit, "Attach an Aura from the battlefield?", source, game)) {
Target targetAura = new TargetPermanent(filterAura); Target targetAura = new TargetPermanent(filterAura);
targetAura.setNotTarget(true); targetAura.withNotTarget(true);
if (!controller.choose(Outcome.Benefit, targetAura, source, game)) { continue; } if (!controller.choose(Outcome.Benefit, targetAura, source, game)) { continue; }
Permanent aura = game.getPermanent(targetAura.getFirstTarget()); Permanent aura = game.getPermanent(targetAura.getFirstTarget());

View file

@ -58,7 +58,7 @@ class CallToTheVoidEffect extends OneShotEffect {
private void chooseCreature(Map<String, List<String>> map, Set<Permanent> permanents, FilterPermanent filter, Player player, Ability source, Game game) { private void chooseCreature(Map<String, List<String>> map, Set<Permanent> permanents, FilterPermanent filter, Player player, Ability source, Game game) {
if (game.getBattlefield().count(filter, player.getId(), source, game) > 0) { if (game.getBattlefield().count(filter, player.getId(), source, game) > 0) {
TargetPermanent target = new TargetPermanent(filter); TargetPermanent target = new TargetPermanent(filter);
target.setNotTarget(true); target.withNotTarget(true);
player.choose(outcome, target, source, game); player.choose(outcome, target, source, game);
Permanent permanent = game.getPermanent(target.getFirstTarget()); Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) { if (permanent != null) {

View file

@ -71,7 +71,7 @@ class CankerAbominationEffect extends OneShotEffect {
Permanent cankerAbomination = game.getPermanentEntering(source.getSourceId()); Permanent cankerAbomination = game.getPermanentEntering(source.getSourceId());
if (controller != null && cankerAbomination != null) { if (controller != null && cankerAbomination != null) {
Target target = new TargetOpponent(); Target target = new TargetOpponent();
target.setNotTarget(true); target.withNotTarget(true);
controller.choose(outcome, target, source, game); controller.choose(outcome, target, source, game);
Player opponent = game.getPlayer(target.getFirstTarget()); Player opponent = game.getPlayer(target.getFirstTarget());
if (opponent != null) { if (opponent != null) {

View file

@ -95,7 +95,7 @@ class CanoptekWraithEffect extends OneShotEffect {
return false; return false;
} }
TargetPermanent target = new TargetPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND); TargetPermanent target = new TargetPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND);
target.setNotTarget(true); target.withNotTarget(true);
player.choose(outcome, target, source, game); player.choose(outcome, target, source, game);
Permanent permanent = game.getPermanent(target.getFirstTarget()); Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent == null) { if (permanent == null) {

View file

@ -75,7 +75,7 @@ class CauldronsGiftEffect extends OneShotEffect {
return true; return true;
} }
TargetCard target = new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD); TargetCard target = new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD);
target.setNotTarget(true); target.withNotTarget(true);
if (!player.choose(outcome, player.getGraveyard(), target, source, game)) { if (!player.choose(outcome, player.getGraveyard(), target, source, game)) {
return true; return true;
} }

View file

@ -90,7 +90,7 @@ class CelestialJudgmentEffect extends OneShotEffect {
FilterPermanent filter = new FilterCreaturePermanent("creature with power " + entry.getKey() + " to save"); FilterPermanent filter = new FilterCreaturePermanent("creature with power " + entry.getKey() + " to save");
filter.add(new PowerPredicate(ComparisonType.EQUAL_TO, entry.getKey())); filter.add(new PowerPredicate(ComparisonType.EQUAL_TO, entry.getKey()));
TargetPermanent target = new TargetPermanent(filter); TargetPermanent target = new TargetPermanent(filter);
target.setNotTarget(true); target.withNotTarget(true);
player.choose(outcome, target, source, game); player.choose(outcome, target, source, game);
toKeep.add(target.getFirstTarget()); toKeep.add(target.getFirstTarget());
} }

View file

@ -87,7 +87,7 @@ class CemeteryDesecratorEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
TargetCardInGraveyard target = new TargetCardInGraveyard(filter); TargetCardInGraveyard target = new TargetCardInGraveyard(filter);
target.setNotTarget(true); target.withNotTarget(true);
controller.choose(outcome, target, source, game); controller.choose(outcome, target, source, game);
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());
if (card != null) { if (card != null) {

View file

@ -82,7 +82,7 @@ class CemeteryGatekeeperEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
TargetCardInGraveyard target = new TargetCardInGraveyard(); TargetCardInGraveyard target = new TargetCardInGraveyard();
target.setNotTarget(true); target.withNotTarget(true);
controller.choose(outcome, target, source, game); controller.choose(outcome, target, source, game);
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());
if (card != null) { if (card != null) {

View file

@ -87,7 +87,7 @@ class CemeteryIlluminatorExileEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
TargetCardInGraveyard target = new TargetCardInGraveyard(); TargetCardInGraveyard target = new TargetCardInGraveyard();
target.setNotTarget(true); target.withNotTarget(true);
controller.choose(outcome, target, source, game); controller.choose(outcome, target, source, game);
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());
if (card != null) { if (card != null) {

View file

@ -83,7 +83,7 @@ class CemeteryProtectorEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
TargetCardInGraveyard target = new TargetCardInGraveyard(); TargetCardInGraveyard target = new TargetCardInGraveyard();
target.setNotTarget(true); target.withNotTarget(true);
controller.choose(outcome, target, source, game); controller.choose(outcome, target, source, game);
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());
if (card != null) { if (card != null) {

View file

@ -75,7 +75,7 @@ class CemeteryProwlerExileEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
TargetCardInGraveyard target = new TargetCardInGraveyard(); TargetCardInGraveyard target = new TargetCardInGraveyard();
target.setNotTarget(true); target.withNotTarget(true);
controller.choose(outcome, target, source, game); controller.choose(outcome, target, source, game);
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());
if (card != null) { if (card != null) {

View file

@ -76,7 +76,7 @@ class CharmbreakerDevilsEffect extends OneShotEffect {
} }
TargetCard target = new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_INSTANT_AND_SORCERY); TargetCard target = new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_INSTANT_AND_SORCERY);
target.setRandom(true); target.setRandom(true);
target.setNotTarget(true); target.withNotTarget(true);
target.chooseTarget(outcome, player.getId(), source, game); target.chooseTarget(outcome, player.getId(), source, game);
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());
return card != null && player.moveCards(card, Zone.HAND, source, game); return card != null && player.moveCards(card, Zone.HAND, source, game);

View file

@ -68,7 +68,7 @@ class CheckForTrapsEffect extends OneShotEffect {
} }
opponent.revealCards(source, opponent.getHand(), game); opponent.revealCards(source, opponent.getHand(), game);
TargetCard target = new TargetCard(Zone.HAND, StaticFilters.FILTER_CARD_NON_LAND); TargetCard target = new TargetCard(Zone.HAND, StaticFilters.FILTER_CARD_NON_LAND);
target.setNotTarget(true); target.withNotTarget(true);
boolean opponentLoseLife = false; boolean opponentLoseLife = false;
if (controller.choose(outcome, opponent.getHand(), target, source, game)) { if (controller.choose(outcome, opponent.getHand(), target, source, game)) {
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());

View file

@ -73,7 +73,7 @@ class ChimneyImpEffect extends OneShotEffect {
if (targetOpponent != null) { if (targetOpponent != null) {
if (!targetOpponent.getHand().isEmpty()) { if (!targetOpponent.getHand().isEmpty()) {
TargetCardInHand target = new TargetCardInHand(); TargetCardInHand target = new TargetCardInHand();
target.setNotTarget(true); target.withNotTarget(true);
target.setTargetName("a card from your hand to put on top of your library"); target.setTargetName("a card from your hand to put on top of your library");
targetOpponent.choose(Outcome.Detriment, target, source, game); targetOpponent.choose(Outcome.Detriment, target, source, game);
Card card = targetOpponent.getHand().get(target.getFirstTarget(), game); Card card = targetOpponent.getHand().get(target.getFirstTarget(), game);

View file

@ -70,7 +70,7 @@ class ChitteringRatsEffect extends OneShotEffect {
if (targetOpponent != null) { if (targetOpponent != null) {
if (!targetOpponent.getHand().isEmpty()) { if (!targetOpponent.getHand().isEmpty()) {
TargetCardInHand target = new TargetCardInHand(); TargetCardInHand target = new TargetCardInHand();
target.setNotTarget(true); target.withNotTarget(true);
target.setTargetName("a card from your hand to put on top of your library"); target.setTargetName("a card from your hand to put on top of your library");
targetOpponent.choose(Outcome.Detriment, target, source, game); targetOpponent.choose(Outcome.Detriment, target, source, game);
Card card = targetOpponent.getHand().get(target.getFirstTarget(), game); Card card = targetOpponent.getHand().get(target.getFirstTarget(), game);

View file

@ -74,7 +74,7 @@ class ChokingMiasmaEffect extends OneShotEffect {
return false; return false;
} }
TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(); TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent();
target.setNotTarget(true); target.withNotTarget(true);
if (!target.canChoose(controller.getId(), source, game)) { if (!target.canChoose(controller.getId(), source, game)) {
return false; return false;
} }

View file

@ -78,7 +78,7 @@ class ChromeMoxEffect extends OneShotEffect {
MageObject sourceObject = source.getSourceObject(game); MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) { if (controller != null && sourceObject != null) {
TargetCard target = new TargetCard(Zone.HAND, filter); TargetCard target = new TargetCard(Zone.HAND, filter);
target.setNotTarget(true); target.withNotTarget(true);
Card cardToImprint = null; Card cardToImprint = null;
Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (!controller.getHand().isEmpty() && controller.choose(Outcome.Benefit, target, source, game)) { if (!controller.getHand().isEmpty() && controller.choose(Outcome.Benefit, target, source, game)) {

View file

@ -75,7 +75,7 @@ class CinderheartGiantEffect extends OneShotEffect {
return false; return false;
} }
TargetPermanent target = new TargetOpponentsCreaturePermanent(); TargetPermanent target = new TargetOpponentsCreaturePermanent();
target.setNotTarget(true); target.withNotTarget(true);
target.setRandom(true); target.setRandom(true);
target.chooseTarget(outcome, player.getId(), source, game); target.chooseTarget(outcome, player.getId(), source, game);
Permanent permanent = game.getPermanent(target.getFirstTarget()); Permanent permanent = game.getPermanent(target.getFirstTarget());

View file

@ -121,7 +121,7 @@ class CirdanTheShipwrightVote extends VoteHandler<Player> {
@Override @Override
protected Player playerChoose(String voteInfo, Player player, Player decidingPlayer, Ability source, Game game) { protected Player playerChoose(String voteInfo, Player player, Player decidingPlayer, Ability source, Game game) {
TargetPlayer target = new TargetPlayer(); TargetPlayer target = new TargetPlayer();
target.setNotTarget(true); target.withNotTarget(true);
target.withChooseHint("to vote for"); target.withChooseHint("to vote for");
decidingPlayer.choose(Outcome.Benefit, target, source, game); decidingPlayer.choose(Outcome.Benefit, target, source, game);
return game.getPlayer(target.getFirstTarget()); return game.getPlayer(target.getFirstTarget());

View file

@ -93,7 +93,7 @@ class ClackbridgeTrollEffect extends OneShotEffect {
continue; continue;
} }
TargetControlledPermanent target = new TargetControlledPermanent(filter); TargetControlledPermanent target = new TargetControlledPermanent(filter);
target.setNotTarget(true); target.withNotTarget(true);
if (!target.canChoose(opponent.getId(), source, game) if (!target.canChoose(opponent.getId(), source, game)
|| !opponent.chooseUse(Outcome.AIDontUseIt, "Sacrifice a creature?", source, game) || !opponent.chooseUse(Outcome.AIDontUseIt, "Sacrifice a creature?", source, game)
|| !opponent.choose(Outcome.Sacrifice, target, source, game)) { || !opponent.choose(Outcome.Sacrifice, target, source, game)) {

View file

@ -72,7 +72,7 @@ class ClarionUltimatumEffect extends OneShotEffect {
source.getControllerId(), source, game source.getControllerId(), source, game
); );
TargetPermanent targetPermanent = new TargetControlledPermanent(Math.max(permCount, 5)); TargetPermanent targetPermanent = new TargetControlledPermanent(Math.max(permCount, 5));
targetPermanent.setNotTarget(true); targetPermanent.withNotTarget(true);
player.choose(outcome, targetPermanent, source, game); player.choose(outcome, targetPermanent, source, game);
Set<String> names = targetPermanent Set<String> names = targetPermanent
.getTargets() .getTargets()

View file

@ -105,7 +105,7 @@ class ConfoundingConundrumEffect extends OneShotEffect {
return false; return false;
} }
TargetPermanent target = new TargetPermanent(1, StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND); TargetPermanent target = new TargetPermanent(1, StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND);
target.setNotTarget(true); target.withNotTarget(true);
if (!target.canChoose(player.getId(), source, game)) { if (!target.canChoose(player.getId(), source, game)) {
return false; return false;
} }

View file

@ -92,7 +92,7 @@ class ConcoctEffect extends OneShotEffect {
} }
player.surveil(3, source, game); player.surveil(3, source, game);
Target target = new TargetCardInYourGraveyard(filter); Target target = new TargetCardInYourGraveyard(filter);
target.setNotTarget(true); target.withNotTarget(true);
if (player.choose(outcome, target, source, game)) { if (player.choose(outcome, target, source, game)) {
Effect effect = new ReturnFromGraveyardToBattlefieldTargetEffect(); Effect effect = new ReturnFromGraveyardToBattlefieldTargetEffect();
effect.setTargetPointer(new FixedTarget(target.getFirstTarget(), game)); effect.setTargetPointer(new FixedTarget(target.getFirstTarget(), game));

View file

@ -69,7 +69,7 @@ class ConsumingTideEffect extends OneShotEffect {
Player player = game.getPlayer(playerId); Player player = game.getPlayer(playerId);
if (player != null) { if (player != null) {
TargetNonlandPermanent target = new TargetNonlandPermanent(); TargetNonlandPermanent target = new TargetNonlandPermanent();
target.setNotTarget(true); target.withNotTarget(true);
player.choose(Outcome.Benefit, target, source, game); player.choose(Outcome.Benefit, target, source, game);
UUID permId = target.getFirstTarget(); UUID permId = target.getFirstTarget();
if (permId != null) { if (permId != null) {

View file

@ -81,7 +81,7 @@ class ContractualSafeguardFirstEffect extends OneShotEffect {
return false; return false;
} }
TargetPermanent target = new TargetControlledCreaturePermanent(); TargetPermanent target = new TargetControlledCreaturePermanent();
target.withChooseHint("to give a shield counter").setNotTarget(true); target.withChooseHint("to give a shield counter").withNotTarget(true);
player.choose(outcome, target, source, game); player.choose(outcome, target, source, game);
Permanent permanent = game.getPermanent(target.getFirstTarget()); Permanent permanent = game.getPermanent(target.getFirstTarget());
return permanent != null && permanent.addCounters(CounterType.SHIELD.createInstance(), source, game); return permanent != null && permanent.addCounters(CounterType.SHIELD.createInstance(), source, game);
@ -120,7 +120,7 @@ class ContractualSafeguardSecondEffect extends OneShotEffect {
return false; return false;
} }
TargetPermanent target = new TargetPermanent(filter); TargetPermanent target = new TargetPermanent(filter);
target.setNotTarget(true); target.withNotTarget(true);
player.choose(outcome, target, source, game); player.choose(outcome, target, source, game);
Permanent permanent = game.getPermanent(target.getFirstTarget()); Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent == null) { if (permanent == null) {

View file

@ -63,7 +63,7 @@ class CorpseChurnEffect extends OneShotEffect {
return false; return false;
} }
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD); TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD);
target.setNotTarget(true); target.withNotTarget(true);
if (target.canChoose(source.getControllerId(), source, game) if (target.canChoose(source.getControllerId(), source, game)
&& controller.chooseUse(outcome, "Return a creature card from your graveyard to hand?", source, game) && controller.chooseUse(outcome, "Return a creature card from your graveyard to hand?", source, game)
&& controller.choose(Outcome.ReturnToHand, target, source, game)) { && controller.choose(Outcome.ReturnToHand, target, source, game)) {

View file

@ -99,7 +99,7 @@ class CouncilsJudgmentVote extends VoteHandler<Permanent> {
} }
TargetPermanent target = new TargetPermanent(1, filter); TargetPermanent target = new TargetPermanent(1, filter);
target.withChooseHint(voteInfo + " (to exile)"); target.withChooseHint(voteInfo + " (to exile)");
target.setNotTarget(true); target.withNotTarget(true);
decidingPlayer.choose(Outcome.Exile, target, source, game); decidingPlayer.choose(Outcome.Exile, target, source, game);
return game.getPermanent(target.getFirstTarget()); return game.getPermanent(target.getFirstTarget());
} }

View file

@ -76,7 +76,7 @@ class CreamOfTheCropEffect extends OneShotEffect {
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, permanent.getPower().getValue())); Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, permanent.getPower().getValue()));
if (!cards.isEmpty()) { if (!cards.isEmpty()) {
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put on top of your library")); TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put on top of your library"));
target.setNotTarget(true); target.withNotTarget(true);
controller.chooseTarget(Outcome.Benefit, cards, target, source, game); controller.chooseTarget(Outcome.Benefit, cards, target, source, game);
Card card = cards.get(target.getFirstTarget(), game); Card card = cards.get(target.getFirstTarget(), game);
if (card != null) { if (card != null) {

View file

@ -83,7 +83,7 @@ class CreepingInnEffect extends OneShotEffect {
if (player != null && permanent != null) { if (player != null && permanent != null) {
UUID exileId = CardUtil.getExileZoneId(game, source); UUID exileId = CardUtil.getExileZoneId(game, source);
TargetCardInGraveyard target = new TargetCardInGraveyard(0, 1, StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD); TargetCardInGraveyard target = new TargetCardInGraveyard(0, 1, StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD);
target.setNotTarget(true); target.withNotTarget(true);
if (target.canChoose(player.getId(), source, game)) { if (target.canChoose(player.getId(), source, game)) {
if (player.choose(Outcome.Exile, target, source, game)) { if (player.choose(Outcome.Exile, target, source, game)) {
Card cardChosen = game.getCard(target.getFirstTarget()); Card cardChosen = game.getCard(target.getFirstTarget());

View file

@ -89,7 +89,7 @@ class CrownOfTheAgesEffect extends OneShotEffect {
filterChoice.add(Predicates.not(new PermanentIdPredicate(fromPermanent.getId()))); filterChoice.add(Predicates.not(new PermanentIdPredicate(fromPermanent.getId())));
Target chosenCreatureToAttachAura = new TargetPermanent(filterChoice); Target chosenCreatureToAttachAura = new TargetPermanent(filterChoice);
chosenCreatureToAttachAura.setNotTarget(true); chosenCreatureToAttachAura.withNotTarget(true);
if (chosenCreatureToAttachAura.canChoose(source.getControllerId(), source, game) if (chosenCreatureToAttachAura.canChoose(source.getControllerId(), source, game)
&& controller.choose(Outcome.Neutral, chosenCreatureToAttachAura, source, game)) { && controller.choose(Outcome.Neutral, chosenCreatureToAttachAura, source, game)) {

View file

@ -85,7 +85,7 @@ class CruelRealityEffect extends OneShotEffect {
return false; return false;
} }
TargetPermanent target = new TargetPermanent(filter); TargetPermanent target = new TargetPermanent(filter);
target.setNotTarget(true); target.withNotTarget(true);
if (target.canChoose(cursedPlayer.getId(), source, game) if (target.canChoose(cursedPlayer.getId(), source, game)
&& cursedPlayer.choose(Outcome.Sacrifice, target, source, game)) { && cursedPlayer.choose(Outcome.Sacrifice, target, source, game)) {
Permanent objectToBeSacrificed = game.getPermanent(target.getFirstTarget()); Permanent objectToBeSacrificed = game.getPermanent(target.getFirstTarget());

View file

@ -82,7 +82,7 @@ class CurseOfLeechesEffect extends ReplacementEffectImpl {
return false; return false;
} }
TargetPlayer target = new TargetPlayer(); TargetPlayer target = new TargetPlayer();
target.withChooseHint("Player to attach to").setNotTarget(true); target.withChooseHint("Player to attach to").withNotTarget(true);
controller.choose(Outcome.Detriment, target, source, game); controller.choose(Outcome.Detriment, target, source, game);
Permanent permanent = source.getSourcePermanentIfItStillExists(game); Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (permanent == null) { if (permanent == null) {

View file

@ -85,7 +85,7 @@ class CurseOfThePiercedHeartEffect extends OneShotEffect {
FilterPermanent filter = new FilterPlaneswalkerPermanent("a planeswalker controlled by " + opponent.getLogName()); FilterPermanent filter = new FilterPlaneswalkerPermanent("a planeswalker controlled by " + opponent.getLogName());
filter.add(new ControllerIdPredicate(opponent.getId())); filter.add(new ControllerIdPredicate(opponent.getId()));
TargetPermanent target = new TargetPermanent(filter); TargetPermanent target = new TargetPermanent(filter);
target.setNotTarget(true); target.withNotTarget(true);
controller.choose(outcome, target, source, game); controller.choose(outcome, target, source, game);
Permanent permanent = game.getPermanent(target.getFirstTarget()); Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) { if (permanent != null) {

View file

@ -110,7 +110,7 @@ class CustodiSquireVote extends VoteHandler<Card> {
} }
TargetCardInGraveyard target = new TargetCardInGraveyard(filter); TargetCardInGraveyard target = new TargetCardInGraveyard(filter);
target.withChooseHint(voteInfo + " (from graveyard to hand)"); target.withChooseHint(voteInfo + " (from graveyard to hand)");
target.setNotTarget(true); target.withNotTarget(true);
decidingPlayer.choose(Outcome.ReturnToHand, controller.getGraveyard(), target, source, game); decidingPlayer.choose(Outcome.ReturnToHand, controller.getGraveyard(), target, source, game);
return controller.getGraveyard().get(target.getFirstTarget(), game); return controller.getGraveyard().get(target.getFirstTarget(), game);
} }

View file

@ -95,7 +95,7 @@ class DanithaBenaliasHopeEffect extends OneShotEffect {
} else { } else {
target = new TargetCardInYourGraveyard(filter); target = new TargetCardInYourGraveyard(filter);
} }
target.setNotTarget(true); target.withNotTarget(true);
if (target.canChoose(controller.getId(), source, game)) { if (target.canChoose(controller.getId(), source, game)) {
controller.chooseTarget(outcome, target, source, game); controller.chooseTarget(outcome, target, source, game);
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());

View file

@ -86,7 +86,7 @@ class DanseMacabreEffect extends OneShotEffect {
continue; continue;
} }
TargetPermanent target = new TargetPermanent(StaticFilters.FILTER_CONTROLLED_CREATURE_NON_TOKEN); TargetPermanent target = new TargetPermanent(StaticFilters.FILTER_CONTROLLED_CREATURE_NON_TOKEN);
target.setNotTarget(true); target.withNotTarget(true);
player.choose(Outcome.Sacrifice, target, source, game); player.choose(Outcome.Sacrifice, target, source, game);
Permanent permanent = game.getPermanent(target.getFirstTarget()); Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent == null) { if (permanent == null) {
@ -117,7 +117,7 @@ class DanseMacabreEffect extends OneShotEffect {
} else { } else {
return true; return true;
} }
target.setNotTarget(true); target.withNotTarget(true);
controller.choose(Outcome.PutCreatureInPlay, target, source, game); controller.choose(Outcome.PutCreatureInPlay, target, source, game);
controller.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, game); controller.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, game);
return true; return true;

View file

@ -93,7 +93,7 @@ class DawnbreakReclaimerEffect extends OneShotEffect {
TargetCard chosenCreatureOpponentGraveyard = new TargetCard(Zone.GRAVEYARD, filter); TargetCard chosenCreatureOpponentGraveyard = new TargetCard(Zone.GRAVEYARD, filter);
Player opponent = null; Player opponent = null;
Card cardOpponentGraveyard = null; Card cardOpponentGraveyard = null;
chosenCreatureOpponentGraveyard.setNotTarget(true); chosenCreatureOpponentGraveyard.withNotTarget(true);
if (chosenCreatureOpponentGraveyard.canChoose(source.getControllerId(), source, game)) { if (chosenCreatureOpponentGraveyard.canChoose(source.getControllerId(), source, game)) {
controller.choose(Outcome.Detriment, chosenCreatureOpponentGraveyard, source, game); controller.choose(Outcome.Detriment, chosenCreatureOpponentGraveyard, source, game);
cardOpponentGraveyard = game.getCard(chosenCreatureOpponentGraveyard.getFirstTarget()); cardOpponentGraveyard = game.getCard(chosenCreatureOpponentGraveyard.getFirstTarget());
@ -124,7 +124,7 @@ class DawnbreakReclaimerEffect extends OneShotEffect {
new FilterCreatureCard("a creature card in " + controller.getName() + "'s the graveyard"); new FilterCreatureCard("a creature card in " + controller.getName() + "'s the graveyard");
filterCreatureCard.add(new OwnerIdPredicate(controller.getId())); filterCreatureCard.add(new OwnerIdPredicate(controller.getId()));
TargetCardInGraveyard targetControllerGaveyard = new TargetCardInGraveyard(filterCreatureCard); TargetCardInGraveyard targetControllerGaveyard = new TargetCardInGraveyard(filterCreatureCard);
targetControllerGaveyard.setNotTarget(true); targetControllerGaveyard.withNotTarget(true);
Card controllerCreatureCard = null; Card controllerCreatureCard = null;
if (targetControllerGaveyard.canChoose(opponent.getId(), source, game) if (targetControllerGaveyard.canChoose(opponent.getId(), source, game)
&& opponent.choose(outcome, targetControllerGaveyard, source, game)) { && opponent.choose(outcome, targetControllerGaveyard, source, game)) {

View file

@ -80,7 +80,7 @@ class DeadlyBrewEffect extends OneShotEffect {
continue; continue;
} }
TargetPermanent target = new TargetPermanent(filter); TargetPermanent target = new TargetPermanent(filter);
target.setNotTarget(true); target.withNotTarget(true);
if (!target.canChoose(playerId, source, game)) { if (!target.canChoose(playerId, source, game)) {
continue; continue;
} }

View file

@ -72,7 +72,7 @@ class DeathbonnetHulkEffect extends OneShotEffect {
return false; return false;
} }
TargetCard target = new TargetCardInGraveyard(0, 1); TargetCard target = new TargetCardInGraveyard(0, 1);
target.setNotTarget(true); target.withNotTarget(true);
player.choose(outcome, target, source, game); player.choose(outcome, target, source, game);
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());
if (card == null) { if (card == null) {

View file

@ -129,7 +129,7 @@ class DeathsOasisEffect extends OneShotEffect {
return false; return false;
} }
TargetCard target = new TargetCardInYourGraveyard(filter); TargetCard target = new TargetCardInYourGraveyard(filter);
target.setNotTarget(true); target.withNotTarget(true);
if (!player.choose(outcome, player.getGraveyard(), target, source, game)) { if (!player.choose(outcome, player.getGraveyard(), target, source, game)) {
return false; return false;
} }

View file

@ -72,7 +72,7 @@ class DebtToTheKamiExileCreatureEffect extends OneShotEffect {
return false; return false;
} }
Target target = new TargetControlledCreaturePermanent(); Target target = new TargetControlledCreaturePermanent();
target.setNotTarget(true); target.withNotTarget(true);
player.choose(outcome, target, source, game); player.choose(outcome, target, source, game);
Permanent permanent = game.getPermanent(target.getFirstTarget()); Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent == null) { if (permanent == null) {
@ -111,7 +111,7 @@ class DebtToTheKamiExileEnchantmentEffect extends OneShotEffect {
return false; return false;
} }
Target target = new TargetControlledPermanent(filter); Target target = new TargetControlledPermanent(filter);
target.setNotTarget(true); target.withNotTarget(true);
player.choose(outcome, target, source, game); player.choose(outcome, target, source, game);
Permanent permanent = game.getPermanent(target.getFirstTarget()); Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent == null) { if (permanent == null) {

View file

@ -70,7 +70,7 @@ class DeeprootWayfinderEffect extends OneShotEffect {
} }
player.surveil(1, source, game); player.surveil(1, source, game);
TargetCard target = new TargetCardInYourGraveyard(0, 1, StaticFilters.FILTER_CARD_LAND_A); TargetCard target = new TargetCardInYourGraveyard(0, 1, StaticFilters.FILTER_CARD_LAND_A);
target.setNotTarget(true); target.withNotTarget(true);
player.choose(outcome, target, source, game); player.choose(outcome, target, source, game);
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());
return player.moveCards( return player.moveCards(

View file

@ -79,7 +79,7 @@ class DefilerOfSoulsEffect extends OneShotEffect {
amount = Math.min(1, realCount); amount = Math.min(1, realCount);
Target target = new TargetControlledPermanent(amount, amount, filter, false); Target target = new TargetControlledPermanent(amount, amount, filter, false);
target.setNotTarget(true); target.withNotTarget(true);
//A spell or ability could have removed the only legal target this player //A spell or ability could have removed the only legal target this player
//had, if thats the case this ability should fizzle. //had, if thats the case this ability should fizzle.

View file

@ -84,7 +84,7 @@ class DeliverUntoEvilEffect extends OneShotEffect {
return player.moveCards(cards, Zone.HAND, source, game); return player.moveCards(cards, Zone.HAND, source, game);
} }
TargetOpponent targetOpponent = new TargetOpponent(); TargetOpponent targetOpponent = new TargetOpponent();
targetOpponent.setNotTarget(true); targetOpponent.withNotTarget(true);
if (!player.choose(outcome, targetOpponent, source, game)) { if (!player.choose(outcome, targetOpponent, source, game)) {
return false; return false;
} }

View file

@ -92,14 +92,14 @@ class DemonicHordesEffect extends OneShotEffect {
} }
demonicHordes.tap(source, game); demonicHordes.tap(source, game);
Target choiceOpponent = new TargetOpponent(); Target choiceOpponent = new TargetOpponent();
choiceOpponent.setNotTarget(true); choiceOpponent.withNotTarget(true);
FilterLandPermanent filterLand = new FilterLandPermanent(); FilterLandPermanent filterLand = new FilterLandPermanent();
filterLand.add(new ControllerIdPredicate(source.getControllerId())); filterLand.add(new ControllerIdPredicate(source.getControllerId()));
if (controller.choose(Outcome.Neutral, choiceOpponent, source, game)) { if (controller.choose(Outcome.Neutral, choiceOpponent, source, game)) {
Player opponent = game.getPlayer(choiceOpponent.getFirstTarget()); Player opponent = game.getPlayer(choiceOpponent.getFirstTarget());
if (opponent != null) { if (opponent != null) {
Target chosenLand = new TargetLandPermanent(filterLand); Target chosenLand = new TargetLandPermanent(filterLand);
chosenLand.setNotTarget(true); chosenLand.withNotTarget(true);
if (opponent.chooseTarget(Outcome.Sacrifice, chosenLand, source, game)) { if (opponent.chooseTarget(Outcome.Sacrifice, chosenLand, source, game)) {
Permanent land = game.getPermanent(chosenLand.getFirstTarget()); Permanent land = game.getPermanent(chosenLand.getFirstTarget());
if (land != null) { if (land != null) {

View file

@ -84,7 +84,7 @@ class DermotaxiImprintEffect extends OneShotEffect {
return false; return false;
} }
TargetCardInGraveyard target = new TargetCardInGraveyard(StaticFilters.FILTER_CARD_CREATURE); TargetCardInGraveyard target = new TargetCardInGraveyard(StaticFilters.FILTER_CARD_CREATURE);
target.setNotTarget(true); target.withNotTarget(true);
if (!target.canChoose(source.getControllerId(), game)) { if (!target.canChoose(source.getControllerId(), game)) {
return false; return false;
} }

View file

@ -123,7 +123,7 @@ class DesecrateRealityEffect extends OneShotEffect {
// return a permanent card with an odd mana value from your graveyard to the battlefield. // return a permanent card with an odd mana value from your graveyard to the battlefield.
Target target = new TargetCardInYourGraveyard(filter); Target target = new TargetCardInYourGraveyard(filter);
target.setNotTarget(true); target.withNotTarget(true);
if (controller.choose(outcome, target, source, game)) { if (controller.choose(outcome, target, source, game)) {
Effect effect = new ReturnFromGraveyardToBattlefieldTargetEffect(); Effect effect = new ReturnFromGraveyardToBattlefieldTargetEffect();
effect.setTargetPointer(new FixedTarget(target.getFirstTarget(), game)); effect.setTargetPointer(new FixedTarget(target.getFirstTarget(), game));

View file

@ -68,7 +68,7 @@ class DesolationEffect extends OneShotEffect {
continue; continue;
} }
TargetPermanent target = new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND); TargetPermanent target = new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND);
target.setNotTarget(true); target.withNotTarget(true);
if (!target.canChoose(player.getId(), source, game)) { if (!target.canChoose(player.getId(), source, game)) {
continue; continue;
} }

View file

@ -66,7 +66,7 @@ class DigUpTheBodyEffect extends OneShotEffect {
} }
player.millCards(2, source, game); player.millCards(2, source, game);
TargetCard target = new TargetCardInYourGraveyard(0, 1, StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD); TargetCard target = new TargetCardInYourGraveyard(0, 1, StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD);
target.setNotTarget(true); target.withNotTarget(true);
if (!target.canChoose(source.getControllerId(), source, game)) { if (!target.canChoose(source.getControllerId(), source, game)) {
return true; return true;
} }

View file

@ -163,7 +163,7 @@ class DimensionalBreachReturnEffect extends OneShotEffect {
} }
if (cards.size() > 1) { if (cards.size() > 1) {
TargetCard target = new TargetCardInExile(StaticFilters.FILTER_CARD); TargetCard target = new TargetCardInExile(StaticFilters.FILTER_CARD);
target.setNotTarget(true); target.withNotTarget(true);
player.choose(outcome, cards, target, source, game); player.choose(outcome, cards, target, source, game);
cards.clear(); cards.clear();
cards.add(target.getFirstTarget()); cards.add(target.getFirstTarget());

View file

@ -108,7 +108,7 @@ class DiscerningFinancierEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
TargetPlayer target = new TargetPlayer(filter); TargetPlayer target = new TargetPlayer(filter);
target.setNotTarget(true); target.withNotTarget(true);
Permanent treasure = game.getPermanent(source.getFirstTarget()); Permanent treasure = game.getPermanent(source.getFirstTarget());
if (treasure == null || !target.canChoose(source.getControllerId(), source, game)) { if (treasure == null || !target.canChoose(source.getControllerId(), source, game)) {
return false; return false;

View file

@ -85,7 +85,7 @@ class DoomForetoldEffect extends OneShotEffect {
filter2.add(new ControllerIdPredicate(player.getId())); filter2.add(new ControllerIdPredicate(player.getId()));
if (game.getBattlefield().contains(filter2, source, game, 1)) { if (game.getBattlefield().contains(filter2, source, game, 1)) {
TargetPermanent target = new TargetPermanent(filter2); TargetPermanent target = new TargetPermanent(filter2);
target.setNotTarget(true); target.withNotTarget(true);
if (player.choose(Outcome.Sacrifice, target, source, game)) { if (player.choose(Outcome.Sacrifice, target, source, game)) {
Permanent permanent = game.getPermanent(target.getFirstTarget()); Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null && permanent.sacrifice(source, game)) { if (permanent != null && permanent.sacrifice(source, game)) {

View file

@ -73,7 +73,7 @@ class DoomfallEffect extends OneShotEffect {
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
if (targetPlayer != null) { if (targetPlayer != null) {
Target target = new TargetControlledCreaturePermanent(); Target target = new TargetControlledCreaturePermanent();
target.setNotTarget(true); target.withNotTarget(true);
if (targetPlayer.choose(outcome, target, source, game)) { if (targetPlayer.choose(outcome, target, source, game)) {
targetPlayer.moveCards(game.getPermanent(target.getFirstTarget()), Zone.EXILED, source, game); targetPlayer.moveCards(game.getPermanent(target.getFirstTarget()), Zone.EXILED, source, game);
} }

View file

@ -73,7 +73,7 @@ class DoomgapeEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
Target target = new TargetControlledCreaturePermanent(); Target target = new TargetControlledCreaturePermanent();
target.setNotTarget(true); target.withNotTarget(true);
if (controller.choose(Outcome.Sacrifice, target, source, game)) { if (controller.choose(Outcome.Sacrifice, target, source, game)) {
Permanent creature = game.getPermanent(target.getFirstTarget()); Permanent creature = game.getPermanent(target.getFirstTarget());
if (creature != null) { if (creature != null) {

View file

@ -65,7 +65,7 @@ class DrakeFamiliarEffect extends OneShotEffect {
return false; return false;
} }
TargetPermanent target = new TargetPermanent(StaticFilters.FILTER_PERMANENT_ENCHANTMENT); TargetPermanent target = new TargetPermanent(StaticFilters.FILTER_PERMANENT_ENCHANTMENT);
target.setNotTarget(true); target.withNotTarget(true);
if (target.canChoose(controller.getId(), source, game) if (target.canChoose(controller.getId(), source, game)
&& controller.chooseUse(outcome, "Return an enchantment to its owner's hand?", source, game)) { && controller.chooseUse(outcome, "Return an enchantment to its owner's hand?", source, game)) {
controller.chooseTarget(Outcome.ReturnToHand, target, source, game); controller.chooseTarget(Outcome.ReturnToHand, target, source, game);

View file

@ -92,7 +92,7 @@ class DranaTheLastBloodchiefEffect extends OneShotEffect {
return false; return false;
} }
TargetCard target = new TargetCardInGraveyard(filter); TargetCard target = new TargetCardInGraveyard(filter);
target.setNotTarget(true); target.withNotTarget(true);
player.choose(outcome, controller.getGraveyard(), target, source, game); player.choose(outcome, controller.getGraveyard(), target, source, game);
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());
if (card == null) { if (card == null) {

View file

@ -71,7 +71,7 @@ class DreamsOfSteelAndOilEffect extends OneShotEffect {
FilterCard filter = new FilterCard("artifact or creature card from " + opponent.getName() + "'s hand"); FilterCard filter = new FilterCard("artifact or creature card from " + opponent.getName() + "'s hand");
filter.add(Predicates.or(CardType.ARTIFACT.getPredicate(), CardType.CREATURE.getPredicate())); filter.add(Predicates.or(CardType.ARTIFACT.getPredicate(), CardType.CREATURE.getPredicate()));
TargetCard target = new TargetCard(Zone.HAND, filter); TargetCard target = new TargetCard(Zone.HAND, filter);
target.setNotTarget(true); target.withNotTarget(true);
controller.chooseTarget(Outcome.Discard, opponent.getHand(), target, source, game); controller.chooseTarget(Outcome.Discard, opponent.getHand(), target, source, game);
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());
if (card != null) { if (card != null) {
@ -80,7 +80,7 @@ class DreamsOfSteelAndOilEffect extends OneShotEffect {
filter.setMessage("artifact or creature card from " + opponent.getName() + "'s graveyard"); filter.setMessage("artifact or creature card from " + opponent.getName() + "'s graveyard");
target = new TargetCard(Zone.GRAVEYARD, filter); target = new TargetCard(Zone.GRAVEYARD, filter);
target.setNotTarget(true); target.withNotTarget(true);
controller.chooseTarget(Outcome.Exile, opponent.getGraveyard(), target, source, game); controller.chooseTarget(Outcome.Exile, opponent.getGraveyard(), target, source, game);
card = game.getCard(target.getFirstTarget()); card = game.getCard(target.getFirstTarget());
if (card != null) { if (card != null) {

View file

@ -69,7 +69,7 @@ class DredgeTheMireEffect extends OneShotEffect {
continue; continue;
} }
TargetCard target = new TargetCardInGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD); TargetCard target = new TargetCardInGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD);
target.setNotTarget(true); target.withNotTarget(true);
if (!player.choose(outcome, player.getGraveyard(), target, source, game)) { if (!player.choose(outcome, player.getGraveyard(), target, source, game)) {
continue; continue;
} }

View file

@ -88,7 +88,7 @@ class DropOfHoneyEffect extends OneShotEffect {
FilterCreaturePermanent filter = new FilterCreaturePermanent("one of the creatures with the least power"); FilterCreaturePermanent filter = new FilterCreaturePermanent("one of the creatures with the least power");
filter.add(new PowerPredicate(ComparisonType.EQUAL_TO, leastPower)); filter.add(new PowerPredicate(ComparisonType.EQUAL_TO, leastPower));
Target target = new TargetPermanent(filter); Target target = new TargetPermanent(filter);
target.setNotTarget(true); target.withNotTarget(true);
if (target.canChoose(source.getControllerId(), source, game)) { if (target.canChoose(source.getControllerId(), source, game)) {
if (controller.choose(outcome, target, source, game)) { if (controller.choose(outcome, target, source, game)) {
permanentToDestroy = game.getPermanent(target.getFirstTarget()); permanentToDestroy = game.getPermanent(target.getFirstTarget());

View file

@ -80,7 +80,7 @@ class DruidOfPurificationEffect extends OneShotEffect {
return false; return false;
} }
TargetPermanent target = new TargetPermanent(0, 1, filter); TargetPermanent target = new TargetPermanent(0, 1, filter);
target.setNotTarget(true); target.withNotTarget(true);
Set<Permanent> permanents = new HashSet<>(); Set<Permanent> permanents = new HashSet<>();
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId); Player player = game.getPlayer(playerId);

View file

@ -78,7 +78,7 @@ class EcologicalAppreciationEffect extends OneShotEffect {
FilterCard filter = new FilterCreatureCard(); FilterCard filter = new FilterCreatureCard();
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, xValue + 1)); filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, xValue + 1));
TargetCardInLibrary targetCardsInLibrary = new TargetCardWithDifferentNameInLibrary(0, 4, filter); TargetCardInLibrary targetCardsInLibrary = new TargetCardWithDifferentNameInLibrary(0, 4, filter);
targetCardsInLibrary.setNotTarget(true); targetCardsInLibrary.withNotTarget(true);
targetCardsInLibrary.withChooseHint("Step 1 of 2: Search library"); targetCardsInLibrary.withChooseHint("Step 1 of 2: Search library");
player.searchLibrary(targetCardsInLibrary, source, game); player.searchLibrary(targetCardsInLibrary, source, game);
Cards cards = new CardsImpl(targetCardsInLibrary.getTargets()); Cards cards = new CardsImpl(targetCardsInLibrary.getTargets());
@ -102,7 +102,7 @@ class EcologicalAppreciationEffect extends OneShotEffect {
return isValidTarget(card, checkList); return isValidTarget(card, checkList);
} }
}; };
targetCardsInGY.setNotTarget(true); targetCardsInGY.withNotTarget(true);
targetCardsInGY.withChooseHint("Step 2 of 2: Search graveyard"); targetCardsInGY.withChooseHint("Step 2 of 2: Search graveyard");
player.choose(Outcome.PutCreatureInPlay, player.getGraveyard(), targetCardsInGY, source, game); player.choose(Outcome.PutCreatureInPlay, player.getGraveyard(), targetCardsInGY, source, game);
cards.addAll(targetCardsInGY.getTargets()); cards.addAll(targetCardsInGY.getTargets());
@ -113,13 +113,13 @@ class EcologicalAppreciationEffect extends OneShotEffect {
} }
TargetOpponent targetOpponent = new TargetOpponent(); TargetOpponent targetOpponent = new TargetOpponent();
targetOpponent.setNotTarget(true); targetOpponent.withNotTarget(true);
player.choose(outcome, targetOpponent, source, game); player.choose(outcome, targetOpponent, source, game);
Player opponent = game.getPlayer(targetOpponent.getFirstTarget()); Player opponent = game.getPlayer(targetOpponent.getFirstTarget());
if (opponent != null) { if (opponent != null) {
TargetCard chosenCards = new TargetCard(2, Zone.ALL, StaticFilters.FILTER_CARD); TargetCard chosenCards = new TargetCard(2, Zone.ALL, StaticFilters.FILTER_CARD);
chosenCards.setNotTarget(true); chosenCards.withNotTarget(true);
opponent.choose(outcome, cards, chosenCards, source, game); opponent.choose(outcome, cards, chosenCards, source, game);
Cards toShuffle = new CardsImpl(chosenCards.getTargets().stream() Cards toShuffle = new CardsImpl(chosenCards.getTargets().stream()
.map(game::getCard) .map(game::getCard)

View file

@ -111,7 +111,7 @@ class ElrondOfWhiteCouncilEffect extends OneShotEffect {
// (2023-06-16): If you have multiple votes, you can vote for fellowship multiple times. If you do, you can choose the same creature each time. // (2023-06-16): If you have multiple votes, you can vote for fellowship multiple times. If you do, you can choose the same creature each time.
for (int i = 0; i < countFellowship; ++i) { for (int i = 0; i < countFellowship; ++i) {
TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(1); TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(1);
target.setNotTarget(true); target.withNotTarget(true);
if (player.chooseTarget(Outcome.Detriment, target, source, game)) { if (player.chooseTarget(Outcome.Detriment, target, source, game)) {
Permanent chosen = game.getPermanent(target.getFirstTarget()); Permanent chosen = game.getPermanent(target.getFirstTarget());

Some files were not shown because too many files have changed in this diff Show more