From 742be996feee85d0bae701b76e7073e1a8521975 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Tue, 27 Apr 2021 03:54:45 +0800 Subject: [PATCH] fix divided allocation --- .../java/forge/ai/ability/CountersPutAi.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java b/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java index 75c5344095d..c3b3c130950 100644 --- a/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java @@ -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);