mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 17:58:01 +00:00
Fix GenericChoice UI
This commit is contained in:
@@ -183,7 +183,7 @@ public class PlayerControllerAi extends PlayerController {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SpellAbility> chooseSpellAbilitiesForEffect(List<SpellAbility> spells, SpellAbility sa, String title,
|
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> remaining = Lists.newArrayList(spells);
|
||||||
List<SpellAbility> selecteds = Lists.newArrayList();
|
List<SpellAbility> selecteds = Lists.newArrayList();
|
||||||
SpellAbility selected;
|
SpellAbility selected;
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class ChooseGenericEffect extends SpellAbilityEffect {
|
|||||||
if (sa.hasParam("AtRandom")) {
|
if (sa.hasParam("AtRandom")) {
|
||||||
Aggregates.random(abilities, amount, chosenSAs);
|
Aggregates.random(abilities, amount, chosenSAs);
|
||||||
} else {
|
} 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()) {
|
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 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 <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,
|
public abstract SpellAbility chooseSingleSpellForEffect(List<SpellAbility> spells, SpellAbility sa, String title,
|
||||||
Map<String, Object> params);
|
Map<String, Object> params);
|
||||||
|
|||||||
@@ -705,7 +705,7 @@ public class PlayerControllerForTests extends PlayerController {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SpellAbility> chooseSpellAbilitiesForEffect(List<SpellAbility> spells, SpellAbility sa, String title,
|
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
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -619,12 +619,14 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
List<SpellAbility> result = Lists.newArrayList();
|
||||||
// create a mapping between a spell's view and the spell itself
|
// create a mapping between a spell's view and the spell itself
|
||||||
Map<SpellAbilityView, SpellAbility> spellViewCache = SpellAbilityView.getMap(spells);
|
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) {
|
for(SpellAbilityView view : chosen) {
|
||||||
if (spellViewCache.containsKey(view)) {
|
if (spellViewCache.containsKey(view)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user