Merge pull request #2348 from jjayers99/master

Adventure shop spawn correction
This commit is contained in:
Anthony Calosa
2023-01-30 14:27:16 +08:00
committed by GitHub

View File

@@ -599,20 +599,25 @@ public class MapStage extends GameStage {
restockPrice = 0; restockPrice = 0;
} }
possibleShops = new Array<>(shopList.split(",")); possibleShops = new Array<String>(shopList.split(","));
Array<String> filteredPossibleShops = possibleShops; Array<String> filteredPossibleShops = new Array<>();
if (!isRotatingShop) if (!isRotatingShop){
filteredPossibleShops.removeAll(shopsAlreadyPresent, false); for (String candidate : possibleShops)
if (filteredPossibleShops.notEmpty()){ {
possibleShops = filteredPossibleShops; if (!shopsAlreadyPresent.contains(candidate, false))
filteredPossibleShops.add(candidate);
}
}
if (filteredPossibleShops.isEmpty()){
filteredPossibleShops = possibleShops;
} }
Array<ShopData> shops; Array<ShopData> shops;
if (possibleShops.size == 0 || shopList.equals("")) if (filteredPossibleShops.size == 0 || shopList.equals(""))
shops = WorldData.getShopList(); shops = WorldData.getShopList();
else { else {
shops = new Array<>(); shops = new Array<>();
for (ShopData data : new Array.ArrayIterator<>(WorldData.getShopList())) { for (ShopData data : new Array.ArrayIterator<>(WorldData.getShopList())) {
if (possibleShops.contains(data.name, false)) { if (filteredPossibleShops.contains(data.name, false)) {
data.restockPrice = restockPrice; data.restockPrice = restockPrice;
shops.add(data); shops.add(data);
} }