mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Fix so zones restored after selecting targets
This commit is contained in:
@@ -73,7 +73,8 @@ public interface IGuiBase {
|
||||
void enableOverlay();
|
||||
void disableOverlay();
|
||||
void finishGame();
|
||||
boolean openZone(ZoneType zoneType, Set<Player> players);
|
||||
boolean openZones(List<ZoneType> zones, Map<Player, Object> players);
|
||||
void restoreOldZones(Map<Player, Object> playersToRestoreZonesFor);
|
||||
void updateStack();
|
||||
void updateZones(List<Pair<Player, ZoneType>> zonesToUpdate);
|
||||
void updateCards(Set<Card> cardsToUpdate);
|
||||
|
||||
@@ -36,9 +36,9 @@ import forge.util.Aggregates;
|
||||
import forge.util.gui.SGuiChoose;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -113,12 +113,17 @@ public class TargetSelection {
|
||||
return this.chooseCardFromStack(mandatory);
|
||||
}
|
||||
else {
|
||||
List<Card> validTargets = this.getValidCardsToTarget();
|
||||
if (zone.size() == 1 && GuiBase.getInterface().openZone(zone.get(0), getPlayersWithValidTargets(validTargets))) {
|
||||
final List<Card> validTargets = this.getValidCardsToTarget();
|
||||
final Map<Player, Object> playersWithValidTargets = new HashMap<Player, Object>();
|
||||
for (Card card : validTargets) {
|
||||
playersWithValidTargets.put(card.getController(), null);
|
||||
}
|
||||
if (GuiBase.getInterface().openZones(zone, playersWithValidTargets)) {
|
||||
InputSelectTargets inp = new InputSelectTargets(validTargets, ability, mandatory);
|
||||
inp.showAndWait();
|
||||
choiceResult = !inp.hasCancelled();
|
||||
bTargetingDone = inp.hasPressedOk();
|
||||
GuiBase.getInterface().restoreOldZones(playersWithValidTargets);
|
||||
}
|
||||
else {
|
||||
// for every other case an all-purpose GuiChoose
|
||||
@@ -129,14 +134,6 @@ public class TargetSelection {
|
||||
return choiceResult && chooseTargets(numTargets);
|
||||
}
|
||||
|
||||
private Set<Player> getPlayersWithValidTargets(List<Card> validTargets) {
|
||||
Set<Player> players = new HashSet<Player>();
|
||||
for (Card card : validTargets) {
|
||||
players.add(card.getController());
|
||||
}
|
||||
return players;
|
||||
}
|
||||
|
||||
// these have been copied over from CardFactoryUtil as they need two extra
|
||||
// parameters for target selection.
|
||||
// however, due to the changes necessary for SA_Requirements this is much
|
||||
|
||||
Reference in New Issue
Block a user