summaryrefslogtreecommitdiff
path: root/src/com/dabomstew/pkrandom/romhandlers
diff options
context:
space:
mode:
authorAjarmar <axel.jarmar@gmail.com>2021-04-13 18:44:20 +0200
committerAjarmar <axel.jarmar@gmail.com>2021-04-13 18:44:20 +0200
commit9f9405fb8e448ae915662314883eb71178412c7b (patch)
tree0367576e75def309027b46f31dcaa2354e4108e0 /src/com/dabomstew/pkrandom/romhandlers
parentffa68879df535d4b2a0865f0de1972ed3f6585b0 (diff)
Gen 6: limit mega stones to one occurrence among field items if "balance shop prices" is not used
Duplicate mega stones are more or less useless if "balance shop prices" isn't used (since they cannot be sold).
Diffstat (limited to 'src/com/dabomstew/pkrandom/romhandlers')
-rwxr-xr-xsrc/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java17
-rwxr-xr-xsrc/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java5
-rwxr-xr-xsrc/com/dabomstew/pkrandom/romhandlers/Gen2RomHandler.java5
-rwxr-xr-xsrc/com/dabomstew/pkrandom/romhandlers/Gen3RomHandler.java5
-rwxr-xr-xsrc/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java5
-rwxr-xr-xsrc/com/dabomstew/pkrandom/romhandlers/Gen5RomHandler.java5
-rw-r--r--src/com/dabomstew/pkrandom/romhandlers/Gen6RomHandler.java5
-rw-r--r--src/com/dabomstew/pkrandom/romhandlers/Gen7RomHandler.java5
-rwxr-xr-xsrc/com/dabomstew/pkrandom/romhandlers/RomHandler.java2
9 files changed, 51 insertions, 3 deletions
diff --git a/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java
index c647023..6c5dff9 100755
--- a/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java
+++ b/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java
@@ -31,6 +31,7 @@ package com.dabomstew.pkrandom.romhandlers;
import java.io.PrintStream;
import java.util.*;
import java.util.stream.Collectors;
+import java.util.stream.IntStream;
import com.dabomstew.pkrandom.*;
import com.dabomstew.pkrandom.constants.*;
@@ -4072,11 +4073,13 @@ public abstract class AbstractRomHandler implements RomHandler {
public void randomizeFieldItems(Settings settings) {
boolean banBadItems = settings.isBanBadRandomFieldItems();
boolean distributeItemsControl = settings.getFieldItemsMod() == Settings.FieldItemsMod.RANDOM_EVEN;
+ boolean uniqueItems = !settings.isBalanceShopPrices();
- ItemList possibleItems = banBadItems ? this.getNonBadItems() : this.getAllowedItems();
+ ItemList possibleItems = banBadItems ? this.getNonBadItems().copy() : this.getAllowedItems().copy();
List<Integer> currentItems = this.getRegularFieldItems();
List<Integer> currentTMs = this.getCurrentFieldTMs();
List<Integer> requiredTMs = this.getRequiredFieldTMs();
+ List<Integer> uniqueNoSellItems = this.getUniqueNoSellItems();
// System.out.println("distributeItemsControl: "+ distributeItemsControl);
int fieldItemCount = currentItems.size();
@@ -4098,11 +4101,19 @@ public abstract class AbstractRomHandler implements RomHandler {
iterNum +=1;
}
newItems.add(chosenItem);
- this.setItemPlacementHistory(chosenItem);
+ if (uniqueItems && uniqueNoSellItems.contains(chosenItem)) {
+ possibleItems.banSingles(chosenItem);
+ } else {
+ this.setItemPlacementHistory(chosenItem);
+ }
}
} else {
for (int i = 0; i < fieldItemCount; i++) {
- newItems.add(possibleItems.randomNonTM(this.random));
+ int chosenItem = possibleItems.randomNonTM(this.random);
+ newItems.add(chosenItem);
+ if (uniqueItems && uniqueNoSellItems.contains(chosenItem)) {
+ possibleItems.banSingles(chosenItem);
+ }
}
}
diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java
index a6e44d6..964f1e5 100755
--- a/src/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java
+++ b/src/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java
@@ -1879,6 +1879,11 @@ public class Gen1RomHandler extends AbstractGBCRomHandler {
}
@Override
+ public List<Integer> getUniqueNoSellItems() {
+ return new ArrayList<>();
+ }
+
+ @Override
public List<Integer> getRegularShopItems() {
return null; // Not implemented
}
diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen2RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen2RomHandler.java
index b62da21..f4f84d5 100755
--- a/src/com/dabomstew/pkrandom/romhandlers/Gen2RomHandler.java
+++ b/src/com/dabomstew/pkrandom/romhandlers/Gen2RomHandler.java
@@ -1874,6 +1874,11 @@ public class Gen2RomHandler extends AbstractGBCRomHandler {
}
@Override
+ public List<Integer> getUniqueNoSellItems() {
+ return new ArrayList<>();
+ }
+
+ @Override
public List<Integer> getRegularShopItems() {
return null; // Not implemented
}
diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen3RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen3RomHandler.java
index 423e603..f58e6ea 100755
--- a/src/com/dabomstew/pkrandom/romhandlers/Gen3RomHandler.java
+++ b/src/com/dabomstew/pkrandom/romhandlers/Gen3RomHandler.java
@@ -2903,6 +2903,11 @@ public class Gen3RomHandler extends AbstractGBRomHandler {
}
@Override
+ public List<Integer> getUniqueNoSellItems() {
+ return new ArrayList<>();
+ }
+
+ @Override
public List<Integer> getRegularShopItems() {
return null; // Not implemented
}
diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java
index 7c02d2d..4fc197a 100755
--- a/src/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java
+++ b/src/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java
@@ -3519,6 +3519,11 @@ public class Gen4RomHandler extends AbstractDSRomHandler {
}
@Override
+ public List<Integer> getUniqueNoSellItems() {
+ return new ArrayList<>();
+ }
+
+ @Override
public List<Integer> getRegularShopItems() {
return Gen4Constants.regularShopItems;
}
diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen5RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen5RomHandler.java
index 12e367e..e818a57 100755
--- a/src/com/dabomstew/pkrandom/romhandlers/Gen5RomHandler.java
+++ b/src/com/dabomstew/pkrandom/romhandlers/Gen5RomHandler.java
@@ -2793,6 +2793,11 @@ public class Gen5RomHandler extends AbstractDSRomHandler {
}
@Override
+ public List<Integer> getUniqueNoSellItems() {
+ return new ArrayList<>();
+ }
+
+ @Override
public List<Integer> getRegularShopItems() {
return regularShopItems;
}
diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen6RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen6RomHandler.java
index b2e0deb..fecf168 100644
--- a/src/com/dabomstew/pkrandom/romhandlers/Gen6RomHandler.java
+++ b/src/com/dabomstew/pkrandom/romhandlers/Gen6RomHandler.java
@@ -2985,6 +2985,11 @@ public class Gen6RomHandler extends Abstract3DSRomHandler {
}
@Override
+ public List<Integer> getUniqueNoSellItems() {
+ return Gen6Constants.uniqueNoSellItems;
+ }
+
+ @Override
public List<Integer> getRegularShopItems() {
return Gen6Constants.regularShopItems;
}
diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen7RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen7RomHandler.java
index 0f53120..628ecb3 100644
--- a/src/com/dabomstew/pkrandom/romhandlers/Gen7RomHandler.java
+++ b/src/com/dabomstew/pkrandom/romhandlers/Gen7RomHandler.java
@@ -2664,6 +2664,11 @@ public class Gen7RomHandler extends Abstract3DSRomHandler {
}
@Override
+ public List<Integer> getUniqueNoSellItems() {
+ return new ArrayList<>();
+ }
+
+ @Override
public List<Integer> getRegularShopItems() {
return Gen7Constants.getRegularShopItems(romEntry.romType);
}
diff --git a/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java
index ee7af2f..64da8df 100755
--- a/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java
+++ b/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java
@@ -407,6 +407,8 @@ public interface RomHandler {
ItemList getNonBadItems();
+ List<Integer> getUniqueNoSellItems();
+
List<Integer> getRegularShopItems();
List<Integer> getOPShopItems();