mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Fix division by zero error in PossibleTargetSelector.
This commit is contained in:
@@ -40,10 +40,11 @@ public class PossibleTargetSelector {
|
||||
// Divide up counters, since AI is expected to do this. For now,
|
||||
// divided evenly with left-overs going to the first target.
|
||||
if (sa.hasParam("DividedAsYouChoose")) {
|
||||
final int targetCount = sa.getTargets().getTargetCards().size();
|
||||
if (targetCount > 0) {
|
||||
final String amountStr = sa.getParam("CounterNum");
|
||||
final int amount = AbilityUtils.calculateAmount(sa.getHostCard(), amountStr, sa);
|
||||
final int targetCount = sa.getTargets().getTargetCards().size();
|
||||
final int amountPerCard = amount / sa.getTargets().getTargetCards().size();
|
||||
final int amountPerCard = amount / targetCount;
|
||||
int amountLeftOver = amount - (amountPerCard * targetCount);
|
||||
final TargetRestrictions tgtRes = sa.getTargetRestrictions();
|
||||
for (GameObject target : sa.getTargets().getTargets()) {
|
||||
@@ -51,6 +52,7 @@ public class PossibleTargetSelector {
|
||||
amountLeftOver = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: smarter about multiple targets, identical targets, etc...
|
||||
targetIndex++;
|
||||
|
||||
Reference in New Issue
Block a user