Fix message for choose target dialog for distributing +1/+1 counters (#9202)

This commit is contained in:
Alex Vasile 2022-07-08 21:42:42 -04:00 committed by GitHub
parent 69f9331d87
commit 5e7f145e3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View file

@ -832,6 +832,10 @@ public class HumanPlayer extends PlayerImpl {
return true; return true;
} }
if (source == null) {
return false;
}
UUID abilityControllerId = playerId; UUID abilityControllerId = playerId;
if (target.getAbilityController() != null) { if (target.getAbilityController() != null) {
abilityControllerId = target.getAbilityController(); abilityControllerId = target.getAbilityController();
@ -876,8 +880,7 @@ public class HumanPlayer extends PlayerImpl {
prepareForResponse(game); prepareForResponse(game);
if (!isExecutingMacro()) { if (!isExecutingMacro()) {
// target amount uses for damage only, if you see another use case then message must be changed here and on getMultiAmount call // target amount uses for damage only, if you see another use case then message must be changed here and on getMultiAmount call
String message = String.format("Select targets to distribute %d damage (selected %d)", amountTotal, target.getTargets().size()); game.fireSelectTargetEvent(playerId, new MessageToClient(target.getMessage(), getRelatedObjectName(source, game)), possibleTargets, required, options);
game.fireSelectTargetEvent(playerId, new MessageToClient(message, getRelatedObjectName(source, game)), possibleTargets, required, options);
} }
waitForResponse(game); waitForResponse(game);
@ -923,8 +926,9 @@ public class HumanPlayer extends PlayerImpl {
} }
} }
MultiAmountType multiAmountType = source.toString().contains("counters") ? MultiAmountType.P1P1 : MultiAmountType.DAMAGE;
// ask and assign new amount // ask and assign new amount
List<Integer> targetValues = getMultiAmount(outcome, targetNames, 1, amountTotal, MultiAmountType.DAMAGE, game); List<Integer> targetValues = getMultiAmount(outcome, targetNames, 1, amountTotal, multiAmountType, game);
for (int i = 0; i < targetValues.size(); i++) { for (int i = 0; i < targetValues.size(); i++) {
int newAmount = targetValues.get(i); int newAmount = targetValues.get(i);
UUID targetId = targets.get(i); UUID targetId = targets.get(i);

View file

@ -12,7 +12,8 @@ import java.util.stream.IntStream;
public enum MultiAmountType { public enum MultiAmountType {
MANA("Add mana", "Distribute mana among colors"), MANA("Add mana", "Distribute mana among colors"),
DAMAGE("Assign damage", "Assign damage among targets"); DAMAGE("Assign damage", "Assign damage among targets"),
P1P1("Add +1/+1 counters", "Distribute +1/+1 counters among creatures");
private final String title; private final String title;
private final String header; private final String header;