Fixes stat mismatch between current and max -- will likely require more modifications to apply all current mods to max stat

This commit is contained in:
Collin Smith 2019-04-24 22:18:38 -07:00
parent a019755a96
commit acdf053a76
2 changed files with 13 additions and 0 deletions

View File

@ -226,6 +226,11 @@ public class CharData {
}
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);

View File

@ -594,6 +594,14 @@ public class Stat implements Comparable<Stat>, Pool.Poolable {
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");