Create a copied set
This commit is contained in:
parent
bf60049ed9
commit
09f2a9148c
1 changed files with 12 additions and 0 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue