mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 17:58:01 +00:00
Fix assignGenericAmount dialog when no targets (Lathiel)
This commit is contained in:
@@ -36,8 +36,7 @@ public class ChooseNumberEffect extends SpellAbilityEffect {
|
||||
@Override
|
||||
public void resolve(SpellAbility sa) {
|
||||
final Card card = sa.getHostCard();
|
||||
//final int min = sa.containsKey("Min") ? Integer.parseInt(sa.get("Min")) : 0;
|
||||
//final int max = sa.containsKey("Max") ? Integer.parseInt(sa.get("Max")) : 99;
|
||||
|
||||
final boolean random = sa.hasParam("Random");
|
||||
final boolean anyNumber = sa.hasParam("ChooseAnyNumber");
|
||||
final boolean secretlyChoose = sa.hasParam("SecretlyChoose");
|
||||
|
||||
@@ -278,7 +278,7 @@ public class CountersPutEffect extends SpellAbilityEffect {
|
||||
params.put("Target", obj);
|
||||
params.put("CounterType", counterType);
|
||||
divrem++;
|
||||
if ((divrem == tgtObjects.size()) || (counterRemain == 1)) { counterAmount = counterRemain; }
|
||||
if (divrem == tgtObjects.size() || counterRemain == 1) { counterAmount = counterRemain; }
|
||||
else {
|
||||
counterAmount = pc.chooseNumber(sa, Localizer.getInstance().getMessage
|
||||
("lblHowManyCountersThis", CardTranslation.getTranslatedName(gameCard.getName())),
|
||||
|
||||
@@ -92,7 +92,6 @@ public class DamageEachEffect extends DamageBaseEffect {
|
||||
// TODO shouldn't that be using Num or something first?
|
||||
final int dmg = AbilityUtils.calculateAmount(source, "X", sa);
|
||||
|
||||
// System.out.println(source+" deals "+dmg+" damage to "+o.toString());
|
||||
if (o instanceof Card) {
|
||||
final Card c = (Card) o;
|
||||
if (c.isInPlay() && (!targeted || c.canBeTargetedBy(sa))) {
|
||||
|
||||
@@ -24,4 +24,3 @@ public class GameDrawEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ public class LifeLoseEffect extends SpellAbilityEffect {
|
||||
*/
|
||||
@Override
|
||||
public void resolve(SpellAbility sa) {
|
||||
|
||||
int lifeLost = 0;
|
||||
|
||||
final int lifeAmount = AbilityUtils.calculateAmount(sa.getHostCard(), sa.getParam("LifeAmount"), sa);
|
||||
|
||||
@@ -67,4 +67,3 @@ import forge.util.Lang;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -17,10 +17,6 @@ import forge.util.Localizer;
|
||||
|
||||
public class TwoPilesEffect extends SpellAbilityEffect {
|
||||
|
||||
// *************************************************************************
|
||||
// ***************************** TwoPiles **********************************
|
||||
// *************************************************************************
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.abilityfactory.SpellEffect#getStackDescription(java.util.Map, forge.card.spellability.SpellAbility)
|
||||
*/
|
||||
@@ -106,10 +102,6 @@ public class TwoPilesEffect extends SpellAbilityEffect {
|
||||
final CardCollection pile2 = new CardCollection(pool);
|
||||
pile2.removeAll(pile1);
|
||||
|
||||
//System.out.println("Pile 1:" + pile1);
|
||||
//System.out.println("Pile 2:" + pile2);
|
||||
|
||||
|
||||
if (isLeftRightPile) {
|
||||
pile1WasChosen = true;
|
||||
} else {
|
||||
|
||||
@@ -42,7 +42,7 @@ public class VentureEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
|
||||
// Create a new dugeon card chosen by player in command zone.
|
||||
// Create a new dungeon card chosen by player in command zone.
|
||||
List<PaperCard> dungeonCards = StaticData.instance().getVariantCards().getAllCards(
|
||||
Predicates.compose(CardRulesPredicates.Presets.IS_DUNGEON, PaperCard.FN_GET_RULES));
|
||||
List<ICardFace> faces = new ArrayList<>();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
// assign divided as you choose values
|
||||
if (result && currentAbility.isDividedAsYouChoose() && currentAbility.getStillToDivide() > 0) {
|
||||
int amount = currentAbility.getStillToDivide();
|
||||
final List<GameEntity> targets = currentAbility.getTargets().getTargetEntities();
|
||||
int amount = currentAbility.getStillToDivide();
|
||||
|
||||
// assign divided as you choose values
|
||||
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