From 2644a24bc7aec01bb48140ca48a6d304ae181f8c Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 22:56:24 +0000 Subject: [PATCH] fix the stack description when AF:RemoveCounter targets a card that is not Self. Added an UpTo parameter that when set prompts the user for a number of "up to" NumCounters to be removed. --- .../AbilityFactory_Counters.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/forge/card/abilityFactory/AbilityFactory_Counters.java b/src/forge/card/abilityFactory/AbilityFactory_Counters.java index 9763affd823..c4ac4b674fe 100644 --- a/src/forge/card/abilityFactory/AbilityFactory_Counters.java +++ b/src/forge/card/abilityFactory/AbilityFactory_Counters.java @@ -617,13 +617,22 @@ public class AbilityFactory_Counters { Counters cType = Counters.valueOf(params.get("CounterType")); int amount = AbilityFactory.calculateAmount(af.getHostCard(), af.getMapParams().get("CounterNum"), sa); - sb.append("Remove ").append(amount).append(" ").append(cType.getName()) + sb.append("Remove "); + if(params.containsKey("UpTo")) sb.append("up to "); + sb.append(amount).append(" ").append(cType.getName()) .append(" counter"); if(amount != 1) sb.append("s"); sb.append(" from"); - ArrayList tgts = AbilityFactory.getDefinedCards(card, params.get("Defined"), sa); - for (Card c : tgts) + ArrayList tgtCards; + + Target tgt = af.getAbTgt(); + if (tgt != null) + tgtCards = tgt.getTargetCards(); + else{ + tgtCards = AbilityFactory.getDefinedCards(card, params.get("Defined"), sa); + } + for (Card c : tgtCards) sb.append(" ").append(c); sb.append("."); @@ -764,6 +773,12 @@ public class AbilityFactory_Counters { PlayerZone zone = AllZone.getZone(tgtCard); if (zone.is(Constant.Zone.Battlefield) || zone.is(Constant.Zone.Exile)) + if(params.containsKey("UpTo") && sa.getActivatingPlayer().isHuman()) { + ArrayList choices = new ArrayList(); + for(int i = 0; i <= counterAmount; i++) choices.add(""+i); + Object o = GuiUtils.getChoice("Select the number of "+type+" counters to remove", choices.toArray()); + counterAmount = Integer.parseInt((String)o); + } tgtCard.subtractCounter(Counters.valueOf(type), counterAmount); }