mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-22 11:03:38 +00:00
Format code [skip actions]
This commit is contained in:
parent
d224178a64
commit
1fac319eb2
@ -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<AbilityModifierAction>)(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<AbilityModifierAction>)
|
||||
(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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user