refactor: removed outdated Player::assignDamage by multi amount dialog, fixed getMultiAmount to work with min values, added additional checks

This commit is contained in:
Oleg Agafonov 2024-10-24 15:31:04 +04:00
parent 86fc0028c1
commit 2d9ac4e732
12 changed files with 50 additions and 127 deletions

View file

@ -2232,13 +2232,6 @@ public class ComputerPlayer extends PlayerImpl {
return null;
}
@Override
public void assignDamage(int damage, List<UUID> targets, String singleTargetName, UUID attackerId, Ability source, Game game) {
log.debug("assignDamage");
//TODO: improve this
game.getPermanent(targets.get(0)).damage(damage, attackerId, source, game);
}
@Override
// TODO: add AI support with outcome and replace random with min/max
public int getAmount(int min, int max, String message, Game game) {
@ -2254,11 +2247,11 @@ public class ComputerPlayer extends PlayerImpl {
@Override
public List<Integer> getMultiAmountWithIndividualConstraints(Outcome outcome, List<MultiAmountMessage> messages,
int min, int max, MultiAmountType type, Game game) {
int totalMin, int totalMax, MultiAmountType type, Game game) {
log.debug("getMultiAmount");
int needCount = messages.size();
List<Integer> defaultList = MultiAmountType.prepareDefaltValues(messages, min, max);
List<Integer> defaultList = MultiAmountType.prepareDefaltValues(messages, totalMin, totalMax);
if (needCount == 0) {
return defaultList;
}
@ -2273,7 +2266,7 @@ public class ComputerPlayer extends PlayerImpl {
// 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(messages, min, max);
return MultiAmountType.prepareMaxValues(messages, totalMin, totalMax);
}
@Override