mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-07-04 15:27:30 +07:00
Added support for setting stat to sibling stat value
Changed order of hp,mp,stamina adjustments so they match again
This commit is contained in:
@ -228,6 +228,10 @@ public final class Attributes implements Iterable<StatRef> {
|
||||
return agg.get(stat);
|
||||
}
|
||||
|
||||
public StatRef set(final short stat, final short srcStat) {
|
||||
return agg.set(stat, srcStat);
|
||||
}
|
||||
|
||||
public int getValue(final short stat, final int value) {
|
||||
return agg.getValue(stat, value);
|
||||
}
|
||||
|
@ -124,6 +124,15 @@ public final class StatListRef implements Iterable<StatRef> {
|
||||
return get(index).asFixed();
|
||||
}
|
||||
|
||||
public StatRef set(final short stat, final short srcStat) {
|
||||
final StatRef src = get(srcStat);
|
||||
if (src == null) {
|
||||
throw new IndexOutOfBoundsException("list(" + list + ") does not contain any srcStat(" + srcStat + ")");
|
||||
}
|
||||
|
||||
return putEncoded(stat, src.encodedParams(), src.encodedValues());
|
||||
}
|
||||
|
||||
public StatRef putEncoded(final short stat, final int encodedParams, final int encodedValues) {
|
||||
final int index = stats.putEncoded(list, stat, encodedParams, encodedValues);
|
||||
return tuple.update(index);
|
||||
|
@ -358,9 +358,9 @@ public class CharData implements ItemData.UpdateListener, Pool.Poolable {
|
||||
assert itemData.stats == statData;
|
||||
|
||||
// FIXME: This corrects a mismatch between max and current, algorithm should be tested later for correctness in other cases
|
||||
statData.get(Stat.maxstamina).set(statData.get(Stat.stamina));
|
||||
statData.get(Stat.maxhp).set(statData.get(Stat.hitpoints));
|
||||
statData.get(Stat.maxmana).set(statData.get(Stat.mana));
|
||||
statData.set(Stat.stamina, Stat.maxstamina);
|
||||
statData.set(Stat.hitpoints, Stat.maxhp);
|
||||
statData.set(Stat.mana, Stat.maxmana);
|
||||
|
||||
// This appears to be hard-coded in the original client
|
||||
int dex = statData.get(Stat.dexterity).asInt();
|
||||
|
Reference in New Issue
Block a user