mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
ChooseCardEffect "WithDifferentPowers"
This commit is contained in:
@@ -89,7 +89,7 @@ public class ChooseCardEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (sa.hasParam("WithTotalPower")){
|
} else if (sa.hasParam("WithTotalPower")) {
|
||||||
final int totP = AbilityUtils.calculateAmount(host, sa.getParam("WithTotalPower"), sa);
|
final int totP = AbilityUtils.calculateAmount(host, sa.getParam("WithTotalPower"), sa);
|
||||||
CardCollection negativeCreats = CardLists.filterLEPower(p.getCreaturesInPlay(), -1);
|
CardCollection negativeCreats = CardLists.filterLEPower(p.getCreaturesInPlay(), -1);
|
||||||
int negativeNum = Aggregates.sum(negativeCreats, CardPredicates.Accessors.fnGetNetPower);
|
int negativeNum = Aggregates.sum(negativeCreats, CardPredicates.Accessors.fnGetNetPower);
|
||||||
@@ -114,6 +114,29 @@ public class ChooseCardEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
chosen.addAll(chosenPool);
|
chosen.addAll(chosenPool);
|
||||||
|
} else if (sa.hasParam("WithDifferentPowers")) {
|
||||||
|
String restrict = sa.getParam("Choices");
|
||||||
|
CardCollection chosenPool = new CardCollection();
|
||||||
|
String title = Localizer.getInstance().getMessage("lblChooseCreature");
|
||||||
|
Card choice = null;
|
||||||
|
while (!choices.isEmpty() && chosenPool.size() < validAmount) {
|
||||||
|
boolean optional = chosenPool.size() >= minAmount;
|
||||||
|
CardCollection creature = (CardCollection) choices;
|
||||||
|
if (!chosenPool.isEmpty()) {
|
||||||
|
title = Localizer.getInstance().getMessage("lblChooseCreatureWithDiffPower");
|
||||||
|
}
|
||||||
|
choice = p.getController().chooseSingleEntityForEffect(creature, sa, title, optional, null);
|
||||||
|
if (choice == null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
chosenPool.add(choice);
|
||||||
|
restrict = restrict + (restrict.contains(".") ? "+powerNE" : ".powerNE") + choice.getNetPower();
|
||||||
|
choices = CardLists.getValidCards(choices, restrict, activator, host, sa);
|
||||||
|
}
|
||||||
|
if (choice != 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