Skip to content

Commit

Permalink
Fixes stat mismatch between current and max -- will likely require mo…
Browse files Browse the repository at this point in the history
…re modifications to apply all current mods to max stat
  • Loading branch information
collinsmith committed Apr 25, 2019
1 parent a019755 commit acdf053
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/src/com/riiablo/CharData.java
Expand Up @@ -226,6 +226,11 @@ private void updateStats() {
}
stats.update(this);

// FIXME: This corrects a mismatch between max and current, algorithm should be tested later for correctness in other cases
stats.get(Stat.maxstamina).set(stats.get(Stat.stamina));
stats.get(Stat.maxhp).set(stats.get(Stat.hitpoints));
stats.get(Stat.maxmana).set(stats.get(Stat.mana));

// This appears to be hard-coded in the original client
int dex = stats.get(Stat.dexterity).value();
Stat armorclass = stats.get(Stat.armorclass);
Expand Down
8 changes: 8 additions & 0 deletions core/src/com/riiablo/item/Stat.java
Expand Up @@ -594,6 +594,14 @@ public Stat add(int value) {
return this;
}

// Intended for correcting maxhp, maxstamina and maxmana, see note in CharData
public Stat set(Stat other) {
val = other.val;
other.modified = modified;
modified = false;
return this;
}

private static final StringBuilder builder = new StringBuilder(32);
private static final CharSequence SPACE = Riiablo.string.lookup("space");
private static final CharSequence DASH = Riiablo.string.lookup("dash");
Expand Down

0 comments on commit acdf053

Please sign in to comment.