refactor: improve method name (related to 86fa9278)

This commit is contained in:
xenohedron 2024-06-13 00:40:07 -04:00
parent 723df8f53c
commit fdd244786b
31 changed files with 44 additions and 45 deletions

View file

@ -1989,7 +1989,7 @@ public class HumanPlayer extends PlayerImpl {
Permanent attacker = game.getPermanent(attackerId); Permanent attacker = game.getPermanent(attackerId);
if (attacker != null) { if (attacker != null) {
sb.append(" (").append(attacker.getName()).append(')'); sb.append(" (").append(attacker.getName()).append(')');
target.setTargetName(sb.toString()); target.withTargetName(sb.toString());
} }
} }
if (chooseTarget(Outcome.Damage, target, null, game)) { if (chooseTarget(Outcome.Damage, target, null, game)) {
@ -2181,7 +2181,7 @@ public class HumanPlayer extends PlayerImpl {
Target target = new TargetAnyTarget(); Target target = new TargetAnyTarget();
target.withNotTarget(true); target.withNotTarget(true);
if (singleTargetName != null) { if (singleTargetName != null) {
target.setTargetName(singleTargetName); target.withTargetName(singleTargetName);
} }
this.choose(Outcome.Damage, target, source, game); this.choose(Outcome.Damage, target, source, game);
if (targets.isEmpty() || targets.contains(target.getFirstTarget())) { if (targets.isEmpty() || targets.contains(target.getFirstTarget())) {

View file

@ -43,7 +43,7 @@ public final class ChiseiHeartOfOceans extends CardImpl {
// At the beginning of your upkeep, sacrifice Chisei, Heart of Oceans unless you remove a counter from a permanent you control. // At the beginning of your upkeep, sacrifice Chisei, Heart of Oceans unless you remove a counter from a permanent you control.
TargetPermanent target = new TargetPermanent(1, 1, filter, true); TargetPermanent target = new TargetPermanent(1, 1, filter, true);
target.setTargetName("a permanent you control"); target.withTargetName("a permanent you control");
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new RemoveCounterCost(target)), TargetController.YOU, false)); this.addAbility(new BeginningOfUpkeepTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new RemoveCounterCost(target)), TargetController.YOU, false));
} }

View file

@ -58,7 +58,7 @@ class TargetControlledPermanentSharingOpponentPermanentCardType extends TargetCo
super(); super();
this.filter = this.filter.copy(); this.filter = this.filter.copy();
filter.add(Predicates.not(CardType.LAND.getPredicate())); filter.add(Predicates.not(CardType.LAND.getPredicate()));
setTargetName("nonland permanent you control"); withTargetName("nonland permanent you control");
} }
private TargetControlledPermanentSharingOpponentPermanentCardType(final TargetControlledPermanentSharingOpponentPermanentCardType target) { private TargetControlledPermanentSharingOpponentPermanentCardType(final TargetControlledPermanentSharingOpponentPermanentCardType target) {
@ -128,7 +128,7 @@ class DaringThiefSecondTarget extends TargetPermanent {
super(); super();
this.filter = this.filter.copy(); this.filter = this.filter.copy();
filter.add(TargetController.OPPONENT.getControllerPredicate()); filter.add(TargetController.OPPONENT.getControllerPredicate());
setTargetName("permanent an opponent controls that shares a card type with it"); withTargetName("permanent an opponent controls that shares a card type with it");
} }
private DaringThiefSecondTarget(final DaringThiefSecondTarget target) { private DaringThiefSecondTarget(final DaringThiefSecondTarget target) {

View file

@ -49,7 +49,7 @@ public final class FabricationFoundry extends CardImpl {
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addCost(new ExileTargetsTotalManaValueCost()); ability.addCost(new ExileTargetsTotalManaValueCost());
Target target = new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_ARTIFACT_FROM_YOUR_GRAVEYARD); Target target = new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_ARTIFACT_FROM_YOUR_GRAVEYARD);
target.setTargetName("artifact card with mana value X or less from your graveyard"); target.withTargetName("artifact card with mana value X or less from your graveyard");
ability.addTarget(target); ability.addTarget(target);
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -61,7 +61,7 @@ class GauntletsOfChaosFirstTarget extends TargetControlledPermanent {
CardType.ARTIFACT.getPredicate(), CardType.ARTIFACT.getPredicate(),
CardType.CREATURE.getPredicate(), CardType.CREATURE.getPredicate(),
CardType.LAND.getPredicate())); CardType.LAND.getPredicate()));
setTargetName("artifact, creature, or land you control"); withTargetName("artifact, creature, or land you control");
} }
private GauntletsOfChaosFirstTarget(final GauntletsOfChaosFirstTarget target) { private GauntletsOfChaosFirstTarget(final GauntletsOfChaosFirstTarget target) {
@ -131,7 +131,7 @@ class GauntletsOfChaosSecondTarget extends TargetPermanent {
super(); super();
this.filter = this.filter.copy(); this.filter = this.filter.copy();
filter.add(TargetController.OPPONENT.getControllerPredicate()); filter.add(TargetController.OPPONENT.getControllerPredicate());
setTargetName("permanent an opponent controls that shares one of those types with it"); withTargetName("permanent an opponent controls that shares one of those types with it");
} }
private GauntletsOfChaosSecondTarget(final GauntletsOfChaosSecondTarget target) { private GauntletsOfChaosSecondTarget(final GauntletsOfChaosSecondTarget target) {

View file

@ -87,7 +87,7 @@ class GluntchTheBestowerEffect extends OneShotEffect {
TargetPlayer playerChoice = new TargetPlayer(); TargetPlayer playerChoice = new TargetPlayer();
playerChoice.withNotTarget(true); playerChoice.withNotTarget(true);
playerChoice.setTargetName("a player that will put two +1/+1 counters on a creature they control"); playerChoice.withTargetName("a player that will put two +1/+1 counters on a creature they control");
controller.choose(Outcome.BoostCreature, playerChoice, source, game); controller.choose(Outcome.BoostCreature, playerChoice, source, game);
UUID firstChosenPlayerId = playerChoice.getFirstTarget(); UUID firstChosenPlayerId = playerChoice.getFirstTarget();
@ -99,7 +99,7 @@ class GluntchTheBestowerEffect extends OneShotEffect {
game.informPlayers(firstChosenPlayer.getLogName() + " has been chosen for the first effect."); game.informPlayers(firstChosenPlayer.getLogName() + " has been chosen for the first effect.");
TargetPermanent targetChosenCreature = new TargetControlledCreaturePermanent(); TargetPermanent targetChosenCreature = new TargetControlledCreaturePermanent();
targetChosenCreature.withNotTarget(true); targetChosenCreature.withNotTarget(true);
playerChoice.setTargetName("a creature you control to add two +1/+1 counters on it"); playerChoice.withTargetName("a creature you control to add two +1/+1 counters on it");
firstChosenPlayer.choose(Outcome.BoostCreature, targetChosenCreature, source, game); firstChosenPlayer.choose(Outcome.BoostCreature, targetChosenCreature, source, game);
Permanent chosenCreature = game.getPermanent(targetChosenCreature.getFirstTarget()); Permanent chosenCreature = game.getPermanent(targetChosenCreature.getFirstTarget());
@ -116,7 +116,7 @@ class GluntchTheBestowerEffect extends OneShotEffect {
filterNotFirst.add(Predicates.not(new PlayerIdPredicate(firstChosenPlayerId))); filterNotFirst.add(Predicates.not(new PlayerIdPredicate(firstChosenPlayerId)));
playerChoice = new TargetPlayer(filterNotFirst); playerChoice = new TargetPlayer(filterNotFirst);
playerChoice.withNotTarget(true); playerChoice.withNotTarget(true);
playerChoice.setTargetName("a player that will draw a card"); playerChoice.withTargetName("a player that will draw a card");
controller.choose(Outcome.DrawCard, playerChoice, source, game); controller.choose(Outcome.DrawCard, playerChoice, source, game);
UUID secondChosenPlayerId = playerChoice.getFirstTarget(); UUID secondChosenPlayerId = playerChoice.getFirstTarget();
@ -138,7 +138,7 @@ class GluntchTheBestowerEffect extends OneShotEffect {
filterNotFirstNorSecond.add(Predicates.not(new PlayerIdPredicate(secondChosenPlayerId))); filterNotFirstNorSecond.add(Predicates.not(new PlayerIdPredicate(secondChosenPlayerId)));
playerChoice = new TargetPlayer(filterNotFirstNorSecond); playerChoice = new TargetPlayer(filterNotFirstNorSecond);
playerChoice.withNotTarget(true); playerChoice.withNotTarget(true);
playerChoice.setTargetName("a player that will create two Treasure tokens"); playerChoice.withTargetName("a player that will create two Treasure tokens");
controller.choose(Outcome.DrawCard, playerChoice, source, game); controller.choose(Outcome.DrawCard, playerChoice, source, game);
UUID thirdChosenPlayerId = playerChoice.getFirstTarget(); UUID thirdChosenPlayerId = playerChoice.getFirstTarget();

View file

@ -64,7 +64,7 @@ class GlyphOfDelusionSecondTarget extends TargetPermanent {
public GlyphOfDelusionSecondTarget() { public GlyphOfDelusionSecondTarget() {
super(); super();
setTargetName("target creature that target Wall blocked this turn"); withTargetName("target creature that target Wall blocked this turn");
} }
private GlyphOfDelusionSecondTarget(final GlyphOfDelusionSecondTarget target) { private GlyphOfDelusionSecondTarget(final GlyphOfDelusionSecondTarget target) {

View file

@ -19,7 +19,6 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import mage.target.common.TargetAnyTarget; import mage.target.common.TargetAnyTarget;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetSacrifice; import mage.target.common.TargetSacrifice;
@ -44,12 +43,12 @@ public final class GrabTheReins extends CardImpl {
effect.setText("and it gains haste"); effect.setText("and it gains haste");
this.getSpellAbility().addEffect(effect); this.getSpellAbility().addEffect(effect);
TargetCreaturePermanent target = new TargetCreaturePermanent(); TargetCreaturePermanent target = new TargetCreaturePermanent();
target.setTargetName("a creature to take control of"); target.withTargetName("a creature to take control of");
this.getSpellAbility().addTarget(target); this.getSpellAbility().addTarget(target);
// or sacrifice a creature, then Grab the Reins deals damage equal to that creature's power to any target. // or sacrifice a creature, then Grab the Reins deals damage equal to that creature's power to any target.
Mode mode = new Mode(new GrabTheReinsEffect()); Mode mode = new Mode(new GrabTheReinsEffect());
TargetAnyTarget target2 = new TargetAnyTarget(); TargetAnyTarget target2 = new TargetAnyTarget();
target2.setTargetName("a creature or player to damage"); target2.withTargetName("a creature or player to damage");
mode.addTarget(target2); mode.addTarget(target2);
this.getSpellAbility().getModes().addMode(mode); this.getSpellAbility().getModes().addMode(mode);

View file

@ -97,7 +97,7 @@ class KaitoDancingShadowEffect extends OneShotEffect {
filter.add(new PermanentReferenceInCollectionPredicate( filter.add(new PermanentReferenceInCollectionPredicate(
watcher.getPermanents(controller.getId(),damagedPlayer.getId()))); watcher.getPermanents(controller.getId(),damagedPlayer.getId())));
TargetPermanent target = new TargetPermanent(0, 1, filter, true); TargetPermanent target = new TargetPermanent(0, 1, filter, true);
target.setTargetName("creature to return to hand?"); target.withTargetName("creature to return to hand?");
if (target.chooseTarget(Outcome.ReturnToHand, source.getControllerId(), source, game)) { if (target.chooseTarget(Outcome.ReturnToHand, source.getControllerId(), source, game)) {
Card card = game.getPermanent(target.getFirstTarget()); Card card = game.getPermanent(target.getFirstTarget());
if (card != null) { if (card != null) {

View file

@ -72,7 +72,7 @@ class MarchFromTheTombTarget extends TargetCardInYourGraveyard {
leftPossibleTargets.add(targetId); leftPossibleTargets.add(targetId);
} }
} }
setTargetName("any number of target Ally creature cards with total mana value of 8 or less (" + cmcLeft + " left) from your graveyard"); withTargetName("any number of target Ally creature cards with total mana value of 8 or less (" + cmcLeft + " left) from your graveyard");
return leftPossibleTargets; return leftPossibleTargets;
} }

View file

@ -68,7 +68,7 @@ class PolymorphousRushCopyEffect extends OneShotEffect {
if (controller != null) { if (controller != null) {
Target target = new TargetCreaturePermanent(new FilterCreaturePermanent("")); Target target = new TargetCreaturePermanent(new FilterCreaturePermanent(""));
target.withNotTarget(true); target.withNotTarget(true);
target.setTargetName("a creature on the battlefield (creature to copy)"); target.withTargetName("a creature on the battlefield (creature to copy)");
if (target.canChoose(controller.getId(), source, game) && controller.chooseTarget(outcome, target, source, game)) { if (target.canChoose(controller.getId(), source, game) && controller.chooseTarget(outcome, target, source, game)) {
Permanent copyFromCreature = game.getPermanent(target.getFirstTarget()); Permanent copyFromCreature = game.getPermanent(target.getFirstTarget());
if (copyFromCreature != null) { if (copyFromCreature != null) {

View file

@ -55,7 +55,7 @@ class TargetControlledPermanentWithCMCGreaterOrLessThanOpponentPermanent extends
super(); super();
this.filter = this.filter.copy(); this.filter = this.filter.copy();
filter.add(Predicates.not(CardType.LAND.getPredicate())); filter.add(Predicates.not(CardType.LAND.getPredicate()));
setTargetName("nonland permanent you control"); withTargetName("nonland permanent you control");
} }
private TargetControlledPermanentWithCMCGreaterOrLessThanOpponentPermanent(final TargetControlledPermanentWithCMCGreaterOrLessThanOpponentPermanent target) { private TargetControlledPermanentWithCMCGreaterOrLessThanOpponentPermanent(final TargetControlledPermanentWithCMCGreaterOrLessThanOpponentPermanent target) {
@ -91,7 +91,7 @@ class PucasMischiefSecondTarget extends TargetPermanent {
this.filter = this.filter.copy(); this.filter = this.filter.copy();
filter.add(TargetController.OPPONENT.getControllerPredicate()); filter.add(TargetController.OPPONENT.getControllerPredicate());
filter.add(Predicates.not(CardType.LAND.getPredicate())); filter.add(Predicates.not(CardType.LAND.getPredicate()));
setTargetName("permanent an opponent controls with an equal or lesser mana value"); withTargetName("permanent an opponent controls with an equal or lesser mana value");
} }
private PucasMischiefSecondTarget(final PucasMischiefSecondTarget target) { private PucasMischiefSecondTarget(final PucasMischiefSecondTarget target) {

View file

@ -101,7 +101,7 @@ class RetetherEffect extends OneShotEffect {
target.getFilter().add(CardType.CREATURE.getPredicate()); target.getFilter().add(CardType.CREATURE.getPredicate());
target.withNotTarget(true); target.withNotTarget(true);
if (target.canChoose(controller.getId(), source, game)) { if (target.canChoose(controller.getId(), source, game)) {
target.setTargetName("creature to enchant (" + aura.getLogName() + ')'); target.withTargetName("creature to enchant (" + aura.getLogName() + ')');
if (controller.choose(Outcome.PutCardInPlay, target, source, game)) { if (controller.choose(Outcome.PutCardInPlay, target, source, game)) {
Permanent permanent = game.getPermanent(target.getFirstTarget()); Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null && !permanent.cantBeAttachedBy(aura, source, game, true)) { if (permanent != null && !permanent.cantBeAttachedBy(aura, source, game, true)) {

View file

@ -190,7 +190,7 @@ class MoveAuraEffect extends OneShotEffect {
Filter filterChoice = chosenPermanentToAttachAuras.getFilter(); Filter filterChoice = chosenPermanentToAttachAuras.getFilter();
filterChoice.add(new ControllerIdPredicate(fromPermanent.getControllerId())); filterChoice.add(new ControllerIdPredicate(fromPermanent.getControllerId()));
filterChoice.add(Predicates.not(new PermanentIdPredicate(fromPermanent.getId()))); filterChoice.add(Predicates.not(new PermanentIdPredicate(fromPermanent.getId())));
chosenPermanentToAttachAuras.setTargetName("a different " + filterChoice.getMessage() + " with the same controller as the " + filterChoice.getMessage() + " the target aura is attached to"); chosenPermanentToAttachAuras.withTargetName("a different " + filterChoice.getMessage() + " with the same controller as the " + filterChoice.getMessage() + " the target aura is attached to");
if (chosenPermanentToAttachAuras.canChoose(source.getControllerId(), source, game) if (chosenPermanentToAttachAuras.canChoose(source.getControllerId(), source, game)
&& controller.choose(Outcome.Neutral, chosenPermanentToAttachAuras, source, game)) { && controller.choose(Outcome.Neutral, chosenPermanentToAttachAuras, source, game)) {
Permanent permanentToAttachAura = game.getPermanent(chosenPermanentToAttachAuras.getFirstTarget()); Permanent permanentToAttachAura = game.getPermanent(chosenPermanentToAttachAuras.getFirstTarget());

View file

@ -56,7 +56,7 @@ class TargetControlledCreatureWithPowerGreaterOrLessThanOpponentPermanent extend
super(); super();
this.filter = this.filter.copy(); this.filter = this.filter.copy();
filter.add(CardType.CREATURE.getPredicate()); filter.add(CardType.CREATURE.getPredicate());
setTargetName("creature you control"); withTargetName("creature you control");
} }
private TargetControlledCreatureWithPowerGreaterOrLessThanOpponentPermanent(final TargetControlledCreatureWithPowerGreaterOrLessThanOpponentPermanent target) { private TargetControlledCreatureWithPowerGreaterOrLessThanOpponentPermanent(final TargetControlledCreatureWithPowerGreaterOrLessThanOpponentPermanent target) {
@ -92,7 +92,7 @@ class SpawnbrokerSecondTarget extends TargetPermanent {
this.filter = this.filter.copy(); this.filter = this.filter.copy();
filter.add(TargetController.OPPONENT.getControllerPredicate()); filter.add(TargetController.OPPONENT.getControllerPredicate());
filter.add(CardType.CREATURE.getPredicate()); filter.add(CardType.CREATURE.getPredicate());
setTargetName("creature with power less than or equal to that creature's power an opponent controls"); withTargetName("creature with power less than or equal to that creature's power an opponent controls");
} }
private SpawnbrokerSecondTarget(final SpawnbrokerSecondTarget target) { private SpawnbrokerSecondTarget(final SpawnbrokerSecondTarget target) {

View file

@ -42,7 +42,7 @@ class ToppleTargetCreature extends TargetCreaturePermanent {
public ToppleTargetCreature() { public ToppleTargetCreature() {
super(); super();
setTargetName("creature with the greatest power among creatures on the battlefield"); withTargetName("creature with the greatest power among creatures on the battlefield");
} }
private ToppleTargetCreature(final ToppleTargetCreature target) { private ToppleTargetCreature(final ToppleTargetCreature target) {

View file

@ -90,7 +90,7 @@ class WormfangCrabExileEffect extends OneShotEffect {
filter.add(new ControllerIdPredicate(controller.getId())); filter.add(new ControllerIdPredicate(controller.getId()));
TargetPermanent target = new TargetPermanent(filter); TargetPermanent target = new TargetPermanent(filter);
target.withNotTarget(true); target.withNotTarget(true);
target.setTargetName("a permanent that player controls"); target.withTargetName("a permanent that player controls");
if (!opponent.choose(outcome, target, source, game)) { if (!opponent.choose(outcome, target, source, game)) {
return false; return false;
} }

View file

@ -42,7 +42,7 @@ public class ChooseSecretOpponentEffect extends OneShotEffect {
return false; return false;
} }
TargetOpponent targetOpponent = new TargetOpponent(true); TargetOpponent targetOpponent = new TargetOpponent(true);
targetOpponent.setTargetName("opponent (secretly)"); targetOpponent.withTargetName("opponent (secretly)");
controller.choose(outcome, targetOpponent, source, game); controller.choose(outcome, targetOpponent, source, game);
if (targetOpponent.getFirstTarget() == null) { if (targetOpponent.getFirstTarget() == null) {
return false; return false;

View file

@ -80,7 +80,7 @@ public class ClashEffect extends OneShotEffect {
} }
// choose opponent // choose opponent
Target target = new TargetOpponent(true); Target target = new TargetOpponent(true);
target.setTargetName("an opponent to clash with"); target.withTargetName("an opponent to clash with");
if (!controller.choose(Outcome.Benefit, target, source, game)) { if (!controller.choose(Outcome.Benefit, target, source, game)) {
return false; return false;
} }

View file

@ -132,7 +132,7 @@ public class ConvokeAbility extends SimpleStaticAbility implements AlternateMana
filter.add(Predicates.or(colorPredicates)); filter.add(Predicates.or(colorPredicates));
} }
Target target = new TargetControlledCreaturePermanent(1, 1, filter, true); Target target = new TargetControlledCreaturePermanent(1, 1, filter, true);
target.setTargetName("creature to tap for convoke"); target.withTargetName("creature to tap for convoke");
specialAction.addTarget(target); specialAction.addTarget(target);
if (specialAction.canActivate(source.getControllerId(), game).canActivate()) { if (specialAction.canActivate(source.getControllerId(), game).canActivate()) {
game.getState().getSpecialActions().add(specialAction); game.getState().getSpecialActions().add(specialAction);

View file

@ -89,7 +89,7 @@ public class ImproviseAbility extends SimpleStaticAbility implements AlternateMa
specialAction.setSourceId(source.getSourceId()); specialAction.setSourceId(source.getSourceId());
// create filter for possible artifacts to tap // create filter for possible artifacts to tap
Target target = new TargetControlledPermanent(1, unpaid.getMana().getGeneric(), filterUntapped, true); Target target = new TargetControlledPermanent(1, unpaid.getMana().getGeneric(), filterUntapped, true);
target.setTargetName("artifact to tap as Improvise's pay"); target.withTargetName("artifact to tap as Improvise's pay");
specialAction.addTarget(target); specialAction.addTarget(target);
if (specialAction.canActivate(source.getControllerId(), game).canActivate()) { if (specialAction.canActivate(source.getControllerId(), game).canActivate()) {
game.getState().getSpecialActions().add(specialAction); game.getState().getSpecialActions().add(specialAction);

View file

@ -1276,7 +1276,7 @@ public abstract class GameImpl implements Game {
Player choosingPlayer = null; Player choosingPlayer = null;
if (startingPlayerId == null) { if (startingPlayerId == null) {
TargetPlayer targetPlayer = new TargetPlayer(); TargetPlayer targetPlayer = new TargetPlayer();
targetPlayer.setTargetName("starting player"); targetPlayer.withTargetName("starting player");
if (choosingPlayerId != null) { if (choosingPlayerId != null) {
choosingPlayer = this.getPlayer(choosingPlayerId); choosingPlayer = this.getPlayer(choosingPlayerId);
if (choosingPlayer != null && !choosingPlayer.canRespond()) { if (choosingPlayer != null && !choosingPlayer.canRespond()) {
@ -2869,7 +2869,7 @@ public abstract class GameImpl implements Game {
} }
Target targetLegendaryToKeep = new TargetPermanent(filterLegendName); Target targetLegendaryToKeep = new TargetPermanent(filterLegendName);
targetLegendaryToKeep.withNotTarget(true); targetLegendaryToKeep.withNotTarget(true);
targetLegendaryToKeep.setTargetName(legend.getName() + " to keep (Legendary Rule)?"); targetLegendaryToKeep.withTargetName(legend.getName() + " to keep (Legendary Rule)?");
controller.choose(Outcome.Benefit, targetLegendaryToKeep, null, this); controller.choose(Outcome.Benefit, targetLegendaryToKeep, null, this);
for (Permanent dupLegend : getBattlefield().getActivePermanents(filterLegendName, legend.getControllerId(), this)) { for (Permanent dupLegend : getBattlefield().getActivePermanents(filterLegendName, legend.getControllerId(), this)) {
if (!targetLegendaryToKeep.getTargets().contains(dupLegend.getId())) { if (!targetLegendaryToKeep.getTargets().contains(dupLegend.getId())) {

View file

@ -562,7 +562,7 @@ public class Combat implements Serializable, Copyable<Combat> {
} }
TargetDefender target = new TargetDefender(defendersToChooseFrom); TargetDefender target = new TargetDefender(defendersToChooseFrom);
target.setRequired(true); target.setRequired(true);
target.setTargetName("permanent or player for " + creature.getLogName() + " to attack (must attack effect)"); target.withTargetName("permanent or player for " + creature.getLogName() + " to attack (must attack effect)");
if (player.chooseTarget(Outcome.Damage, target, null, game)) { if (player.chooseTarget(Outcome.Damage, target, null, game)) {
player.declareAttacker(creature.getId(), target.getFirstTarget(), game, false); player.declareAttacker(creature.getId(), target.getFirstTarget(), game, false);
} }

View file

@ -2957,7 +2957,7 @@ public abstract class PlayerImpl implements Player, Serializable {
boolean casted = false; boolean casted = false;
TargetCard targetCard = new TargetCard(0, 1, Zone.LIBRARY, StaticFilters.FILTER_CARD); TargetCard targetCard = new TargetCard(0, 1, Zone.LIBRARY, StaticFilters.FILTER_CARD);
targetCard.setTargetName("card to cast from library"); targetCard.withTargetName("card to cast from library");
targetCard.withNotTarget(true); targetCard.withNotTarget(true);
while (!castableCards.isEmpty()) { while (!castableCards.isEmpty()) {
targetCard.clearChosen(); targetCard.clearChosen();

View file

@ -112,7 +112,7 @@ public interface Target extends Serializable {
* Overwrites the name automatically generated from the filter text. * Overwrites the name automatically generated from the filter text.
* If you want to add additional info for usability, use `withChooseHint` instead. * If you want to add additional info for usability, use `withChooseHint` instead.
*/ */
Target setTargetName(String name); Target withTargetName(String name);
String getTargetedName(Game game); String getTargetedName(Game game);

View file

@ -177,7 +177,7 @@ public abstract class TargetImpl implements Target {
} }
@Override @Override
public TargetImpl setTargetName(String name) { public TargetImpl withTargetName(String name) {
this.targetName = name; this.targetName = name;
return this; return this;
} }

View file

@ -38,7 +38,7 @@ public class EachOpponentPermanentTargetsAdjuster implements TargetAdjuster {
Filter<Permanent> filter = newTarget.getFilter(); Filter<Permanent> filter = newTarget.getFilter();
filter.add(new ControllerIdPredicate(opponentId)); filter.add(new ControllerIdPredicate(opponentId));
if (!newTarget.possibleTargets(ability.getControllerId(), ability, game).isEmpty()) { if (!newTarget.possibleTargets(ability.getControllerId(), ability, game).isEmpty()) {
newTarget.setTargetName(filter.getMessage() + " controlled by " + opponent.getLogName()); newTarget.withTargetName(filter.getMessage() + " controlled by " + opponent.getLogName());
ability.addTarget(newTarget); ability.addTarget(newTarget);
} }
} }

View file

@ -38,7 +38,7 @@ public class ManaValueTargetAdjuster implements TargetAdjuster {
int amount = dynamicValue.calculate(game, ability, ability.getEffects().get(0)); int amount = dynamicValue.calculate(game, ability, ability.getEffects().get(0));
Filter<MageObject> filter = newTarget.getFilter(); Filter<MageObject> filter = newTarget.getFilter();
filter.add(new ManaValuePredicate(comparison, amount)); filter.add(new ManaValuePredicate(comparison, amount));
newTarget.setTargetName(filter.getMessage() + " (Mana Value " + comparison + " " + amount + ")"); newTarget.withTargetName(filter.getMessage() + " (Mana Value " + comparison + " " + amount + ")");
ability.getTargets().clear(); ability.getTargets().clear();
ability.addTarget(newTarget); ability.addTarget(newTarget);
} }

View file

@ -43,7 +43,7 @@ public class PowerTargetAdjuster implements TargetAdjuster {
int amount = dynamicValue.calculate(game, ability, ability.getEffects().get(0)); int amount = dynamicValue.calculate(game, ability, ability.getEffects().get(0));
Filter<MageObject> filter = newTarget.getFilter(); Filter<MageObject> filter = newTarget.getFilter();
filter.add(new PowerPredicate(comparison, amount)); filter.add(new PowerPredicate(comparison, amount));
newTarget.setTargetName(filter.getMessage() + " (Power " + comparison + " " + amount + ")"); newTarget.withTargetName(filter.getMessage() + " (Power " + comparison + " " + amount + ")");
ability.getTargets().clear(); ability.getTargets().clear();
ability.addTarget(newTarget); ability.addTarget(newTarget);
} }

View file

@ -36,9 +36,9 @@ public class TargetsCountAdjuster implements TargetAdjuster {
Filter filter = newTarget.getFilter(); Filter filter = newTarget.getFilter();
if (blueprintTarget.getMinNumberOfTargets() != 0) { if (blueprintTarget.getMinNumberOfTargets() != 0) {
newTarget.setMinNumberOfTargets(count); newTarget.setMinNumberOfTargets(count);
newTarget.setTargetName(filter.getMessage() + " (" + count + " targets)"); newTarget.withTargetName(filter.getMessage() + " (" + count + " targets)");
} else { } else {
newTarget.setTargetName(filter.getMessage() + " (up to " + count + " targets)"); newTarget.withTargetName(filter.getMessage() + " (up to " + count + " targets)");
} }
ability.getTargets().clear(); ability.getTargets().clear();
if (count > 0) { if (count > 0) {

View file

@ -43,7 +43,7 @@ public class ToughnessTargetAdjuster implements TargetAdjuster {
int amount = dynamicValue.calculate(game, ability, ability.getEffects().get(0)); int amount = dynamicValue.calculate(game, ability, ability.getEffects().get(0));
Filter<MageObject> filter = newTarget.getFilter(); Filter<MageObject> filter = newTarget.getFilter();
filter.add(new ToughnessPredicate(comparison, amount)); filter.add(new ToughnessPredicate(comparison, amount));
newTarget.setTargetName(filter.getMessage() + " (Toughness " + comparison + " " + amount + ")"); newTarget.withTargetName(filter.getMessage() + " (Toughness " + comparison + " " + amount + ")");
ability.getTargets().clear(); ability.getTargets().clear();
ability.addTarget(newTarget); ability.addTarget(newTarget);
} }