mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 09:48:02 +00:00
Fix GenericChoice UI
This commit is contained in:
@@ -183,7 +183,7 @@ public class PlayerControllerAi extends PlayerController {
|
||||
|
||||
@Override
|
||||
public List<SpellAbility> chooseSpellAbilitiesForEffect(List<SpellAbility> spells, SpellAbility sa, String title,
|
||||
int num, Map<String, Object> params) {
|
||||
int num, Map<String, Object> params, boolean generic) {
|
||||
List<SpellAbility> remaining = Lists.newArrayList(spells);
|
||||
List<SpellAbility> selecteds = Lists.newArrayList();
|
||||
SpellAbility selected;
|
||||
|
||||
@@ -68,7 +68,7 @@ public class ChooseGenericEffect extends SpellAbilityEffect {
|
||||
if (sa.hasParam("AtRandom")) {
|
||||
Aggregates.random(abilities, amount, chosenSAs);
|
||||
} else {
|
||||
chosenSAs = p.getController().chooseSpellAbilitiesForEffect(abilities, sa, "Choose", amount, ImmutableMap.of());
|
||||
chosenSAs = p.getController().chooseSpellAbilitiesForEffect(abilities, sa, "Choose", amount, ImmutableMap.of(), true);
|
||||
}
|
||||
|
||||
if (!chosenSAs.isEmpty()) {
|
||||
|
||||
@@ -123,7 +123,7 @@ public abstract class PlayerController {
|
||||
public final <T extends GameEntity> T chooseSingleEntityForEffect(FCollectionView<T> optionList, SpellAbility sa, String title, boolean isOptional, Map<String, Object> params) { return chooseSingleEntityForEffect(optionList, null, sa, title, isOptional, null, params); }
|
||||
public abstract <T extends GameEntity> T chooseSingleEntityForEffect(FCollectionView<T> optionList, DelayedReveal delayedReveal, SpellAbility sa, String title, boolean isOptional, Player relatedPlayer, Map<String, Object> params);
|
||||
|
||||
public abstract List<SpellAbility> chooseSpellAbilitiesForEffect(List<SpellAbility> spells, SpellAbility sa, String title, int num, Map<String, Object> params);
|
||||
public abstract List<SpellAbility> chooseSpellAbilitiesForEffect(List<SpellAbility> spells, SpellAbility sa, String title, int num, Map<String, Object> params, boolean generic);
|
||||
|
||||
public abstract SpellAbility chooseSingleSpellForEffect(List<SpellAbility> spells, SpellAbility sa, String title,
|
||||
Map<String, Object> params);
|
||||
|
||||
@@ -705,7 +705,7 @@ public class PlayerControllerForTests extends PlayerController {
|
||||
|
||||
@Override
|
||||
public List<SpellAbility> chooseSpellAbilitiesForEffect(List<SpellAbility> spells, SpellAbility sa, String title,
|
||||
int num, Map<String, Object> params) {
|
||||
int num, Map<String, Object> params, boolean generic) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -619,12 +619,14 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SpellAbility> chooseSpellAbilitiesForEffect(List<SpellAbility> spells, SpellAbility sa, String title, int num, Map<String, Object> params) {
|
||||
public List<SpellAbility> chooseSpellAbilitiesForEffect(List<SpellAbility> spells, SpellAbility sa, String title, int num, Map<String, Object> params, boolean generic) {
|
||||
List<SpellAbility> result = Lists.newArrayList();
|
||||
// create a mapping between a spell's view and the spell itself
|
||||
Map<SpellAbilityView, SpellAbility> spellViewCache = SpellAbilityView.getMap(spells);
|
||||
|
||||
List<SpellAbilityView> chosen = getGui().many(title, "", num, Lists.newArrayList(spellViewCache.keySet()), sa.getHostCard().getView());
|
||||
//override generic
|
||||
List<SpellAbilityView> chosen = generic ? getGui().getChoices(title, num, num, Lists.newArrayList(spellViewCache.keySet()))
|
||||
: getGui().many(title, "", num, Lists.newArrayList(spellViewCache.keySet()), sa.getHostCard().getView());
|
||||
|
||||
for(SpellAbilityView view : chosen) {
|
||||
if (spellViewCache.containsKey(view)) {
|
||||
|
||||
Reference in New Issue
Block a user