mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
[READY FOR REVIEW] Implement a "multi-amount" dialog (#7528)
* Implemented chooseTargetAmount and new GUI dialog (distribute damage, distribute mana) * Added tests and AI support; * Test framework: added aliases support in TargetAmount dialogs; Co-authored-by: Oleg Agafonov <jaydi85@gmail.com>
This commit is contained in:
parent
042aa61ad4
commit
600cac6fc7
35 changed files with 1209 additions and 232 deletions
|
|
@ -2028,6 +2028,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
// TODO: add AI support with outcome and replace random with min/max
|
||||
public int getAmount(int min, int max, String message, Game game) {
|
||||
log.debug("getAmount");
|
||||
if (message.startsWith("Assign damage to ")) {
|
||||
|
|
@ -2039,6 +2040,29 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
return min;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> getMultiAmount(Outcome outcome, List<String> messages, int min, int max, MultiAmountType type, Game game) {
|
||||
log.debug("getMultiAmount");
|
||||
|
||||
int needCount = messages.size();
|
||||
List<Integer> defaultList = MultiAmountType.prepareDefaltValues(needCount, min, max);
|
||||
if (needCount == 0) {
|
||||
return defaultList;
|
||||
}
|
||||
|
||||
// BAD effect
|
||||
// default list uses minimum possible values, so return it on bad effect
|
||||
// TODO: need something for damage target and mana logic here, current version is useless but better than random
|
||||
if (!outcome.isGood()) {
|
||||
return defaultList;
|
||||
}
|
||||
|
||||
// GOOD effect
|
||||
// values must be stable, so AI must able to simulate it and choose correct actions
|
||||
// fill max values as much as possible
|
||||
return MultiAmountType.prepareMaxValues(needCount, min, max);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID chooseAttackerOrder(List<Permanent> attackers, Game game) {
|
||||
//TODO: improve this
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue