mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
refactor: improve method name (related to 86fa9278)
This commit is contained in:
parent
723df8f53c
commit
fdd244786b
31 changed files with 44 additions and 45 deletions
|
|
@ -42,7 +42,7 @@ public class ChooseSecretOpponentEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
TargetOpponent targetOpponent = new TargetOpponent(true);
|
||||
targetOpponent.setTargetName("opponent (secretly)");
|
||||
targetOpponent.withTargetName("opponent (secretly)");
|
||||
controller.choose(outcome, targetOpponent, source, game);
|
||||
if (targetOpponent.getFirstTarget() == null) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ public class ClashEffect extends OneShotEffect {
|
|||
}
|
||||
// choose opponent
|
||||
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)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ public class ConvokeAbility extends SimpleStaticAbility implements AlternateMana
|
|||
filter.add(Predicates.or(colorPredicates));
|
||||
}
|
||||
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);
|
||||
if (specialAction.canActivate(source.getControllerId(), game).canActivate()) {
|
||||
game.getState().getSpecialActions().add(specialAction);
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class ImproviseAbility extends SimpleStaticAbility implements AlternateMa
|
|||
specialAction.setSourceId(source.getSourceId());
|
||||
// create filter for possible artifacts to tap
|
||||
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);
|
||||
if (specialAction.canActivate(source.getControllerId(), game).canActivate()) {
|
||||
game.getState().getSpecialActions().add(specialAction);
|
||||
|
|
|
|||
|
|
@ -1276,7 +1276,7 @@ public abstract class GameImpl implements Game {
|
|||
Player choosingPlayer = null;
|
||||
if (startingPlayerId == null) {
|
||||
TargetPlayer targetPlayer = new TargetPlayer();
|
||||
targetPlayer.setTargetName("starting player");
|
||||
targetPlayer.withTargetName("starting player");
|
||||
if (choosingPlayerId != null) {
|
||||
choosingPlayer = this.getPlayer(choosingPlayerId);
|
||||
if (choosingPlayer != null && !choosingPlayer.canRespond()) {
|
||||
|
|
@ -2869,7 +2869,7 @@ public abstract class GameImpl implements Game {
|
|||
}
|
||||
Target targetLegendaryToKeep = new TargetPermanent(filterLegendName);
|
||||
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);
|
||||
for (Permanent dupLegend : getBattlefield().getActivePermanents(filterLegendName, legend.getControllerId(), this)) {
|
||||
if (!targetLegendaryToKeep.getTargets().contains(dupLegend.getId())) {
|
||||
|
|
|
|||
|
|
@ -562,7 +562,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
}
|
||||
TargetDefender target = new TargetDefender(defendersToChooseFrom);
|
||||
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)) {
|
||||
player.declareAttacker(creature.getId(), target.getFirstTarget(), game, false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2957,7 +2957,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
boolean casted = false;
|
||||
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);
|
||||
while (!castableCards.isEmpty()) {
|
||||
targetCard.clearChosen();
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ public interface Target extends Serializable {
|
|||
* Overwrites the name automatically generated from the filter text.
|
||||
* If you want to add additional info for usability, use `withChooseHint` instead.
|
||||
*/
|
||||
Target setTargetName(String name);
|
||||
Target withTargetName(String name);
|
||||
|
||||
String getTargetedName(Game game);
|
||||
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ public abstract class TargetImpl implements Target {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TargetImpl setTargetName(String name) {
|
||||
public TargetImpl withTargetName(String name) {
|
||||
this.targetName = name;
|
||||
return this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class EachOpponentPermanentTargetsAdjuster implements TargetAdjuster {
|
|||
Filter<Permanent> filter = newTarget.getFilter();
|
||||
filter.add(new ControllerIdPredicate(opponentId));
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class ManaValueTargetAdjuster implements TargetAdjuster {
|
|||
int amount = dynamicValue.calculate(game, ability, ability.getEffects().get(0));
|
||||
Filter<MageObject> filter = newTarget.getFilter();
|
||||
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.addTarget(newTarget);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class PowerTargetAdjuster implements TargetAdjuster {
|
|||
int amount = dynamicValue.calculate(game, ability, ability.getEffects().get(0));
|
||||
Filter<MageObject> filter = newTarget.getFilter();
|
||||
filter.add(new PowerPredicate(comparison, amount));
|
||||
newTarget.setTargetName(filter.getMessage() + " (Power " + comparison + " " + amount + ")");
|
||||
newTarget.withTargetName(filter.getMessage() + " (Power " + comparison + " " + amount + ")");
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(newTarget);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,9 +36,9 @@ public class TargetsCountAdjuster implements TargetAdjuster {
|
|||
Filter filter = newTarget.getFilter();
|
||||
if (blueprintTarget.getMinNumberOfTargets() != 0) {
|
||||
newTarget.setMinNumberOfTargets(count);
|
||||
newTarget.setTargetName(filter.getMessage() + " (" + count + " targets)");
|
||||
newTarget.withTargetName(filter.getMessage() + " (" + count + " targets)");
|
||||
} else {
|
||||
newTarget.setTargetName(filter.getMessage() + " (up to " + count + " targets)");
|
||||
newTarget.withTargetName(filter.getMessage() + " (up to " + count + " targets)");
|
||||
}
|
||||
ability.getTargets().clear();
|
||||
if (count > 0) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class ToughnessTargetAdjuster implements TargetAdjuster {
|
|||
int amount = dynamicValue.calculate(game, ability, ability.getEffects().get(0));
|
||||
Filter<MageObject> filter = newTarget.getFilter();
|
||||
filter.add(new ToughnessPredicate(comparison, amount));
|
||||
newTarget.setTargetName(filter.getMessage() + " (Toughness " + comparison + " " + amount + ")");
|
||||
newTarget.withTargetName(filter.getMessage() + " (Toughness " + comparison + " " + amount + ")");
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(newTarget);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue