Add record MobSkillId for mob skill type + level combination

Pair is nasty to work with when they are passed around all over
This commit is contained in:
P0nk
2022-09-03 11:01:51 +02:00
parent 7a784a7938
commit 930d365752
8 changed files with 32 additions and 34 deletions

View File

@@ -41,7 +41,7 @@ public class MonsterStats {
public Map<Element, ElementalEffectiveness> resistance = new HashMap<>();
public List<Integer> revives = Collections.emptyList();
public byte tagColor, tagBgColor;
public List<Pair<Integer, Integer>> skills = new ArrayList<>();
public List<MobSkillId> skills = new ArrayList<>();
public Pair<Integer, Integer> cool = null;
public BanishInfo banish = null;
public List<loseItem> loseItem = null;
@@ -190,17 +190,16 @@ public class MonsterStats {
this.tagBgColor = (byte) tagBgColor;
}
public void setSkills(List<Pair<Integer, Integer>> skills) {
public void setSkills(List<MobSkillId> skills) {
for (int i = this.skills.size(); i < skills.size(); i++) {
this.skills.add(null);
}
for (int i = 0; i < skills.size(); i++) {
this.skills.set(i, skills.get(i));
}
}
public List<Pair<Integer, Integer>> getSkills() {
public List<MobSkillId> getSkills() {
return Collections.unmodifiableList(this.skills);
}
@@ -209,8 +208,8 @@ public class MonsterStats {
}
public boolean hasSkill(int skillId, int level) {
for (Pair<Integer, Integer> skill : skills) {
if (skill.getLeft() == skillId && skill.getRight() == level) {
for (MobSkillId skill : skills) {
if (skill.type().getId() == skillId && skill.level() == level) {
return true;
}
}