mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Merge branch 'dividedfix' into 'master'
Fix assignGenericAmount dialog when no targets (Lathiel) See merge request core-developers/forge!4967
This commit is contained in:
@@ -4,7 +4,7 @@ Types:Legendary Creature Unicorn
|
||||
PT:2/2
|
||||
K:Lifelink
|
||||
T:Mode$ Phase | Phase$ End of Turn | TriggerZones$ Battlefield | CheckSVar$ X | SVarCompare$ GE1 | Execute$ TrigPutCounter | TriggerDescription$ At the beginning of each end step, if you gained life this turn, distribute up to that many +1/+1 counters among any number of other target creatures.
|
||||
SVar:TrigPutCounter:DB$ PutCounter | ValidTgts$ Creature.Other | TgtPrompt$ Select any number of other target creatures to distribute counters to | CounterType$ P1P1 | TargetMin$ 0 | TargetMax$ X | DividedAsYouChoose$ X
|
||||
SVar:TrigPutCounter:DB$ PutCounter | ValidTgts$ Creature.Other | TgtPrompt$ Select any number of other target creatures to distribute counters to | CounterType$ P1P1 | TargetMin$ 0 | TargetMax$ X | DividedAsYouChoose$ X | DividedUpTo$ True
|
||||
SVar:X:Count$LifeYouGainedThisTurn
|
||||
DeckHints:Ability$LifeGain
|
||||
DeckHas:Ability$Counters & Ability$LifeGain
|
||||
|
||||
@@ -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