summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/com/sneed/pkrandom/Settings.java13
-rw-r--r--src/com/sneed/pkrandom/newgui/Bundle.properties2
-rw-r--r--src/com/sneed/pkrandom/newgui/NewRandomizerGUI.form33
-rw-r--r--src/com/sneed/pkrandom/newgui/NewRandomizerGUI.java10
-rwxr-xr-xsrc/com/sneed/pkrandom/romhandlers/AbstractRomHandler.java5
5 files changed, 48 insertions, 15 deletions
diff --git a/src/com/sneed/pkrandom/Settings.java b/src/com/sneed/pkrandom/Settings.java
index cba8808..6088348 100644
--- a/src/com/sneed/pkrandom/Settings.java
+++ b/src/com/sneed/pkrandom/Settings.java
@@ -97,6 +97,7 @@ public class Settings {
private boolean banNegativeAbilities;
private boolean banBadAbilities;
private boolean weighDuplicateAbilitiesTogether;
+ private boolean ensureTwoAbilities;
public enum StartersMod {
UNCHANGED, CUSTOM, COMPLETELY_RANDOM, RANDOM_WITH_TWO_EVOLUTIONS
@@ -565,13 +566,14 @@ public class Settings {
// 47 Static level modifier
out.write((staticLevelModified ? 0x80 : 0) | (staticLevelModifier+50));
- // 48 trainer pokemon held items.
+ // 48 trainer pokemon held items / pokemon ensure two abilities
out.write(makeByteSelected(randomizeHeldItemsForBossTrainerPokemon,
randomizeHeldItemsForImportantTrainerPokemon,
randomizeHeldItemsForRegularTrainerPokemon,
consumableItemsOnlyForTrainerPokemon,
sensibleItemsOnlyForTrainerPokemon,
- highestLevelOnlyGetsItemsForTrainerPokemon));
+ highestLevelOnlyGetsItemsForTrainerPokemon,
+ ensureTwoAbilities));
// 49 pickup item randomization
out.write(makeByteSelected(pickupItemsMod == PickupItemsMod.RANDOM,
@@ -861,6 +863,7 @@ public class Settings {
settings.setConsumableItemsOnlyForTrainers(restoreState(data[48], 3));
settings.setSensibleItemsOnlyForTrainers(restoreState(data[48], 4));
settings.setHighestLevelGetsItemsForTrainers(restoreState(data[48], 5));
+ settings.setEnsureTwoAbilities(restoreState(data[48], 6));
settings.setPickupItemsMod(restoreEnum(PickupItemsMod.class, data[49],
1, // UNCHANGED
@@ -1297,6 +1300,12 @@ public class Settings {
this.weighDuplicateAbilitiesTogether = weighDuplicateAbilitiesTogether;
}
+ public boolean isEnsureTwoAbilities() { return ensureTwoAbilities; }
+
+ public void setEnsureTwoAbilities(boolean ensureTwoAbilities) {
+ this.ensureTwoAbilities = ensureTwoAbilities;
+ }
+
public StartersMod getStartersMod() {
return startersMod;
}
diff --git a/src/com/sneed/pkrandom/newgui/Bundle.properties b/src/com/sneed/pkrandom/newgui/Bundle.properties
index 8895693..459a4b5 100644
--- a/src/com/sneed/pkrandom/newgui/Bundle.properties
+++ b/src/com/sneed/pkrandom/newgui/Bundle.properties
@@ -65,6 +65,8 @@ GUI.paNegativeAbilitiesCheckBox.toolTipText=<html>When abilities are randomized,
GUI.paNegativeAbilitiesCheckBox.text=Negative Abilities
GUI.paBadAbilitiesCheckBox.toolTipText=<html>When abilities are randomized, ban bad abilities.<br />\nThis bans Minus, Plus, Anticipation, Forewarn, Frisk, Honey Gather, Aura Break, Receiver, Power of Alchemy.<br />If "Double Battle Mode" for Trainers is not selected, it also bans Friend Guard, Healer, Telepathy, Symbiosis, Battery.<br />\nHas no effect if abilities are not randomized.
GUI.paBadAbilitiesCheckBox.text=Bad Abilities
+GUI.paEnsureTwoAbilitiesCheckbox.toolTipText=<html>When abilities are randomized, ensure each Pokemon has two abilities.
+GUI.paEnsureTwoAbilitiesCheckbox.text=Ensure Two Abilities
GUI.pePanel.title=Pokemon Evolutions
GUI.peUnchangedRadioButton.toolTipText=Don't randomize Pokemon evolutions.
GUI.peUnchangedRadioButton.text=Unchanged
diff --git a/src/com/sneed/pkrandom/newgui/NewRandomizerGUI.form b/src/com/sneed/pkrandom/newgui/NewRandomizerGUI.form
index 9881b8f..a518865 100644
--- a/src/com/sneed/pkrandom/newgui/NewRandomizerGUI.form
+++ b/src/com/sneed/pkrandom/newgui/NewRandomizerGUI.form
@@ -2,7 +2,7 @@
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.sneed.pkrandom.newgui.NewRandomizerGUI">
<grid id="27dc6" binding="mainPanel" layout-manager="GridBagLayout">
<constraints>
- <xy x="7" y="20" width="1288" height="1103"/>
+ <xy x="7" y="20" width="1350" height="1103"/>
</constraints>
<properties/>
<border type="none">
@@ -457,7 +457,7 @@
</component>
<hspacer id="559d2">
<constraints>
- <grid row="1" column="5" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ <grid row="1" column="6" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.1" weighty="0.0"/>
</constraints>
</hspacer>
@@ -546,7 +546,7 @@
</component>
<component id="4ac30" class="javax.swing.JCheckBox" binding="paBadAbilitiesCheckBox">
<constraints>
- <grid row="3" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <grid row="3" column="4" row-span="1" col-span="2" 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>
@@ -555,26 +555,37 @@
<toolTipText resource-bundle="com/sneed/pkrandom/newgui/Bundle" key="GUI.paBadAbilitiesCheckBox.toolTipText"/>
</properties>
</component>
- <component id="b3439" class="javax.swing.JCheckBox" binding="paFollowMegaEvosCheckBox">
+ <component id="652d7" class="javax.swing.JCheckBox" binding="paWeighDuplicatesTogetherCheckBox">
<constraints>
- <grid row="2" column="3" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <grid row="1" column="3" row-span="1" col-span="2" 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"/>
- <text resource-bundle="com/sneed/pkrandom/newgui/Bundle" key="GUI.paFollowMegaEvosCheckBox.text"/>
- <toolTipText resource-bundle="com/sneed/pkrandom/newgui/Bundle" key="GUI.paFollowMegaEvosCheckBox.toolTipText"/>
+ <text resource-bundle="com/sneed/pkrandom/newgui/Bundle" key="GUI.paWeighDuplicatesTogetherCheckBox.text"/>
+ <toolTipText resource-bundle="com/sneed/pkrandom/newgui/Bundle" key="GUI.paWeighDuplicatesTogetherCheckBox.toolTipText"/>
</properties>
</component>
- <component id="652d7" class="javax.swing.JCheckBox" binding="paWeighDuplicatesTogetherCheckBox">
+ <component id="bae4a" class="javax.swing.JCheckBox" binding="paEnsureTwoAbilitiesCheckbox">
<constraints>
- <grid row="1" column="3" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <grid row="1" column="5" 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"/>
- <text resource-bundle="com/sneed/pkrandom/newgui/Bundle" key="GUI.paWeighDuplicatesTogetherCheckBox.text"/>
- <toolTipText resource-bundle="com/sneed/pkrandom/newgui/Bundle" key="GUI.paWeighDuplicatesTogetherCheckBox.toolTipText"/>
+ <text resource-bundle="com/sneed/pkrandom/newgui/Bundle" key="GUI.paEnsureTwoAbilitiesCheckbox.text"/>
+ <toolTipText resource-bundle="com/sneed/pkrandom/newgui/Bundle" key="GUI.paEnsureTwoAbilitiesCheckbox.toolTipText"/>
+ </properties>
+ </component>
+ <component id="b3439" class="javax.swing.JCheckBox" binding="paFollowMegaEvosCheckBox">
+ <constraints>
+ <grid row="2" column="3" row-span="1" col-span="2" 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"/>
+ <text resource-bundle="com/sneed/pkrandom/newgui/Bundle" key="GUI.paFollowMegaEvosCheckBox.text"/>
+ <toolTipText resource-bundle="com/sneed/pkrandom/newgui/Bundle" key="GUI.paFollowMegaEvosCheckBox.toolTipText"/>
</properties>
</component>
</children>
diff --git a/src/com/sneed/pkrandom/newgui/NewRandomizerGUI.java b/src/com/sneed/pkrandom/newgui/NewRandomizerGUI.java
index 7521dd9..baa3e00 100644
--- a/src/com/sneed/pkrandom/newgui/NewRandomizerGUI.java
+++ b/src/com/sneed/pkrandom/newgui/NewRandomizerGUI.java
@@ -294,6 +294,7 @@ public class NewRandomizerGUI {
private JCheckBox miscFastDistortionWorldCheckBox;
private JComboBox tpComboBox;
private JCheckBox tpBetterMovesetsCheckBox;
+ private JCheckBox paEnsureTwoAbilitiesCheckbox;
private static JFrame frame;
@@ -1294,6 +1295,7 @@ public class NewRandomizerGUI {
paBadAbilitiesCheckBox.setSelected(settings.isBanBadAbilities());
paFollowMegaEvosCheckBox.setSelected(settings.isAbilitiesFollowMegaEvolutions());
paWeighDuplicatesTogetherCheckBox.setSelected(settings.isWeighDuplicateAbilitiesTogether());
+ paEnsureTwoAbilitiesCheckbox.setSelected(settings.isEnsureTwoAbilities());
ptRandomFollowEvolutionsRadioButton.setSelected(settings.getTypesMod() == Settings.TypesMod.RANDOM_FOLLOW_EVOLUTIONS);
ptRandomCompletelyRadioButton.setSelected(settings.getTypesMod() == Settings.TypesMod.COMPLETELY_RANDOM);
@@ -1537,6 +1539,7 @@ public class NewRandomizerGUI {
settings.setBanBadAbilities(paBadAbilitiesCheckBox.isSelected());
settings.setAbilitiesFollowMegaEvolutions(paFollowMegaEvosCheckBox.isSelected());
settings.setWeighDuplicateAbilitiesTogether(paWeighDuplicatesTogetherCheckBox.isSelected());
+ settings.setEnsureTwoAbilities(paEnsureTwoAbilitiesCheckbox.isSelected());
settings.setTypesMod(ptUnchangedRadioButton.isSelected(), ptRandomFollowEvolutionsRadioButton.isSelected(),
ptRandomCompletelyRadioButton.isSelected());
@@ -1915,6 +1918,9 @@ public class NewRandomizerGUI {
paWeighDuplicatesTogetherCheckBox.setVisible(true);
paWeighDuplicatesTogetherCheckBox.setEnabled(false);
paWeighDuplicatesTogetherCheckBox.setSelected(false);
+ paEnsureTwoAbilitiesCheckbox.setVisible(true);
+ paEnsureTwoAbilitiesCheckbox.setEnabled(false);
+ paEnsureTwoAbilitiesCheckbox.setSelected(false);
peUnchangedRadioButton.setVisible(true);
peUnchangedRadioButton.setEnabled(false);
peUnchangedRadioButton.setSelected(false);
@@ -2533,6 +2539,7 @@ public class NewRandomizerGUI {
paBadAbilitiesCheckBox.setEnabled(false);
paFollowMegaEvosCheckBox.setVisible(romHandler.hasMegaEvolutions());
paWeighDuplicatesTogetherCheckBox.setEnabled(false);
+ paEnsureTwoAbilitiesCheckbox.setEnabled(false);
} else {
pokemonAbilitiesPanel.setVisible(false);
}
@@ -2958,6 +2965,7 @@ public class NewRandomizerGUI {
paNegativeAbilitiesCheckBox.setEnabled(true);
paBadAbilitiesCheckBox.setEnabled(true);
paWeighDuplicatesTogetherCheckBox.setEnabled(true);
+ paEnsureTwoAbilitiesCheckbox.setEnabled(true);
} else {
paAllowWonderGuardCheckBox.setEnabled(false);
paAllowWonderGuardCheckBox.setSelected(false);
@@ -2973,6 +2981,8 @@ public class NewRandomizerGUI {
paFollowMegaEvosCheckBox.setSelected(false);
paWeighDuplicatesTogetherCheckBox.setEnabled(false);
paWeighDuplicatesTogetherCheckBox.setSelected(false);
+ paEnsureTwoAbilitiesCheckbox.setEnabled(false);
+ paEnsureTwoAbilitiesCheckbox.setSelected(false);
}
if (peRandomRadioButton.isSelected()) {
diff --git a/src/com/sneed/pkrandom/romhandlers/AbstractRomHandler.java b/src/com/sneed/pkrandom/romhandlers/AbstractRomHandler.java
index 4fb7902..3c29e0c 100755
--- a/src/com/sneed/pkrandom/romhandlers/AbstractRomHandler.java
+++ b/src/com/sneed/pkrandom/romhandlers/AbstractRomHandler.java
@@ -510,6 +510,7 @@ public abstract class AbstractRomHandler implements RomHandler {
boolean banBadAbilities = settings.isBanBadAbilities();
boolean megaEvolutionSanity = settings.isAbilitiesFollowMegaEvolutions();
boolean weighDuplicatesTogether = settings.isWeighDuplicateAbilitiesTogether();
+ boolean ensureTwoAbilities = settings.isEnsureTwoAbilities();
boolean doubleBattleMode = settings.isDoubleBattleMode();
// Abilities don't exist in some games...
@@ -561,7 +562,7 @@ public abstract class AbstractRomHandler implements RomHandler {
pk.ability1 = pickRandomAbility(maxAbility, bannedAbilities, weighDuplicatesTogether);
// Second ability?
- if (AbstractRomHandler.this.random.nextDouble() < 0.5) {
+ if (ensureTwoAbilities || AbstractRomHandler.this.random.nextDouble() < 0.5) {
// Yes, second ability
pk.ability2 = pickRandomAbility(maxAbility, bannedAbilities, weighDuplicatesTogether,
pk.ability1);
@@ -600,7 +601,7 @@ public abstract class AbstractRomHandler implements RomHandler {
pk.ability1 = this.pickRandomAbility(maxAbility, bannedAbilities, weighDuplicatesTogether);
// Second ability?
- if (this.random.nextDouble() < 0.5) {
+ if (ensureTwoAbilities || this.random.nextDouble() < 0.5) {
// Yes, second ability
pk.ability2 = this.pickRandomAbility(maxAbility, bannedAbilities, weighDuplicatesTogether,
pk.ability1);