Make MCSkill immutable with record
This commit is contained in:
@@ -1039,14 +1039,15 @@ public class StatEffect {
|
||||
if (skill != null) {
|
||||
final Disease dis = skill.getDisease();
|
||||
Party opposition = applyfrom.getParty().getEnemy();
|
||||
if (skill.targetsAll) {
|
||||
if (skill.targetsAll()) {
|
||||
for (PartyCharacter enemyChrs : opposition.getPartyMembers()) {
|
||||
Character chrApp = enemyChrs.getPlayer();
|
||||
if (chrApp != null && chrApp.getMap().isCPQMap()) {
|
||||
if (dis == null) {
|
||||
chrApp.dispel();
|
||||
} else {
|
||||
chrApp.giveDebuff(dis, MCSkill.getMobSkill(dis.getMobSkillType(), skill.level));
|
||||
MobSkill mobSkill = MobSkillFactory.getMobSkill(dis.getMobSkillType(), skill.level());
|
||||
chrApp.giveDebuff(dis, mobSkill);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1058,7 +1059,8 @@ public class StatEffect {
|
||||
if (dis == null) {
|
||||
chrApp.dispel();
|
||||
} else {
|
||||
chrApp.giveDebuff(dis, MCSkill.getMobSkill(dis.getMobSkillType(), skill.level));
|
||||
MobSkill mobSkill = MobSkillFactory.getMobSkill(dis.getMobSkillType(), skill.level());
|
||||
chrApp.giveDebuff(dis, mobSkill);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class MobSkillFactory {
|
||||
private static final Lock readLock = readWriteLock.readLock();
|
||||
private static final Lock writeLock = readWriteLock.writeLock();
|
||||
|
||||
public static MobSkill getMobSkill(final MobSkillType type, final int level) { // TODO: return Optional
|
||||
public static MobSkill getMobSkill(final MobSkillType type, final int level) {
|
||||
readLock.lock();
|
||||
try {
|
||||
MobSkill ms = mobSkills.get(createKey(type, level));
|
||||
|
||||
@@ -90,26 +90,9 @@ public class CarnivalFactory {
|
||||
return guardians.get(id);
|
||||
}
|
||||
|
||||
public static class MCSkill {
|
||||
|
||||
public int cpLoss;
|
||||
public MobSkillType mobSkillType;
|
||||
public int level;
|
||||
public boolean targetsAll;
|
||||
|
||||
public MCSkill(int _cpLoss, MobSkillType mobSkillType, int _level, boolean _targetsAll) {
|
||||
cpLoss = _cpLoss;
|
||||
mobSkillType = mobSkillType;
|
||||
level = _level;
|
||||
targetsAll = _targetsAll;
|
||||
}
|
||||
|
||||
public record MCSkill(int cpLoss, MobSkillType mobSkillType, int level, boolean targetsAll) {
|
||||
public MobSkill getSkill() {
|
||||
return getMobSkill(mobSkillType, level);
|
||||
}
|
||||
|
||||
public static MobSkill getMobSkill(MobSkillType type, int level) {
|
||||
return MobSkillFactory.getMobSkill(type, level);
|
||||
return MobSkillFactory.getMobSkill(mobSkillType, level);
|
||||
}
|
||||
|
||||
public Disease getDisease() {
|
||||
|
||||
Reference in New Issue
Block a user