From e236202ddb98d8b33c8d529f87245ed211d1fbb3 Mon Sep 17 00:00:00 2001 From: "Jamin W. Collins" Date: Sat, 11 Aug 2018 12:42:26 -0600 Subject: [PATCH] ensure that charms use SpellAbilityView for choices - needed for Funeral Charm Signed-off-by: Jamin W. Collins --- .../main/java/forge/player/PlayerControllerHuman.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java b/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java index d33e1ecc56d..b52149fb9ce 100644 --- a/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java +++ b/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java @@ -1387,12 +1387,17 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont @Override public List chooseModeForAbility(final SpellAbility sa, final int min, final int num, boolean allowRepeat) { - final List choices = CharmEffect.makePossibleOptions(sa); + final List possible = CharmEffect.makePossibleOptions(sa); + HashMap spellViewCache = new HashMap<>(); + for (AbilitySub spellAbility : possible) { + spellViewCache.put(spellAbility.getView(), spellAbility); + } + final List choices = new ArrayList<>(spellViewCache.keySet()); final String modeTitle = TextUtil.concatNoSpace(sa.getActivatingPlayer().toString(), " activated ", sa.getHostCard().toString(), " - Choose a mode"); final List chosen = Lists.newArrayListWithCapacity(num); for (int i = 0; i < num; i++) { - AbilitySub a; + SpellAbilityView a; if (i < min) { a = getGui().one(modeTitle, choices); } else { @@ -1405,7 +1410,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont if (!allowRepeat) { choices.remove(a); } - chosen.add(a); + chosen.add(spellViewCache.get(a)); } return chosen; }