Fix spelling of doneChoosing() (#9002)

This commit is contained in:
DeepCrimson 2022-05-25 21:25:15 -07:00 committed by GitHub
parent 1e61efb90e
commit 0c8ef41012
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 30 additions and 30 deletions

View file

@ -395,7 +395,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
if (effect != null if (effect != null
&& stackObject.getControllerId().equals(playerId)) { && stackObject.getControllerId().equals(playerId)) {
Target target = effect.getTarget(); Target target = effect.getTarget();
if (!target.doneChosing()) { if (!target.doneChoosing()) {
for (UUID targetId : target.possibleTargets(stackObject.getControllerId(), stackObject.getStackAbility(), game)) { for (UUID targetId : target.possibleTargets(stackObject.getControllerId(), stackObject.getStackAbility(), game)) {
Game sim = game.copy(); Game sim = game.copy();
StackAbility newAbility = (StackAbility) stackObject.copy(); StackAbility newAbility = (StackAbility) stackObject.copy();
@ -748,10 +748,10 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
if (targets.isEmpty()) { if (targets.isEmpty()) {
return super.chooseTarget(outcome, cards, target, source, game); return super.chooseTarget(outcome, cards, target, source, game);
} }
if (!target.doneChosing()) { if (!target.doneChoosing()) {
for (UUID targetId : targets) { for (UUID targetId : targets) {
target.addTarget(targetId, source, game); target.addTarget(targetId, source, game);
if (target.doneChosing()) { if (target.doneChoosing()) {
targets.clear(); targets.clear();
return true; return true;
} }
@ -766,10 +766,10 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
if (targets.isEmpty()) { if (targets.isEmpty()) {
return super.choose(outcome, cards, target, game); return super.choose(outcome, cards, target, game);
} }
if (!target.doneChosing()) { if (!target.doneChoosing()) {
for (UUID targetId : targets) { for (UUID targetId : targets) {
target.add(targetId, game); target.add(targetId, game);
if (target.doneChosing()) { if (target.doneChoosing()) {
targets.clear(); targets.clear();
return true; return true;
} }

View file

@ -247,7 +247,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
} }
// add the target // add the target
target.add(permanent.getId(), game); target.add(permanent.getId(), game);
if (target.doneChosing()) { if (target.doneChoosing()) {
return true; return true;
} }
} }
@ -1991,7 +1991,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
// we still use playerId when getting cards even if they don't control the search // we still use playerId when getting cards even if they don't control the search
List<Card> cardChoices = new ArrayList<>(cards.getCards(target.getFilter(), playerId, source, game)); List<Card> cardChoices = new ArrayList<>(cards.getCards(target.getFilter(), playerId, source, game));
while (!target.doneChosing()) { while (!target.doneChoosing()) {
Card card = pickTarget(abilityControllerId, cardChoices, outcome, target, source, game); Card card = pickTarget(abilityControllerId, cardChoices, outcome, target, source, game);
if (card != null) { if (card != null) {
target.addTarget(card.getId(), source, game); target.addTarget(card.getId(), source, game);
@ -2022,7 +2022,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
} }
List<Card> cardChoices = new ArrayList<>(cards.getCards(target.getFilter(), game)); List<Card> cardChoices = new ArrayList<>(cards.getCards(target.getFilter(), game));
while (!target.doneChosing()) { while (!target.doneChoosing()) {
Card card = pickTarget(abilityControllerId, cardChoices, outcome, target, null, game); Card card = pickTarget(abilityControllerId, cardChoices, outcome, target, null, game);
if (card != null) { if (card != null) {
target.add(card.getId(), game); target.add(card.getId(), game);
@ -2989,7 +2989,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
@Override @Override
public SpellAbility chooseAbilityForCast(Card card, Game game, boolean noMana) { public SpellAbility chooseAbilityForCast(Card card, Game game, boolean noMana) {
Map<UUID, SpellAbility> useable = PlayerImpl.getCastableSpellAbilities(game, this.getId(), card, game.getState().getZone(card.getId()), noMana); Map<UUID, SpellAbility> useable = PlayerImpl.getCastableSpellAbilities(game, this.getId(), card, game.getState().getZone(card.getId()), noMana);
return (SpellAbility) useable.values().stream().findFirst().orElse(null); return useable.values().stream().findFirst().orElse(null);
} }
@Override @Override

View file

@ -234,11 +234,11 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player {
SearchEffect effect = getSearchEffect((StackAbility) ability); SearchEffect effect = getSearchEffect((StackAbility) ability);
if (effect != null && ability.getControllerId().equals(playerId)) { if (effect != null && ability.getControllerId().equals(playerId)) {
Target target = effect.getTarget(); Target target = effect.getTarget();
if (!target.doneChosing()) { if (!target.doneChoosing()) {
for (UUID targetId: target.possibleTargets(ability.getControllerId(), ability.getStackAbility(), game)) { for (UUID targetId: target.possibleTargets(ability.getControllerId(), ability.getStackAbility(), game)) {
Game sim = game.copy(); Game sim = game.copy();
StackAbility newAbility = (StackAbility) ability.copy(); StackAbility newAbility = (StackAbility) ability.copy();
SearchEffect newEffect = getSearchEffect((StackAbility) newAbility); SearchEffect newEffect = getSearchEffect(newAbility);
newEffect.getTarget().addTarget(targetId, newAbility, sim); newEffect.getTarget().addTarget(targetId, newAbility, sim);
sim.getStack().push(newAbility); sim.getStack().push(newAbility);
SimulationNode newNode = new SimulationNode(node, sim, ability.getControllerId()); SimulationNode newNode = new SimulationNode(node, sim, ability.getControllerId());
@ -465,10 +465,10 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player {
public boolean chooseTarget(Outcome outcome, Cards cards, TargetCard target, Ability source, Game game) { public boolean chooseTarget(Outcome outcome, Cards cards, TargetCard target, Ability source, Game game) {
if (targets.isEmpty()) if (targets.isEmpty())
return super.chooseTarget(outcome, cards, target, source, game); return super.chooseTarget(outcome, cards, target, source, game);
if (!target.doneChosing()) { if (!target.doneChoosing()) {
for (UUID targetId: targets) { for (UUID targetId: targets) {
target.addTarget(targetId, source, game); target.addTarget(targetId, source, game);
if (target.doneChosing()) { if (target.doneChoosing()) {
targets.clear(); targets.clear();
return true; return true;
} }
@ -482,10 +482,10 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player {
public boolean choose(Outcome outcome, Cards cards, TargetCard target, Game game) { public boolean choose(Outcome outcome, Cards cards, TargetCard target, Game game) {
if (targets.isEmpty()) if (targets.isEmpty())
return super.choose(outcome, cards, target, game); return super.choose(outcome, cards, target, game);
if (!target.doneChosing()) { if (!target.doneChoosing()) {
for (UUID targetId: targets) { for (UUID targetId: targets) {
target.add(targetId, game); target.add(targetId, game);
if (target.doneChosing()) { if (target.doneChoosing()) {
targets.clear(); targets.clear();
return true; return true;
} }
@ -717,7 +717,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player {
protected String indent(int num) { protected String indent(int num) {
char[] fill = new char[num]; char[] fill = new char[num];
Arrays.fill(fill, ' '); Arrays.fill(fill, ' ');
return Integer.toString(num) + new String(fill); return num + new String(fill);
} }
} }

View file

@ -556,7 +556,7 @@ public class HumanPlayer extends PlayerImpl {
if (target instanceof TargetPermanent) { if (target instanceof TargetPermanent) {
if (((TargetPermanent) target).canTarget(abilityControllerId, responseId, source, game, false)) { if (((TargetPermanent) target).canTarget(abilityControllerId, responseId, source, game, false)) {
target.add(responseId, game); target.add(responseId, game);
if (target.doneChosing()) { if (target.doneChoosing()) {
return true; return true;
} }
} }
@ -568,7 +568,7 @@ public class HumanPlayer extends PlayerImpl {
target.remove(responseId); target.remove(responseId);
} else { } else {
target.addTarget(responseId, (Ability) object, game); target.addTarget(responseId, (Ability) object, game);
if (target.doneChosing()) { if (target.doneChoosing()) {
return true; return true;
} }
} }
@ -578,7 +578,7 @@ public class HumanPlayer extends PlayerImpl {
target.remove(responseId); target.remove(responseId);
} else { } else {
target.addTarget(responseId, null, game); target.addTarget(responseId, null, game);
if (target.doneChosing()) { if (target.doneChoosing()) {
return true; return true;
} }
} }
@ -646,7 +646,7 @@ public class HumanPlayer extends PlayerImpl {
if (possibleTargets.contains(responseId)) { if (possibleTargets.contains(responseId)) {
if (target.canTarget(abilityControllerId, responseId, source, game)) { if (target.canTarget(abilityControllerId, responseId, source, game)) {
target.addTarget(responseId, source, game); target.addTarget(responseId, source, game);
if (target.doneChosing()) { if (target.doneChoosing()) {
return true; return true;
} }
} }
@ -733,7 +733,7 @@ public class HumanPlayer extends PlayerImpl {
} else { } else {
if (target.canTarget(abilityControllerId, responseId, null, cards, game)) { if (target.canTarget(abilityControllerId, responseId, null, cards, game)) {
target.add(responseId, game); target.add(responseId, game);
if (target.doneChosing()) { if (target.doneChoosing()) {
return true; return true;
} }
} }
@ -807,7 +807,7 @@ public class HumanPlayer extends PlayerImpl {
target.remove(responseId); target.remove(responseId);
} else if (target.canTarget(abilityControllerId, responseId, source, cards, game)) { } else if (target.canTarget(abilityControllerId, responseId, source, cards, game)) {
target.addTarget(responseId, source, game); target.addTarget(responseId, source, game);
if (target.doneChosing()) { if (target.doneChoosing()) {
return true; return true;
} }
} }

View file

@ -19,7 +19,7 @@ public interface Target extends Serializable {
boolean isChosen(); boolean isChosen();
boolean doneChosing(); boolean doneChoosing();
void clearChosen(); void clearChosen();

View file

@ -45,11 +45,11 @@ public abstract class TargetAmount extends TargetImpl {
@Override @Override
public boolean isChosen() { public boolean isChosen() {
return doneChosing(); return doneChoosing();
} }
@Override @Override
public boolean doneChosing() { public boolean doneChoosing() {
return amountWasSet return amountWasSet
&& (remainingAmount == 0 && (remainingAmount == 0
|| (getMinNumberOfTargets() < getMaxNumberOfTargets() || (getMinNumberOfTargets() < getMaxNumberOfTargets()

View file

@ -9,12 +9,12 @@ import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.TargetEvent; import mage.game.events.TargetEvent;
import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.util.CardUtil; import mage.util.CardUtil;
import mage.util.RandomUtil; import mage.util.RandomUtil;
import java.util.*; import java.util.*;
import mage.game.permanent.Permanent;
/** /**
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
@ -175,7 +175,7 @@ public abstract class TargetImpl implements Target {
} }
@Override @Override
public boolean doneChosing() { public boolean doneChoosing() {
return getMaxNumberOfTargets() != 0 && targets.size() == getMaxNumberOfTargets(); return getMaxNumberOfTargets() != 0 && targets.size() == getMaxNumberOfTargets();
} }
@ -284,7 +284,7 @@ public abstract class TargetImpl implements Target {
return chosen; return chosen;
} }
chosen = targets.size() >= getNumberOfTargets(); chosen = targets.size() >= getNumberOfTargets();
} while (!isChosen() && !doneChosing()); } while (!isChosen() && !doneChoosing());
return chosen; return chosen;
} }
@ -321,7 +321,7 @@ public abstract class TargetImpl implements Target {
return chosen; return chosen;
} }
chosen = targets.size() >= getNumberOfTargets(); chosen = targets.size() >= getNumberOfTargets();
} while (!isChosen() && !doneChosing()); } while (!isChosen() && !doneChoosing());
return chosen; return chosen;
} }

View file

@ -85,7 +85,7 @@ public class TargetCardInLibrary extends TargetCard {
return chosen; return chosen;
} }
chosen = targets.size() >= getMinNumberOfTargets(); chosen = targets.size() >= getMinNumberOfTargets();
} while (!isChosen() && !doneChosing()); } while (!isChosen() && !doneChoosing());
return chosen; return chosen;
} }