forked from External/mage
[LTR] Add Goldberry, River-Daughter (#10524)
* Added Goldberry * Slight optimizaztion * Happy Path Test * More unhappy tests * Sanity check for Goldberry's counter choices * Updated player.getMultiAmount to support individual constraints * Some cleanup Also modified ResourcefulDefense to use new multi amount api * Updated logging * Added hint for number of counters * Fixed issue with Resourceful Defense * Improvements to defaults Default list will properly make sure to stay within individual maximums If a player is asked for a choice that isn't actually a choice because each choice's min and max are equal, instead the default response is immediately returned. This helps with situations like moving a counter off of Goldberry when she only has one counter on her. * -1/-1 Counter test * Fixed issue with -1/-1 counters * Adjusted dialog to properly enforce constraints
This commit is contained in:
parent
fe1efef25b
commit
a36a7d9b7f
23 changed files with 678 additions and 180 deletions
|
|
@ -38,9 +38,11 @@ import mage.target.TargetAmount;
|
|||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.util.Copyable;
|
||||
import mage.util.MultiAmountMessage;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -746,7 +748,27 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
* @param game Game
|
||||
* @return List of integers with size equal to messages.size(). The sum of the integers is equal to max.
|
||||
*/
|
||||
List<Integer> getMultiAmount(Outcome outcome, List<String> messages, int min, int max, MultiAmountType type, Game game);
|
||||
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());
|
||||
|
||||
return getMultiAmountWithIndividualConstraints(outcome, constraints, min, max, type, game);
|
||||
}
|
||||
|
||||
/**
|
||||
* Player distributes amount among multiple options
|
||||
*
|
||||
* @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 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.
|
||||
*/
|
||||
List<Integer> getMultiAmountWithIndividualConstraints(Outcome outcome, List<MultiAmountMessage> messages, int min,
|
||||
int max, MultiAmountType type, Game game);
|
||||
|
||||
void sideboard(Match match, Deck deck);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue