mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
a couple tweaks to AF_PutCounter:
1. add UpTo param for "add up to X counters to" a card 2. add MaxFromEffect param to specify the maximum amount of these counters the card can have from this effect
This commit is contained in:
@@ -150,8 +150,11 @@ public class AbilityFactory_Counters {
|
|||||||
Card card = af.getHostCard();
|
Card card = af.getHostCard();
|
||||||
int amount = AbilityFactory.calculateAmount(af.getHostCard(), params.get("CounterNum"), sa);
|
int amount = AbilityFactory.calculateAmount(af.getHostCard(), params.get("CounterNum"), sa);
|
||||||
|
|
||||||
sb.append("Put ").append(amount).append(" ").append(cType.getName())
|
sb.append("Put ");
|
||||||
.append(" counter");
|
if (params.containsKey("UpTo")) {
|
||||||
|
sb.append("up to ");
|
||||||
|
}
|
||||||
|
sb.append(amount).append(" ").append(cType.getName()).append(" counter");
|
||||||
if (amount != 1) { sb.append("s"); }
|
if (amount != 1) { sb.append("s"); }
|
||||||
sb.append(" on ");
|
sb.append(" on ");
|
||||||
|
|
||||||
@@ -577,6 +580,20 @@ public class AbilityFactory_Counters {
|
|||||||
Card card = af.getHostCard();
|
Card card = af.getHostCard();
|
||||||
String type = params.get("CounterType");
|
String type = params.get("CounterType");
|
||||||
int counterAmount = AbilityFactory.calculateAmount(af.getHostCard(), params.get("CounterNum"), sa);
|
int counterAmount = AbilityFactory.calculateAmount(af.getHostCard(), params.get("CounterNum"), sa);
|
||||||
|
int max = params.containsKey("MaxFromEffect") ? Integer.parseInt(params.get("MaxFromEffect")) : -1;
|
||||||
|
|
||||||
|
if (params.containsKey("UpTo")) {
|
||||||
|
Integer[] integers = new Integer[counterAmount+1];
|
||||||
|
for (int j = 0; j <= counterAmount; j++) {
|
||||||
|
integers[j] = Integer.valueOf(j);
|
||||||
|
}
|
||||||
|
Integer i = GuiUtils.getChoiceOptional("How many counters?", integers);
|
||||||
|
if (null == i) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
counterAmount = i.intValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ArrayList<Card> tgtCards;
|
ArrayList<Card> tgtCards;
|
||||||
|
|
||||||
@@ -590,6 +607,9 @@ public class AbilityFactory_Counters {
|
|||||||
|
|
||||||
for (Card tgtCard : tgtCards) {
|
for (Card tgtCard : tgtCards) {
|
||||||
if (tgt == null || CardFactoryUtil.canTarget(card, tgtCard)) {
|
if (tgt == null || CardFactoryUtil.canTarget(card, tgtCard)) {
|
||||||
|
if (max != -1) {
|
||||||
|
counterAmount = max - tgtCard.getCounters(Counters.valueOf(type));
|
||||||
|
}
|
||||||
PlayerZone zone = AllZone.getZoneOf(tgtCard);
|
PlayerZone zone = AllZone.getZoneOf(tgtCard);
|
||||||
if (zone == null){
|
if (zone == null){
|
||||||
// Do nothing, token disappeared
|
// Do nothing, token disappeared
|
||||||
|
|||||||
Reference in New Issue
Block a user