diff --git a/core/src/com/riiablo/CharData.java b/core/src/com/riiablo/CharData.java index e507d9f7..2c392e15 100644 --- a/core/src/com/riiablo/CharData.java +++ b/core/src/com/riiablo/CharData.java @@ -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); diff --git a/core/src/com/riiablo/item/Stat.java b/core/src/com/riiablo/item/Stat.java index 294f85e9..cdeb40fd 100644 --- a/core/src/com/riiablo/item/Stat.java +++ b/core/src/com/riiablo/item/Stat.java @@ -594,6 +594,14 @@ public class Stat implements Comparable, 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");