Merge branch 'master' into 'master'

fix divided allocation

See merge request core-developers/forge!4605
This commit is contained in:
Anthony Calosa
2021-04-26 20:01:36 +00:00

View File

@@ -866,17 +866,16 @@ public class CountersPutAi extends SpellAbilityAi {
choice = Aggregates.random(list);
}
}
if (choice != null && divided) {
int alloc = Math.max(amount / totalTargets, 1);
if (sa.getTargets().size() == Math.min(totalTargets, sa.getMaxTargets()) - 1) {
sa.addDividedAllocation(choice, left);
} else {
sa.addDividedAllocation(choice, alloc);
left -= alloc;
}
}
if (choice != null && divided) {
int alloc = Math.max(amount / totalTargets, 1);
if (sa.getTargets().size() == Math.min(totalTargets, sa.getMaxTargets()) - 1) {
sa.addDividedAllocation(choice, left);
} else {
sa.addDividedAllocation(choice, alloc);
left -= alloc;
}
}
if (choice != null) {
sa.getTargets().add(choice);
list.remove(choice);