mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
ensure that charms use SpellAbilityView for choices
- needed for Funeral Charm Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
This commit is contained in:
@@ -1387,12 +1387,17 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
|||||||
@Override
|
@Override
|
||||||
public List<AbilitySub> chooseModeForAbility(final SpellAbility sa, final int min, final int num,
|
public List<AbilitySub> chooseModeForAbility(final SpellAbility sa, final int min, final int num,
|
||||||
boolean allowRepeat) {
|
boolean allowRepeat) {
|
||||||
final List<AbilitySub> choices = CharmEffect.makePossibleOptions(sa);
|
final List<AbilitySub> possible = CharmEffect.makePossibleOptions(sa);
|
||||||
|
HashMap<SpellAbilityView, AbilitySub> spellViewCache = new HashMap<>();
|
||||||
|
for (AbilitySub spellAbility : possible) {
|
||||||
|
spellViewCache.put(spellAbility.getView(), spellAbility);
|
||||||
|
}
|
||||||
|
final List<SpellAbilityView> choices = new ArrayList<>(spellViewCache.keySet());
|
||||||
final String modeTitle = TextUtil.concatNoSpace(sa.getActivatingPlayer().toString(), " activated ",
|
final String modeTitle = TextUtil.concatNoSpace(sa.getActivatingPlayer().toString(), " activated ",
|
||||||
sa.getHostCard().toString(), " - Choose a mode");
|
sa.getHostCard().toString(), " - Choose a mode");
|
||||||
final List<AbilitySub> chosen = Lists.newArrayListWithCapacity(num);
|
final List<AbilitySub> chosen = Lists.newArrayListWithCapacity(num);
|
||||||
for (int i = 0; i < num; i++) {
|
for (int i = 0; i < num; i++) {
|
||||||
AbilitySub a;
|
SpellAbilityView a;
|
||||||
if (i < min) {
|
if (i < min) {
|
||||||
a = getGui().one(modeTitle, choices);
|
a = getGui().one(modeTitle, choices);
|
||||||
} else {
|
} else {
|
||||||
@@ -1405,7 +1410,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
|||||||
if (!allowRepeat) {
|
if (!allowRepeat) {
|
||||||
choices.remove(a);
|
choices.remove(a);
|
||||||
}
|
}
|
||||||
chosen.add(a);
|
chosen.add(spellViewCache.get(a));
|
||||||
}
|
}
|
||||||
return chosen;
|
return chosen;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user