mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Fix assignGenericAmount dialog when no targets (Lathiel)
This commit is contained in:
@@ -98,15 +98,15 @@ public final class InputSelectTargets extends InputSyncronizedBase {
|
||||
sb.append(sa.getHostCard()).append(" - ").append(tgt.getVTSelection());
|
||||
}
|
||||
if (!targetDepth.entrySet().isEmpty()) {
|
||||
sb.append("\nTargeted: ");
|
||||
sb.append("\nTargeted: ");
|
||||
}
|
||||
for (final Entry<GameEntity, Integer> o : targetDepth.entrySet()) {
|
||||
//if it's not in gdx port landscape mode, append the linebreak
|
||||
if(!ForgeConstants.isGdxPortLandscape)
|
||||
if (!ForgeConstants.isGdxPortLandscape)
|
||||
sb.append("\n");
|
||||
sb.append(o.getKey());
|
||||
//if it's in gdx port landscape mode, instead append the comma with space...
|
||||
if(ForgeConstants.isGdxPortLandscape)
|
||||
if (ForgeConstants.isGdxPortLandscape)
|
||||
sb.append(", ");
|
||||
if (o.getValue() > 1) {
|
||||
sb.append(TextUtil.concatNoSpace(" (", String.valueOf(o.getValue()), " times)"));
|
||||
@@ -128,7 +128,7 @@ public final class InputSelectTargets extends InputSyncronizedBase {
|
||||
"(Targeting ERROR)", "");
|
||||
showMessage(message, sa.getView());
|
||||
|
||||
if ((divisionValues != null && !divisionValues.isEmpty()) && sa.getMinTargets() == 0 && sa.getTargets().size() == 0) {
|
||||
if (divisionValues != null && !divisionValues.isEmpty() && sa.getMinTargets() == 0 && sa.getTargets().size() == 0) {
|
||||
// extra logic for Divided with min targets = 0, should only work if num targets are 0 too
|
||||
getController().getGui().updateButtons(getOwner(), true, true, false);
|
||||
} else if (!sa.isMinTargetChosen() || (divisionValues != null && !divisionValues.isEmpty())){
|
||||
@@ -279,7 +279,7 @@ public final class InputSelectTargets extends InputSyncronizedBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((divisionValues != null && !divisionValues.isEmpty())) {
|
||||
if (divisionValues != null && !divisionValues.isEmpty()) {
|
||||
Boolean val = onDividedAsYouChoose(card);
|
||||
if (val != null) {
|
||||
return val;
|
||||
@@ -321,7 +321,7 @@ public final class InputSelectTargets extends InputSyncronizedBase {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((divisionValues != null && !divisionValues.isEmpty())) {
|
||||
if (divisionValues != null && !divisionValues.isEmpty()) {
|
||||
Boolean val = onDividedAsYouChoose(player);
|
||||
if (val != null) {
|
||||
return;
|
||||
|
||||
@@ -1972,16 +1972,24 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
|
||||
boolean result = select.chooseTargets(null, null, null, false, canFilterMustTarget);
|
||||
|
||||
final List<GameEntity> targets = currentAbility.getTargets().getTargetEntities();
|
||||
int amount = currentAbility.getStillToDivide();
|
||||
|
||||
// assign divided as you choose values
|
||||
if (result && currentAbility.isDividedAsYouChoose() && currentAbility.getStillToDivide() > 0) {
|
||||
int amount = currentAbility.getStillToDivide();
|
||||
final List<GameEntity> targets = currentAbility.getTargets().getTargetEntities();
|
||||
if (result && targets.size() > 0 && amount > 0) {
|
||||
if (currentAbility.hasParam("DividedUpTo")) {
|
||||
amount = chooseNumber(currentAbility, localizer.getMessage("lblHowMany"), targets.size(), amount);
|
||||
}
|
||||
if (targets.size() == 1) {
|
||||
currentAbility.addDividedAllocation(targets.get(0), amount);
|
||||
} else if (targets.size() == amount) {
|
||||
for (GameEntity e : targets) {
|
||||
currentAbility.addDividedAllocation(e, 1);
|
||||
}
|
||||
} else if (amount == 0) {
|
||||
for (GameEntity e : targets) {
|
||||
currentAbility.addDividedAllocation(e, 0);
|
||||
}
|
||||
} else if (targets.size() > amount) {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user