diff options
Diffstat (limited to 'src')
8 files changed, 56 insertions, 13 deletions
diff --git a/src/com/dabomstew/pkrandom/Randomizer.java b/src/com/dabomstew/pkrandom/Randomizer.java index 974bc1b..49beda4 100644 --- a/src/com/dabomstew/pkrandom/Randomizer.java +++ b/src/com/dabomstew/pkrandom/Randomizer.java @@ -596,7 +596,8 @@ public class Randomizer { if (settings.getShopItemsMod() == Settings.ShopItemsMod.SHUFFLE) {
romHandler.shuffleShopItems();
} else if (settings.getShopItemsMod() == Settings.ShopItemsMod.RANDOM) {
- romHandler.randomizeShopItems(settings.isBanBadRandomShopItems(),settings.isBanRegularShopItems(),settings.isBanOPShopItems(),settings.isBalanceShopPrices(), settings.isGuaranteeEvolutionItems());
+ romHandler.randomizeShopItems(settings.isBanBadRandomShopItems(), settings.isBanRegularShopItems(), settings.isBanOPShopItems(),
+ settings.isBalanceShopPrices(), settings.isGuaranteeEvolutionItems(), settings.isGuaranteeXItems());
}
diff --git a/src/com/dabomstew/pkrandom/Settings.java b/src/com/dabomstew/pkrandom/Settings.java index fe3834b..9fc82e8 100644 --- a/src/com/dabomstew/pkrandom/Settings.java +++ b/src/com/dabomstew/pkrandom/Settings.java @@ -288,6 +288,7 @@ public class Settings { private boolean banOPShopItems;
private boolean balanceShopPrices;
private boolean guaranteeEvolutionItems;
+ private boolean guaranteeXItems;
// to and from strings etc
public void write(FileOutputStream out) throws IOException {
@@ -512,7 +513,8 @@ public class Settings { ((auraMod == AuraMod.UNCHANGED) ? 0x8 : 0) |
((auraMod == AuraMod.RANDOM) ? 0x10 : 0) |
((auraMod == AuraMod.SAME_STRENGTH) ? 0x20 : 0) |
- (evolutionMovesForAll ? 0x40 : 0));
+ (evolutionMovesForAll ? 0x40 : 0) |
+ (guaranteeXItems ? 0x80 : 0));
out.write(makeByteSelected(
totemPokemonMod == TotemPokemonMod.UNCHANGED,
@@ -779,7 +781,8 @@ public class Settings { settings.setAdditionalRegularTrainerPokemon((data[41] & 0x7));
settings.setAuraMod(restoreEnum(AuraMod.class,data[41],3,4,5));
- settings.setEvolutionMovesForAll(restoreState(data[41],6)); // 7 still unused
+ settings.setEvolutionMovesForAll(restoreState(data[41],6));
+ settings.setGuaranteeXItems(restoreState(data[41],7));
settings.setTotemPokemonMod(restoreEnum(TotemPokemonMod.class,data[42],0,1,2));
settings.setAllyPokemonMod(restoreEnum(AllyPokemonMod.class,data[42],3,4,5));
@@ -2039,6 +2042,14 @@ public class Settings { this.guaranteeEvolutionItems = guaranteeEvolutionItems;
}
+ public boolean isGuaranteeXItems() {
+ return guaranteeXItems;
+ }
+
+ public void setGuaranteeXItems(boolean guaranteeXItems) {
+ this.guaranteeXItems = guaranteeXItems;
+ }
+
private static int makeByteSelected(boolean... bools) {
if (bools.length > 8) {
throw new IllegalArgumentException("Can't set more than 8 bits in a byte!");
diff --git a/src/com/dabomstew/pkrandom/constants/GlobalConstants.java b/src/com/dabomstew/pkrandom/constants/GlobalConstants.java index eb9bd47..77f39aa 100644 --- a/src/com/dabomstew/pkrandom/constants/GlobalConstants.java +++ b/src/com/dabomstew/pkrandom/constants/GlobalConstants.java @@ -233,6 +233,8 @@ public class GlobalConstants { public static final int[] ptSpecialIntros = { 377, 378, 379, 479, 480, 482, 483, 484, 485, 486, 487, 491, 492, 493 }; + public static final List<Integer> xItems = Arrays.asList(55, 56, 57, 58, 59, 60, 61, 62); + public static final List<Integer> battleTrappingAbilities = Arrays.asList(23, 42, 71); public static final List<Integer> negativeAbilities = Arrays.asList( diff --git a/src/com/dabomstew/pkrandom/newgui/Bundle.properties b/src/com/dabomstew/pkrandom/newgui/Bundle.properties index 027bd23..600e758 100644 --- a/src/com/dabomstew/pkrandom/newgui/Bundle.properties +++ b/src/com/dabomstew/pkrandom/newgui/Bundle.properties @@ -305,6 +305,8 @@ GUI.shBalanceShopItemPricesCheckBox.toolTipText=<html>Checking this will change GUI.shBalanceShopItemPricesCheckBox.text=Balance Shop Item Prices GUI.shGuaranteeEvolutionItemsCheckBox.toolTipText=<html>Checking this will ensure all evolution items appear in at least one shop. GUI.shGuaranteeEvolutionItemsCheckBox.text=Guarantee Evolution Items +GUI.shGuaranteeXItemsCheckbox.tooltipText=<html>Checking this will ensure all X items (including Guard Spec. and Dire Hit) appear in at least one shop. +GUI.shGuaranteeXItemsCheckbox.text=Guarantee X Items GUI.miscTweaksPanel.title=Misc. Tweaks GUI.miscPanel.title=Misc. Tweaks GUI.miscNoneAvailableLabel.text=There are no tweaks available for the currently loaded game. diff --git a/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.form b/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.form index 5ec703a..0843864 100644 --- a/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.form +++ b/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.form @@ -2964,7 +2964,7 @@ </hspacer> <vspacer id="2f864"> <constraints> - <grid row="6" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> + <grid row="7" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> <gridbag weightx="0.0" weighty="0.0"/> </constraints> </vspacer> @@ -3057,6 +3057,18 @@ <toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.shGuaranteeEvolutionItemsCheckBox.toolTipText"/> </properties> </component> + <component id="f7f02" class="javax.swing.JCheckBox" binding="shGuaranteeXItemsCheckBox"> + <constraints> + <grid row="6" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/> + <gridbag weightx="0.0" weighty="0.0"/> + </constraints> + <properties> + <enabled value="false"/> + <selected value="false"/> + <text resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.shGuaranteeXItemsCheckbox.text"/> + <toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.shGuaranteeXItemsCheckbox.tooltipText"/> + </properties> + </component> </children> </grid> </children> diff --git a/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.java b/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.java index f68cd9c..b9c963b 100644 --- a/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.java +++ b/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.java @@ -195,6 +195,7 @@ public class NewRandomizerGUI { private JCheckBox shBanRegularShopItemsCheckBox; private JCheckBox shBalanceShopItemPricesCheckBox; private JCheckBox shGuaranteeEvolutionItemsCheckBox; + private JCheckBox shGuaranteeXItemsCheckBox; private JCheckBox miscBWExpPatchCheckBox; private JCheckBox miscNerfXAccuracyCheckBox; private JCheckBox miscFixCritRateCheckBox; @@ -1425,6 +1426,7 @@ public class NewRandomizerGUI { shBanOverpoweredShopItemsCheckBox.setSelected(settings.isBanOPShopItems()); shBalanceShopItemPricesCheckBox.setSelected(settings.isBalanceShopPrices()); shGuaranteeEvolutionItemsCheckBox.setSelected(settings.isGuaranteeEvolutionItems()); + shGuaranteeXItemsCheckBox.setSelected(settings.isGuaranteeXItems()); int mtsSelected = settings.getCurrentMiscTweaks(); @@ -1597,7 +1599,7 @@ public class NewRandomizerGUI { settings.setBanOPShopItems(shBanOverpoweredShopItemsCheckBox.isSelected()); settings.setBalanceShopPrices(shBalanceShopItemPricesCheckBox.isSelected()); settings.setGuaranteeEvolutionItems(shGuaranteeEvolutionItemsCheckBox.isSelected()); - + settings.setGuaranteeXItems(shGuaranteeXItemsCheckBox.isSelected()); int currentMiscTweaks = 0; @@ -2250,6 +2252,9 @@ public class NewRandomizerGUI { shGuaranteeEvolutionItemsCheckBox.setVisible(true); shGuaranteeEvolutionItemsCheckBox.setEnabled(false); shGuaranteeEvolutionItemsCheckBox.setSelected(false); + shGuaranteeXItemsCheckBox.setVisible(true); + shGuaranteeXItemsCheckBox.setEnabled(false); + shGuaranteeXItemsCheckBox.setSelected(false); miscBWExpPatchCheckBox.setVisible(true); miscBWExpPatchCheckBox.setEnabled(false); miscBWExpPatchCheckBox.setSelected(false); @@ -2836,14 +2841,13 @@ public class NewRandomizerGUI { tpDontUseLegendariesCheckBox.setEnabled(true); tpNoEarlyWonderGuardCheckBox.setEnabled(true); tpAllowAlternateFormesCheckBox.setEnabled(true); - - tpRandomShinyTrainerPokemonCheckBox.setEnabled(true); if (currentRestrictions == null || currentRestrictions.megaEvolutionsAreInPool(romHandler.forceSwapStaticMegaEvos())) { tpSwapMegaEvosCheckBox.setEnabled(true); } else { tpSwapMegaEvosCheckBox.setEnabled(false); tpSwapMegaEvosCheckBox.setSelected(false); } + tpRandomShinyTrainerPokemonCheckBox.setEnabled(true); } if (tpForceFullyEvolvedAtCheckBox.isSelected()) { @@ -3084,6 +3088,7 @@ public class NewRandomizerGUI { shBanOverpoweredShopItemsCheckBox.setEnabled(true); shBalanceShopItemPricesCheckBox.setEnabled(true); shGuaranteeEvolutionItemsCheckBox.setEnabled(true); + shGuaranteeXItemsCheckBox.setEnabled(true); } else { shBanBadItemsCheckBox.setEnabled(false); shBanBadItemsCheckBox.setSelected(false); @@ -3095,6 +3100,8 @@ public class NewRandomizerGUI { shBalanceShopItemPricesCheckBox.setSelected(false); shGuaranteeEvolutionItemsCheckBox.setEnabled(false); shGuaranteeEvolutionItemsCheckBox.setSelected(false); + shGuaranteeXItemsCheckBox.setEnabled(false); + shGuaranteeXItemsCheckBox.setSelected(false); } } diff --git a/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java index e646668..9cf21c6 100755 --- a/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java @@ -4265,7 +4265,8 @@ public abstract class AbstractRomHandler implements RomHandler { // Note: If you use this on a game where the amount of randomizable shop items is greater than the amount of
// possible items, you will get owned by the while loop
@Override
- public void randomizeShopItems(boolean banBadItems, boolean banRegularShopItems, boolean banOPShopItems, boolean balancePrices, boolean placeEvolutionItems) {
+ public void randomizeShopItems(boolean banBadItems, boolean banRegularShopItems, boolean banOPShopItems, boolean balancePrices,
+ boolean placeEvolutionItems, boolean placeXItems) {
if (this.getShopItems() == null) return;
ItemList possibleItems = banBadItems ? this.getNonBadItems() : this.getAllowedItems();
if (banRegularShopItems) {
@@ -4281,9 +4282,15 @@ public abstract class AbstractRomHandler implements RomHandler { List<Integer> newItems = new ArrayList<>();
Map<Integer,List<Integer>> newItemsMap = new TreeMap<>();
int newItem;
+ List<Integer> guaranteedItems = new ArrayList<>();
if (placeEvolutionItems) {
- List<Integer> evolutionItems = getEvolutionItems();
- newItems.addAll(evolutionItems);
+ guaranteedItems.addAll(getEvolutionItems());
+ }
+ if (placeXItems) {
+ guaranteedItems.addAll(GlobalConstants.xItems);
+ }
+ if (placeEvolutionItems || placeXItems) {
+ newItems.addAll(guaranteedItems);
shopItemCount = shopItemCount - newItems.size();
for (int i = 0; i < shopItemCount; i++) {
@@ -4310,14 +4317,14 @@ public abstract class AbstractRomHandler implements RomHandler { }
}
- // Place items in non-main-game shops; skip over evolution items
+ // Place items in non-main-game shops; skip over guaranteed items
Collections.shuffle(newItems, this.random);
for (int i: nonMainGameShops) {
int j = 0;
List<Integer> newShopItems = new ArrayList<>();
for (Integer ignored: currentItems.get(i)) {
Integer item = newItems.get(j);
- while (evolutionItems.contains(item)) {
+ while (guaranteedItems.contains(item)) {
j++;
item = newItems.get(j);
}
diff --git a/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java index 46a75c1..f0d0346 100755 --- a/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java @@ -463,7 +463,8 @@ public interface RomHandler { void shuffleShopItems();
- void randomizeShopItems(boolean banBadItems, boolean banRegularShopItems, boolean banOPShopItems, boolean balancePrices, boolean placeEvolutionItems);
+ void randomizeShopItems(boolean banBadItems, boolean banRegularShopItems, boolean banOPShopItems, boolean balancePrices,
+ boolean placeEvolutionItems, boolean placeXItems);
Map<Integer, List<Integer>> getShopItems();
|