Create a copied set

This commit is contained in:
Frank 2022-11-15 19:36:37 +01:00
parent bf60049ed9
commit 09f2a9148c

View file

@ -128,11 +128,23 @@ public abstract class EquipmentSet {
return new SetValues(); return new SetValues();
} }
public static SetValues copy(SetValues source, float offset) {
SetValues v = create();
for (var e : source.values.entrySet())
v.add(e.getKey(), e.getValue() + offset);
return v;
}
public SetValues add(String slot, float value) { public SetValues add(String slot, float value) {
values.put(slot, value); values.put(slot, value);
return this; return this;
} }
public SetValues offset(String slot, float offset) {
values.put(slot, get(slot) + offset);
return this;
}
public float get(String slot) { public float get(String slot) {
return values.getOrDefault(slot, 0.0f); return values.getOrDefault(slot, 0.0f);
} }