Skip to content

Commit

Permalink
Show suggested XP in BalanceRPGame tool
Browse files Browse the repository at this point in the history
  • Loading branch information
AntumDeluge committed May 16, 2024
1 parent c7a4b5b commit 6afe4d2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/games/stendhal/tools/BalanceRPGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ public int compare(final DefaultCreature o1, final DefaultCreature o2) {
durationThreshold = DEFAULT_DURATION_THRESHOLD;

Integer proposedXPValue = null;
Integer suggestedXP = null;

boolean balanced = false;
int tries = 0;
Expand All @@ -235,6 +236,7 @@ public int compare(final DefaultCreature o1, final DefaultCreature o2) {

if (isCorrectResult(level, meanTurns, meanLeftHP / (double) player.getBaseHP())) {
balanced = true;
suggestedXP = proposedXPValue;
} else {
optimizer.step(meanLeftHP, meanTurns);

Expand Down Expand Up @@ -284,8 +286,14 @@ public int compare(final DefaultCreature o1, final DefaultCreature o2) {
stringBuilder.append("\t\tHP: ");
stringBuilder.append(target.getBaseHP());

if (System.getProperty("showxp") != null && proposedXPValue != null) {
stringBuilder.append("\t\tXP: " + proposedXPValue);
if (System.getProperty("showxp") != null) {
if (proposedXPValue != null) {
stringBuilder.append("\t\tXP: " + proposedXPValue);
}
if (suggestedXP != null) {
stringBuilder.append("\t\tSuggested XP: ");
stringBuilder.append(suggestedXP);
}
}

suggestions.add(stringBuilder.toString());
Expand Down

0 comments on commit 6afe4d2

Please sign in to comment.