From 828e3cf59aaf916fbe131eaee6f6fdb8a6e9de12 Mon Sep 17 00:00:00 2001 From: jjayers99 <56438137+jjayers99@users.noreply.github.com> Date: Sun, 29 Jan 2023 18:43:32 -0500 Subject: [PATCH] Adjust duplicate shop check to still spawn from intended list once all options have already been spawned once. --- .../src/forge/adventure/stage/MapStage.java | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/forge-gui-mobile/src/forge/adventure/stage/MapStage.java b/forge-gui-mobile/src/forge/adventure/stage/MapStage.java index dd9ff7e8e82..d5aa9b15d4e 100644 --- a/forge-gui-mobile/src/forge/adventure/stage/MapStage.java +++ b/forge-gui-mobile/src/forge/adventure/stage/MapStage.java @@ -599,20 +599,25 @@ public class MapStage extends GameStage { restockPrice = 0; } - possibleShops = new Array<>(shopList.split(",")); - Array filteredPossibleShops = possibleShops; - if (!isRotatingShop) - filteredPossibleShops.removeAll(shopsAlreadyPresent, false); - if (filteredPossibleShops.notEmpty()){ - possibleShops = filteredPossibleShops; + possibleShops = new Array(shopList.split(",")); + Array filteredPossibleShops = new Array<>(); + if (!isRotatingShop){ + for (String candidate : possibleShops) + { + if (!shopsAlreadyPresent.contains(candidate, false)) + filteredPossibleShops.add(candidate); + } + } + if (filteredPossibleShops.isEmpty()){ + filteredPossibleShops = possibleShops; } Array shops; - if (possibleShops.size == 0 || shopList.equals("")) + if (filteredPossibleShops.size == 0 || shopList.equals("")) shops = WorldData.getShopList(); else { shops = new Array<>(); for (ShopData data : new Array.ArrayIterator<>(WorldData.getShopList())) { - if (possibleShops.contains(data.name, false)) { + if (filteredPossibleShops.contains(data.name, false)) { data.restockPrice = restockPrice; shops.add(data); }