diff options
Diffstat (limited to 'src/main/java/tlIItools/AffixSet.java')
| -rw-r--r-- | src/main/java/tlIItools/AffixSet.java | 47 |
1 files changed, 16 insertions, 31 deletions
diff --git a/src/main/java/tlIItools/AffixSet.java b/src/main/java/tlIItools/AffixSet.java index d7f14211..fa5c8d19 100644 --- a/src/main/java/tlIItools/AffixSet.java +++ b/src/main/java/tlIItools/AffixSet.java @@ -2,65 +2,50 @@ package tlIItools; import java.util.*; -/** - * Container of a set of affixes. +/** Container of a set of affixes. * - * @author Ben Culkin - */ + * @author Ben Culkin */ public class AffixSet { private static class AffixComparator implements Comparator<Affix> { + @Override public int compare(Affix a1, Affix a2) { - if (a1.minLevel == a2.minLevel) { - return a1.maxLevel - a2.maxLevel; - } - - return a1.minLevel - a2.minLevel; + return a1.spawnRange.compareTo(a2.spawnRange); } } - /** - * All of the affix groups contained in this set. + /** All of the affix groups contained in this set. * * An affix group is a set of affixes that generally have the same or - * similar effects, but have different intensities or spawn levels. - */ - public Map<String, Set<Affix>> affixGroups; + * similar effects, but have different intensities or spawn levels. */ + public Map<AffixGroup, Set<Affix>> affixGroups; - /** - * All of the ungrouped affixes contained in this set. - */ + /** All of the ungrouped affixes contained in this set. */ public Set<Affix> ungroupedAffixes; - /** - * Create a new blank affix set. - */ + /** Create a new blank affix set. */ public AffixSet() { affixGroups = new TreeMap<>(); ungroupedAffixes = new TreeSet<>(new AffixComparator()); } - - /** - * Add an affix to this set. + + /** Add an affix to this set. * - * @param afx The affix to add. - */ + * @param afx The affix to add. */ public void addAffixByContents(Affix afx) { - String afxGroup = afx.getAffixGroupName(); - + AffixGroup group = afx.toAffixGroup(); + String afxGroup = group.toString(); + if (afxGroup.equals("")) { ungroupedAffixes.add(afx); } else { - affixGroups.compute(afxGroup, (key, val) -> { + affixGroups.compute(group, (key, val) -> { if (val == null) { Set<Affix> afxSet = new HashSet<>(); - afxSet.add(afx); - return afxSet; } else { val.add(afx); - return val; } }); |
