mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
ChooseCardEffect "EachDifferentPower"
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package forge.game.ability.effects;
|
package forge.game.ability.effects;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -137,6 +139,26 @@ public class ChooseCardEffect extends SpellAbilityEffect {
|
|||||||
chosenPool.add(choice);
|
chosenPool.add(choice);
|
||||||
}
|
}
|
||||||
chosen.addAll(chosenPool);
|
chosen.addAll(chosenPool);
|
||||||
|
} else if (sa.hasParam("EachDifferentPower")) {
|
||||||
|
List<Integer> powers = new ArrayList<>();
|
||||||
|
CardCollection chosenPool = new CardCollection();
|
||||||
|
for (Card c : choices) {
|
||||||
|
int pow = c.getNetPower();
|
||||||
|
if (!powers.contains(pow)) {
|
||||||
|
powers.add(c.getNetPower());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Collections.sort(powers);
|
||||||
|
String re = sa.getParam("Choices");
|
||||||
|
re = re + (re.contains(".") ? "+powerEQ" : ".powerEQ");
|
||||||
|
for (int i : powers) {
|
||||||
|
String restrict = re + i;
|
||||||
|
CardCollection valids = CardLists.getValidCards(choices, restrict, activator, host, sa);
|
||||||
|
Card choice = p.getController().chooseSingleEntityForEffect(valids, sa,
|
||||||
|
Localizer.getInstance().getMessage("lblChooseCreatureWithXPower", i), false, null);
|
||||||
|
chosenPool.add(choice);
|
||||||
|
}
|
||||||
|
chosen.addAll(chosenPool);
|
||||||
} else if ((tgt == null) || p.canBeTargetedBy(sa)) {
|
} else if ((tgt == null) || p.canBeTargetedBy(sa)) {
|
||||||
if (sa.hasParam("AtRandom") && !choices.isEmpty()) {
|
if (sa.hasParam("AtRandom") && !choices.isEmpty()) {
|
||||||
Aggregates.random(choices, validAmount, chosen);
|
Aggregates.random(choices, validAmount, chosen);
|
||||||
|
|||||||
Reference in New Issue
Block a user