diff --git a/src/main/java/emu/grasscutter/game/ability/Ability.java b/src/main/java/emu/grasscutter/game/ability/Ability.java index 71362afd9..d105f067e 100644 --- a/src/main/java/emu/grasscutter/game/ability/Ability.java +++ b/src/main/java/emu/grasscutter/game/ability/Ability.java @@ -55,21 +55,22 @@ public class Ability { // avatarSkillStartIds = new HashSet<>(); if (data.onAbilityStart != null) { - avatarSkillStartIds.addAll(Arrays.stream(data.onAbilityStart) - .filter(action -> - action.type == AbilityModifierAction.Type.AvatarSkillStart) - .map(action -> action.skillID) - .toList()); + avatarSkillStartIds.addAll( + Arrays.stream(data.onAbilityStart) + .filter(action -> action.type == AbilityModifierAction.Type.AvatarSkillStart) + .map(action -> action.skillID) + .toList()); } - avatarSkillStartIds.addAll(data.modifiers.values() - .stream() - .map(m -> (List)(m.onAdded == null ? - Collections.emptyList() : - Arrays.asList(m.onAdded))) - .flatMap(List::stream) - .filter(action -> action.type == AbilityModifierAction.Type.AvatarSkillStart) - .map(action -> action.skillID) - .toList()); + avatarSkillStartIds.addAll( + data.modifiers.values().stream() + .map( + m -> + (List) + (m.onAdded == null ? Collections.emptyList() : Arrays.asList(m.onAdded))) + .flatMap(List::stream) + .filter(action -> action.type == AbilityModifierAction.Type.AvatarSkillStart) + .map(action -> action.skillID) + .toList()); } public static String getAbilityName(AbilityString abString) { diff --git a/src/main/java/emu/grasscutter/game/ability/AbilityManager.java b/src/main/java/emu/grasscutter/game/ability/AbilityManager.java index ddc16a45a..1ac6177f5 100644 --- a/src/main/java/emu/grasscutter/game/ability/AbilityManager.java +++ b/src/main/java/emu/grasscutter/game/ability/AbilityManager.java @@ -85,16 +85,24 @@ public final class AbilityManager extends BasePlayerManager { boolean skillInvincibility = modifier.state == AbilityModifier.State.Invincible; if (modifier.onAdded != null) { - skillInvincibility |= Arrays.stream(modifier.onAdded) - .filter(action -> - action.type == AbilityModifierAction.Type.AttachAbilityStateResistance && - action.resistanceListID == 11002) - .toList().size() > 0; + skillInvincibility |= + Arrays.stream(modifier.onAdded) + .filter( + action -> + action.type == AbilityModifierAction.Type.AttachAbilityStateResistance + && action.resistanceListID == 11002) + .toList() + .size() + > 0; } - if (this.clearBurstEnergy != null && this.burstCasterId == entityId && - (ability.getAvatarSkillStartIds().contains(this.burstSkillId) || skillInvincibility)) { - Grasscutter.getLogger().trace("Caster ID's {} burst successful, clearing energy and setting invulnerability", entityId); + if (this.clearBurstEnergy != null + && this.burstCasterId == entityId + && (ability.getAvatarSkillStartIds().contains(this.burstSkillId) || skillInvincibility)) { + Grasscutter.getLogger() + .trace( + "Caster ID's {} burst successful, clearing energy and setting invulnerability", + entityId); this.abilityInvulnerable = true; this.clearBurstEnergy.accept(entityId); this.removePendingEnergyClear(); @@ -329,9 +337,11 @@ public final class AbilityManager extends BasePlayerManager { } // Track this elemental burst to possibly clear avatar energy later. - this.clearBurstEnergy = (ignored) -> - player.getEnergyManager().handleEvtDoSkillSuccNotify( - player.getSession(), skillId, casterId); + this.clearBurstEnergy = + (ignored) -> + player + .getEnergyManager() + .handleEvtDoSkillSuccNotify(player.getSession(), skillId, casterId); this.burstCasterId = casterId; this.burstSkillId = skillId; } diff --git a/src/main/java/emu/grasscutter/game/managers/energy/EnergyManager.java b/src/main/java/emu/grasscutter/game/managers/energy/EnergyManager.java index 18bc3ef91..8be641b19 100644 --- a/src/main/java/emu/grasscutter/game/managers/energy/EnergyManager.java +++ b/src/main/java/emu/grasscutter/game/managers/energy/EnergyManager.java @@ -265,8 +265,8 @@ public class EnergyManager extends BasePlayerManager { var skillData = GameData.getAvatarSkillDataMap().get(skillId); // If the cast skill was a burst, consume energy. - if ((avatar.getSkillDepot() != null && skillId == avatar.getSkillDepot().getEnergySkill()) || - (skillData != null && skillData.getCostElemVal() > 0)) { + if ((avatar.getSkillDepot() != null && skillId == avatar.getSkillDepot().getEnergySkill()) + || (skillData != null && skillData.getCostElemVal() > 0)) { avatar.getAsEntity().clearEnergy(ChangeEnergyReason.CHANGE_ENERGY_REASON_SKILL_START); } }