mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
ensure Stack targeting uses views
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
package forge.player;
|
package forge.player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -33,6 +34,7 @@ import forge.game.card.CardView;
|
|||||||
import forge.game.player.PlayerView;
|
import forge.game.player.PlayerView;
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
import forge.game.spellability.SpellAbilityStackInstance;
|
import forge.game.spellability.SpellAbilityStackInstance;
|
||||||
|
import forge.game.spellability.StackItemView;
|
||||||
import forge.game.spellability.TargetRestrictions;
|
import forge.game.spellability.TargetRestrictions;
|
||||||
import forge.game.zone.Zone;
|
import forge.game.zone.Zone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
@@ -244,6 +246,7 @@ public class TargetSelection {
|
|||||||
final String message = tgt.getVTSelection();
|
final String message = tgt.getVTSelection();
|
||||||
// Find what's targetable, then allow human to choose
|
// Find what's targetable, then allow human to choose
|
||||||
final List<Object> selectOptions = new ArrayList<Object>();
|
final List<Object> selectOptions = new ArrayList<Object>();
|
||||||
|
HashMap<StackItemView, SpellAbilityStackInstance> stackItemViewSpellAbilityHashMap = new HashMap<>();
|
||||||
|
|
||||||
final Game game = ability.getActivatingPlayer().getGame();
|
final Game game = ability.getActivatingPlayer().getGame();
|
||||||
for (final SpellAbilityStackInstance si : game.getStack()) {
|
for (final SpellAbilityStackInstance si : game.getStack()) {
|
||||||
@@ -253,7 +256,8 @@ public class TargetSelection {
|
|||||||
ability.resetTargets();
|
ability.resetTargets();
|
||||||
}
|
}
|
||||||
else if (ability.canTargetSpellAbility(abilityOnStack)) {
|
else if (ability.canTargetSpellAbility(abilityOnStack)) {
|
||||||
selectOptions.add(si);
|
stackItemViewSpellAbilityHashMap.put(si.getView(), si);
|
||||||
|
selectOptions.add(si.getView());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,8 +280,8 @@ public class TargetSelection {
|
|||||||
if (madeChoice == null) {
|
if (madeChoice == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (madeChoice instanceof SpellAbilityStackInstance) {
|
if (madeChoice instanceof StackItemView) {
|
||||||
ability.getTargets().add(((SpellAbilityStackInstance)madeChoice).getSpellAbility(true));
|
ability.getTargets().add(stackItemViewSpellAbilityHashMap.get(madeChoice).getSpellAbility(true));
|
||||||
}
|
}
|
||||||
else {// 'FINISH TARGETING' chosen
|
else {// 'FINISH TARGETING' chosen
|
||||||
bTargetingDone = true;
|
bTargetingDone = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user