Implement attributing locking when reforging

This commit is contained in:
Melledy
2025-11-17 03:11:12 -08:00
parent db6c3a5b0f
commit a18b7e8a2a
3 changed files with 87 additions and 10 deletions
@@ -3,8 +3,8 @@ package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.GameData;
import emu.nebula.data.ResourceType;
import emu.nebula.util.CustomIntArray;
import emu.nebula.util.WeightedList;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
import lombok.Getter;
@@ -35,9 +35,10 @@ public class CharGemSlotControlDef extends BaseDef {
}
public IntList generateAttributes() {
// Generate list of attributes
var list = new IntArrayList();
return this.generateAttributes(new CustomIntArray());
}
public IntList generateAttributes(CustomIntArray list) {
// Add unique attributes
if (this.UniqueAttrGroupId > 0) {
var group = GameData.getCharGemAttrGroupDataTable().get(this.UniqueAttrGroupId);
@@ -48,7 +49,7 @@ public class CharGemSlotControlDef extends BaseDef {
list.add(attributeType.getRandomValue());
}
if (list.size() >= 4) {
if (list.size() >= this.MaxAlterNum) {
return list;
}
}
@@ -66,7 +67,7 @@ public class CharGemSlotControlDef extends BaseDef {
}
// Add up to 4 attributes
while (list.size() < 4) {
while (list.getValueCount() < this.MaxAlterNum) {
var group = random.next();
var attributeType = group.getRandomAttributeType(list);
list.add(attributeType.getRandomValue());