- Some comment cleanup in PlayerControllerHuman.

This commit is contained in:
Agetian
2017-06-21 04:46:22 +00:00
parent e29ec6fb83
commit d573f60acc

View File

@@ -1409,12 +1409,9 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
} }
final String firstStr = first.toString(); final String firstStr = first.toString();
for (int i = 1; i < possibleReplacers.size(); i++) { for (int i = 1; i < possibleReplacers.size(); i++) {
// prompt user if there are multiple different options
if (!possibleReplacers.get(i).toString().equals(firstStr)) { if (!possibleReplacers.get(i).toString().equals(firstStr)) {
return getGui().one(prompt, possibleReplacers); // prompt user return getGui().one(prompt, possibleReplacers);
// if there are
// multiple
// different
// options
} }
} }
return first; // return first option without prompting if all options return first; // return first option without prompting if all options
@@ -1444,12 +1441,8 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
final String firstStr = activePlayerSAs.get(0).toString(); final String firstStr = activePlayerSAs.get(0).toString();
boolean needPrompt = false; boolean needPrompt = false;
Integer idxAdditionalInfo = firstStr.indexOf(" ["); // for the // for the purpose of pre-ordering, no need for extra granularity
// purpose of Integer idxAdditionalInfo = firstStr.indexOf(" [");
// pre-ordering,
// no need for
// extra
// granularity.
String saLookupKey = idxAdditionalInfo != -1 ? firstStr.substring(0, idxAdditionalInfo - 1) : firstStr; String saLookupKey = idxAdditionalInfo != -1 ? firstStr.substring(0, idxAdditionalInfo - 1) : firstStr;
char delim = (char) 5; char delim = (char) 5;
@@ -1627,17 +1620,8 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
while (true) { while (true) {
final ICardFace cardFace = chooseSingleCardFace(sa, message, cpp, sa.getHostCard().getName()); final ICardFace cardFace = chooseSingleCardFace(sa, message, cpp, sa.getHostCard().getName());
final PaperCard cp = FModel.getMagicDb().getCommonCards().getCard(cardFace.getName()); final PaperCard cp = FModel.getMagicDb().getCommonCards().getCard(cardFace.getName());
final Card instanceForPlayer = Card.fromPaperCard(cp, player); // the // the Card instance for test needs a game to be tested
// Card final Card instanceForPlayer = Card.fromPaperCard(cp, player);
// instance
// for
// test
// needs
// a
// game
// to
// be
// tested
if (instanceForPlayer.isValid(valid, sa.getHostCard().getController(), sa.getHostCard(), sa)) { if (instanceForPlayer.isValid(valid, sa.getHostCard().getController(), sa.getHostCard(), sa)) {
return cp.getName(); return cp.getName();
} }
@@ -1684,8 +1668,8 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
if (game.getStack().undo()) { if (game.getStack().undo()) {
final Input currentInput = inputQueue.getInput(); final Input currentInput = inputQueue.getInput();
if (currentInput instanceof InputPassPriority) { if (currentInput instanceof InputPassPriority) {
currentInput.showMessageInitial(); // ensure prompt updated if // ensure prompt updated if needed
// needed currentInput.showMessageInitial();
} }
return true; return true;
} }
@@ -2212,18 +2196,11 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
final Card forgeCard = Card.fromPaperCard(c, p); final Card forgeCard = Card.fromPaperCard(c, p);
if (c.getRules().getType().isLand()) { if (c.getRules().getType().isLand()) {
game.getAction().moveToHand(forgeCard, null); // this is // this is needed to ensure land abilities fire
// needed game.getAction().moveToHand(forgeCard, null);
// to
// ensure
// land
// abilities
// fire
game.getAction().moveToPlay(forgeCard, null); game.getAction().moveToPlay(forgeCard, null);
game.getTriggerHandler().runWaitingTriggers(); // ensure // ensure triggered abilities fire
// triggered game.getTriggerHandler().runWaitingTriggers();
// abilities
// fire
} else { } else {
final FCollectionView<SpellAbility> choices = forgeCard.getBasicSpells(); final FCollectionView<SpellAbility> choices = forgeCard.getBasicSpells();
if (choices.isEmpty()) { if (choices.isEmpty()) {
@@ -2240,23 +2217,15 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
return; // happens if cancelled return; // happens if cancelled
} }
game.getAction().moveToHand(forgeCard, null); // this is // this is really needed (for rollbacks at least)
// really game.getAction().moveToHand(forgeCard, null);
// needed
// (for
// rollbacks
// at
// least)
// Human player is choosing targets for an ability // Human player is choosing targets for an ability
// controlled by chosen player. // controlled by chosen player.
sa.setActivatingPlayer(p); sa.setActivatingPlayer(p);
HumanPlay.playSaWithoutPayingManaCost(PlayerControllerHuman.this, game, sa, true); HumanPlay.playSaWithoutPayingManaCost(PlayerControllerHuman.this, game, sa, true);
} }
game.getStack().addAllTriggeredAbilitiesToStack(); // playSa // playSa could fire some triggers
// could game.getStack().addAllTriggeredAbilitiesToStack();
// fire
// some
// triggers
} }
}); });
} }