mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
CountersPutEffect support "PutOnDefined" and "OnlyNewKind"
This commit is contained in:
@@ -171,6 +171,7 @@ public class CountersPutEffect extends SpellAbilityEffect {
|
|||||||
boolean existingCounter = sa.hasParam("CounterType") && sa.getParam("CounterType").equals("ExistingCounter");
|
boolean existingCounter = sa.hasParam("CounterType") && sa.getParam("CounterType").equals("ExistingCounter");
|
||||||
boolean eachExistingCounter = sa.hasParam("EachExistingCounter");
|
boolean eachExistingCounter = sa.hasParam("EachExistingCounter");
|
||||||
boolean putOnEachOther = sa.hasParam("PutOnEachOther");
|
boolean putOnEachOther = sa.hasParam("PutOnEachOther");
|
||||||
|
boolean putOnDefined = sa.hasParam("PutOnDefined");
|
||||||
|
|
||||||
if (sa.hasParam("Optional") && !pc.confirmAction
|
if (sa.hasParam("Optional") && !pc.confirmAction
|
||||||
(sa, null, Localizer.getInstance().getMessage("lblDoYouWantPutCounter"))) {
|
(sa, null, Localizer.getInstance().getMessage("lblDoYouWantPutCounter"))) {
|
||||||
@@ -189,7 +190,7 @@ public class CountersPutEffect extends SpellAbilityEffect {
|
|||||||
|
|
||||||
Iterables.addAll(tgtObjects, activator.getController().chooseCardsForEffect(leastToughness, sa,
|
Iterables.addAll(tgtObjects, activator.getController().chooseCardsForEffect(leastToughness, sa,
|
||||||
Localizer.getInstance().getMessage("lblChooseACreatureWithLeastToughness"), 1, 1, false, params));
|
Localizer.getInstance().getMessage("lblChooseACreatureWithLeastToughness"), 1, 1, false, params));
|
||||||
} else if (sa.hasParam("Choices") && (counterType != null || putOnEachOther)) {
|
} else if (sa.hasParam("Choices") && (counterType != null || putOnEachOther || putOnDefined)) {
|
||||||
ZoneType choiceZone = ZoneType.Battlefield;
|
ZoneType choiceZone = ZoneType.Battlefield;
|
||||||
if (sa.hasParam("ChoiceZone")) {
|
if (sa.hasParam("ChoiceZone")) {
|
||||||
choiceZone = ZoneType.smartValueOf(sa.getParam("ChoiceZone"));
|
choiceZone = ZoneType.smartValueOf(sa.getParam("ChoiceZone"));
|
||||||
@@ -222,9 +223,11 @@ public class CountersPutEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
if ((sa.hasParam("ChoiceTitle") || sa.hasParam("SpecifyCounter")) && counterType != null) {
|
if ((sa.hasParam("ChoiceTitle") || sa.hasParam("SpecifyCounter")) && counterType != null) {
|
||||||
title += " (" + counterType.getName() + ")";
|
title += " (" + counterType.getName() + ")";
|
||||||
} else if (putOnEachOther) {
|
} else if (putOnEachOther || putOnDefined) {
|
||||||
title += Localizer.getInstance().getMessage("lblWithKindCounter") + " " +
|
title += Localizer.getInstance().getMessage("lblWithKindCounter");
|
||||||
Localizer.getInstance().getMessage("lblEachOther");
|
if (putOnEachOther) {
|
||||||
|
title += " " + Localizer.getInstance().getMessage("lblEachOther");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> params = Maps.newHashMap();
|
Map<String, Object> params = Maps.newHashMap();
|
||||||
@@ -397,6 +400,15 @@ public class CountersPutEffect extends SpellAbilityEffect {
|
|||||||
otherGCard.addCounter(counterType, counterAmount, placer, table);
|
otherGCard.addCounter(counterType, counterAmount, placer, table);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
} else if (putOnDefined) {
|
||||||
|
List<Card> defs = AbilityUtils.getDefinedCards(card, sa.getParam("PutOnDefined"), sa);
|
||||||
|
for (Card c : defs) {
|
||||||
|
Card gCard = game.getCardState(c, null);
|
||||||
|
if (!sa.hasParam("OnlyNewKind") || gCard.getCounters(counterType) < 1) {
|
||||||
|
gCard.addCounter(counterType, counterAmount, placer, table);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -579,7 +591,7 @@ public class CountersPutEffect extends SpellAbilityEffect {
|
|||||||
if (!sa.hasParam("EachExistingCounter") && !sa.hasParam("EachFromSource")
|
if (!sa.hasParam("EachExistingCounter") && !sa.hasParam("EachFromSource")
|
||||||
&& !sa.hasParam("UniqueType") && !sa.hasParam("CounterTypePerDefined")
|
&& !sa.hasParam("UniqueType") && !sa.hasParam("CounterTypePerDefined")
|
||||||
&& !sa.hasParam("CounterTypes") && !sa.hasParam("ChooseDifferent")
|
&& !sa.hasParam("CounterTypes") && !sa.hasParam("ChooseDifferent")
|
||||||
&& !sa.hasParam("PutOnEachOther")) {
|
&& !sa.hasParam("PutOnEachOther") && !sa.hasParam("PutOnDefined")) {
|
||||||
try {
|
try {
|
||||||
counterType = chooseTypeFromList(sa, sa.getParam("CounterType"), null,
|
counterType = chooseTypeFromList(sa, sa.getParam("CounterType"), null,
|
||||||
placer.getController());
|
placer.getController());
|
||||||
|
|||||||
Reference in New Issue
Block a user