Filter emblem elemental affixes not matching the trekker's element

This commit is contained in:
Melledy
2026-01-18 17:52:01 -08:00
parent 7e73f02bc3
commit e9a4d97be7
5 changed files with 49 additions and 16 deletions
@@ -1,22 +1,28 @@
package emu.nebula.game.character;
import java.util.Arrays;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import lombok.Getter;
@Getter
public enum ElementType {
INHERIT (0),
AQUA (1, 90018),
FIRE (2, 90019),
EARTH (3, 90021),
WIND (4, 90020),
LIGHT (5, 90022),
DARK (6, 90023),
AQUA (1, 90018, new int[] {17, 23}),
FIRE (2, 90019, new int[] {18, 24}),
EARTH (3, 90021, new int[] {19, 25}),
WIND (4, 90020, new int[] {20, 26}),
LIGHT (5, 90022, new int[] {21, 27}),
DARK (6, 90023, new int[] {22, 28}),
NONE (7);
private final int value;
private final int subNoteSkillItemId;
private final IntSet gemAttrTypes;
private final static Int2ObjectMap<ElementType> map = new Int2ObjectOpenHashMap<>();
static {
@@ -26,12 +32,15 @@ public enum ElementType {
}
private ElementType(int value) {
this(value, 0);
this(value, 0, new int[0]);
}
private ElementType(int value, int subNoteSkillItemId) {
private ElementType(int value, int subNoteSkillItemId, int[] attrTypes) {
this.value = value;
this.subNoteSkillItemId = subNoteSkillItemId;
this.gemAttrTypes = new IntOpenHashSet();
Arrays.stream(attrTypes).forEach(this.gemAttrTypes::add);
}
public static ElementType getByValue(int value) {
@@ -698,7 +698,7 @@ public class GameCharacter implements GameDatabaseObject {
}
// Generate attributes and create gem
var attributes = gemControl.generateAttributes();
var attributes = gemControl.generateAttributes(this);
var gem = new CharacterGem(attributes);
// Add gem to slot
@@ -771,7 +771,7 @@ public class GameCharacter implements GameDatabaseObject {
}
// Generate attributes and create gem
var attributes = gemControl.generateAttributes(list);
var attributes = gemControl.generateAttributes(this, list);
gem.setNewAttributes(attributes);
// Save to database