Improvements to player selection of TargetAmount (#11341)

This commit is contained in:
xenohedron 2023-10-26 02:12:15 -04:00 committed by GitHub
parent bd298d6179
commit 18c6596cc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 44 additions and 14 deletions

View file

@ -132,7 +132,7 @@ public class AddManaInAnyCombinationEffect extends ManaEffect {
// Ask player for color distribution
int manaAmount = amount.calculate(game, source, this);
List<Integer> manaList = player.getMultiAmount(this.outcome, manaStrings, manaAmount, manaAmount, MultiAmountType.MANA, game);
List<Integer> manaList = player.getMultiAmount(this.outcome, manaStrings, 0, manaAmount, MultiAmountType.MANA, game);
// Convert choices to mana
for (int i = 0; i < size; i++) {

View file

@ -159,7 +159,7 @@ public class DynamicManaEffect extends ManaEffect {
manaStrings.add("B");
manaStrings.add("R");
manaStrings.add("G");
List<Integer> choices = controller.getMultiAmount(this.outcome, manaStrings, count, count, MultiAmountType.MANA, game);
List<Integer> choices = controller.getMultiAmount(this.outcome, manaStrings, 0, count, MultiAmountType.MANA, game);
computedMana.add(new Mana(choices.get(0), choices.get(1), choices.get(2), choices.get(3), choices.get(4), 0, 0, 0));
}
}

View file

@ -758,8 +758,9 @@ public interface Player extends MageItem, Copyable<Player> {
* @return List of integers with size equal to messages.size(). The sum of the integers is equal to max.
*/
default List<Integer> getMultiAmount(Outcome outcome, List<String> messages, int min, int max, MultiAmountType type, Game game) {
List<MultiAmountMessage> constraints = messages.stream().map(s -> new MultiAmountMessage(s, 0, max)).collect(Collectors.toList());
List<MultiAmountMessage> constraints = messages.stream()
.map(s -> new MultiAmountMessage(s, min, max))
.collect(Collectors.toList());
return getMultiAmountWithIndividualConstraints(outcome, constraints, min, max, type, game);
}
@ -768,8 +769,8 @@ public interface Player extends MageItem, Copyable<Player> {
*
* @param outcome AI hint
* @param messages List of options to distribute amount among. Each option has a constraint on the min, max chosen for it
* @param totalMin Total minimum amount to be distributed
* @param totalMax Total amount to be distributed
* @param min Total minimum amount to be distributed
* @param max Total amount to be distributed
* @param type MultiAmountType enum to set dialog options such as title and header
* @param game Game
* @return List of integers with size equal to messages.size(). The sum of the integers is equal to max.