Account for unspecified durability, related to #65

This commit is contained in:
HappyPikachu 2017-07-24 11:35:03 -04:00
parent 8c858937d8
commit fef92e2b30
2 changed files with 17 additions and 7 deletions

View File

@ -3,7 +3,7 @@
<groupId>me.blackvein.quests</groupId> <groupId>me.blackvein.quests</groupId>
<artifactId>quests</artifactId> <artifactId>quests</artifactId>
<version>2.9.5</version> <version>2.9.6</version>
<name>quests</name> <name>quests</name>
<url>https://github.com/FlyingPikachu/Quests/</url> <url>https://github.com/FlyingPikachu/Quests/</url>
<packaging>jar</packaging> <packaging>jar</packaging>

View File

@ -625,14 +625,16 @@ public class CreateStagePrompt extends FixedSetPrompt {
} else { } else {
two = 0; two = 0;
} }
if (one == two) { if (one == two) {
int missing; int missing;
LinkedList<Integer> elements;
if (context.getSessionData(pref + CK.S_BREAK_DURABILITY) != null) { if (context.getSessionData(pref + CK.S_BREAK_DURABILITY) != null) {
missing = one - ((List<Integer>) context.getSessionData(pref + CK.S_BREAK_DURABILITY)).size(); missing = one - ((List<Integer>) context.getSessionData(pref + CK.S_BREAK_DURABILITY)).size();
elements = (LinkedList<Integer>) context.getSessionData(pref + CK.S_BREAK_DURABILITY);
} else { } else {
missing = one; missing = one;
elements = new LinkedList<Integer>();
} }
LinkedList<Integer> elements = (LinkedList<Integer>) context.getSessionData(pref + CK.S_BREAK_DURABILITY);
for (int i = 0; i < missing; i++) { for (int i = 0; i < missing; i++) {
elements.add(0); elements.add(0);
} }
@ -842,12 +844,14 @@ public class CreateStagePrompt extends FixedSetPrompt {
} }
if (one == two) { if (one == two) {
int missing; int missing;
LinkedList<Integer> elements;
if (context.getSessionData(pref + CK.S_DAMAGE_DURABILITY) != null) { if (context.getSessionData(pref + CK.S_DAMAGE_DURABILITY) != null) {
missing = one - ((List<Integer>) context.getSessionData(pref + CK.S_DAMAGE_DURABILITY)).size(); missing = one - ((List<Integer>) context.getSessionData(pref + CK.S_DAMAGE_DURABILITY)).size();
elements = (LinkedList<Integer>) context.getSessionData(pref + CK.S_DAMAGE_DURABILITY);
} else { } else {
missing = one; missing = one;
elements = new LinkedList<Integer>();
} }
LinkedList<Integer> elements = (LinkedList<Integer>) context.getSessionData(pref + CK.S_DAMAGE_DURABILITY);
for (int i = 0; i < missing; i++) { for (int i = 0; i < missing; i++) {
elements.add(0); elements.add(0);
} }
@ -1057,12 +1061,14 @@ public class CreateStagePrompt extends FixedSetPrompt {
} }
if (one == two) { if (one == two) {
int missing; int missing;
LinkedList<Integer> elements;
if (context.getSessionData(pref + CK.S_PLACE_DURABILITY) != null) { if (context.getSessionData(pref + CK.S_PLACE_DURABILITY) != null) {
missing = one - ((List<Integer>) context.getSessionData(pref + CK.S_PLACE_DURABILITY)).size(); missing = one - ((List<Integer>) context.getSessionData(pref + CK.S_PLACE_DURABILITY)).size();
elements = (LinkedList<Integer>) context.getSessionData(pref + CK.S_PLACE_DURABILITY);
} else { } else {
missing = one; missing = one;
elements = new LinkedList<Integer>();
} }
LinkedList<Integer> elements = (LinkedList<Integer>) context.getSessionData(pref + CK.S_PLACE_DURABILITY);
for (int i = 0; i < missing; i++) { for (int i = 0; i < missing; i++) {
elements.add(0); elements.add(0);
} }
@ -1272,12 +1278,14 @@ public class CreateStagePrompt extends FixedSetPrompt {
} }
if (one == two) { if (one == two) {
int missing; int missing;
LinkedList<Integer> elements;
if (context.getSessionData(pref + CK.S_USE_DURABILITY) != null) { if (context.getSessionData(pref + CK.S_USE_DURABILITY) != null) {
missing = one - ((List<Integer>) context.getSessionData(pref + CK.S_USE_DURABILITY)).size(); missing = one - ((List<Integer>) context.getSessionData(pref + CK.S_USE_DURABILITY)).size();
elements = (LinkedList<Integer>) context.getSessionData(pref + CK.S_USE_DURABILITY);
} else { } else {
missing = one; missing = one;
elements = new LinkedList<Integer>();
} }
LinkedList<Integer> elements = (LinkedList<Integer>) context.getSessionData(pref + CK.S_USE_DURABILITY);
for (int i = 0; i < missing; i++) { for (int i = 0; i < missing; i++) {
elements.add(0); elements.add(0);
} }
@ -1487,12 +1495,14 @@ public class CreateStagePrompt extends FixedSetPrompt {
} }
if (one == two) { if (one == two) {
int missing; int missing;
LinkedList<Integer> elements;
if (context.getSessionData(pref + CK.S_CUT_DURABILITY) != null) { if (context.getSessionData(pref + CK.S_CUT_DURABILITY) != null) {
missing = one - ((List<Integer>) context.getSessionData(pref + CK.S_CUT_DURABILITY)).size(); missing = one - ((List<Integer>) context.getSessionData(pref + CK.S_CUT_DURABILITY)).size();
elements = (LinkedList<Integer>) context.getSessionData(pref + CK.S_CUT_DURABILITY);
} else { } else {
missing = one; missing = one;
elements = new LinkedList<Integer>();
} }
LinkedList<Integer> elements = (LinkedList<Integer>) context.getSessionData(pref + CK.S_CUT_DURABILITY);
for (int i = 0; i < missing; i++) { for (int i = 0; i < missing; i++) {
elements.add(0); elements.add(0);
} }