Format code [skip actions]

This commit is contained in:
github-actions 2023-06-04 21:57:29 +00:00
parent c40213affc
commit ddb76a0c2a
5 changed files with 21 additions and 17 deletions

View File

@ -3,9 +3,8 @@ package emu.grasscutter.data.binout;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import emu.grasscutter.data.common.DynamicFloat; import emu.grasscutter.data.common.DynamicFloat;
import emu.grasscutter.game.props.ElementType; import emu.grasscutter.game.props.ElementType;
import lombok.ToString;
import java.io.Serializable; import java.io.Serializable;
import lombok.ToString;
public class AbilityModifier implements Serializable { public class AbilityModifier implements Serializable {
private static final long serialVersionUID = -2001232313615923575L; private static final long serialVersionUID = -2001232313615923575L;

View File

@ -3,9 +3,8 @@ package emu.grasscutter.game.ability;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.binout.AbilityMixinData; import emu.grasscutter.data.binout.AbilityMixinData;
import emu.grasscutter.data.binout.AbilityModifier.AbilityModifierAction; import emu.grasscutter.data.binout.AbilityModifier.AbilityModifierAction;
import lombok.AllArgsConstructor;
import java.util.Map; import java.util.Map;
import lombok.AllArgsConstructor;
@SuppressWarnings("ALL") @SuppressWarnings("ALL")
public class AbilityLocalIdGenerator { public class AbilityLocalIdGenerator {
@ -30,8 +29,8 @@ public class AbilityLocalIdGenerator {
this.type = type; this.type = type;
} }
public void initializeActionLocalIds(AbilityModifierAction actions[], Map<Integer, AbilityModifierAction> localIdToAction) public void initializeActionLocalIds(
{ AbilityModifierAction actions[], Map<Integer, AbilityModifierAction> localIdToAction) {
this.initializeActionLocalIds(actions, localIdToAction, false); this.initializeActionLocalIds(actions, localIdToAction, false);
} }
@ -52,7 +51,9 @@ public class AbilityLocalIdGenerator {
else { else {
if (actions[i].successActions != null) if (actions[i].successActions != null)
this.initializeActionLocalIds( this.initializeActionLocalIds(
actions[i].successActions, localIdToAction, true); // Need to check this specific order actions[i].successActions,
localIdToAction,
true); // Need to check this specific order
if (actions[i].failActions != null) if (actions[i].failActions != null)
this.initializeActionLocalIds(actions[i].failActions, localIdToAction, true); this.initializeActionLocalIds(actions[i].failActions, localIdToAction, true);
} }

View File

@ -29,8 +29,8 @@ public final class ActionGenerateElemBall extends AbilityActionHandler {
return false; return false;
} }
//Check if we should allow elem ball generation // Check if we should allow elem ball generation
if(action.dropType == DropType.LevelControl) { if (action.dropType == DropType.LevelControl) {
String levelEntityConfig = owner.getScene().getSceneData().getLevelEntityConfig(); String levelEntityConfig = owner.getScene().getSceneData().getLevelEntityConfig();
ConfigLevelEntity config = GameData.getConfigLevelEntityDataMap().get(levelEntityConfig); ConfigLevelEntity config = GameData.getConfigLevelEntityDataMap().get(levelEntityConfig);
if (config != null if (config != null
@ -39,8 +39,8 @@ public final class ActionGenerateElemBall extends AbilityActionHandler {
Grasscutter.getLogger().warn("This level config don't allow element balls"); Grasscutter.getLogger().warn("This level config don't allow element balls");
return true; return true;
} }
} else if(action.dropType == DropType.BigWorldOnly) { } else if (action.dropType == DropType.BigWorldOnly) {
if(owner.getScene().getSceneData().getSceneType() != SceneType.SCENE_WORLD) { if (owner.getScene().getSceneData().getSceneType() != SceneType.SCENE_WORLD) {
Grasscutter.getLogger().warn("This level config only allows element balls on big world"); Grasscutter.getLogger().warn("This level config only allows element balls on big world");
return true; return true;
} }

View File

@ -2,7 +2,6 @@ package emu.grasscutter.game.ability.actions;
import com.google.protobuf.ByteString; import com.google.protobuf.ByteString;
import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.InvalidProtocolBufferException;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.binout.AbilityModifier.AbilityModifierAction; import emu.grasscutter.data.binout.AbilityModifier.AbilityModifierAction;
import emu.grasscutter.game.ability.Ability; import emu.grasscutter.game.ability.Ability;
@ -12,7 +11,8 @@ import emu.grasscutter.net.proto.AbilityActionSetRandomOverrideMapValueOuterClas
@AbilityAction(AbilityModifierAction.Type.SetRandomOverrideMapValue) @AbilityAction(AbilityModifierAction.Type.SetRandomOverrideMapValue)
public class ActionSetRandomOverrideMapValue extends AbilityActionHandler { public class ActionSetRandomOverrideMapValue extends AbilityActionHandler {
@Override @Override
public boolean execute(Ability ability, AbilityModifierAction action, ByteString abilityData, GameEntity target) { public boolean execute(
Ability ability, AbilityModifierAction action, ByteString abilityData, GameEntity target) {
AbilityActionSetRandomOverrideMapValue valueProto; AbilityActionSetRandomOverrideMapValue valueProto;
try { try {
valueProto = AbilityActionSetRandomOverrideMapValue.parseFrom(abilityData); valueProto = AbilityActionSetRandomOverrideMapValue.parseFrom(abilityData);
@ -24,8 +24,13 @@ public class ActionSetRandomOverrideMapValue extends AbilityActionHandler {
float valueRangeMin = action.valueRangeMin.get(ability); float valueRangeMin = action.valueRangeMin.get(ability);
float valueRangeMax = action.valueRangeMax.get(ability); float valueRangeMax = action.valueRangeMax.get(ability);
if(value < valueRangeMin || value > valueRangeMax) { if (value < valueRangeMin || value > valueRangeMax) {
Grasscutter.getLogger().warn("Tried setting value out of range: {} inside [{}, {}]", value, valueRangeMin, valueRangeMax); Grasscutter.getLogger()
.warn(
"Tried setting value out of range: {} inside [{}, {}]",
value,
valueRangeMin,
valueRangeMax);
return true; return true;
} }

View File

@ -7,11 +7,10 @@ import emu.grasscutter.data.common.DynamicFloat;
import emu.grasscutter.game.world.*; import emu.grasscutter.game.world.*;
import it.unimi.dsi.fastutil.floats.FloatArrayList; import it.unimi.dsi.fastutil.floats.FloatArrayList;
import it.unimi.dsi.fastutil.ints.*; import it.unimi.dsi.fastutil.ints.*;
import lombok.val;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.*; import java.util.*;
import lombok.val;
public interface JsonAdapters { public interface JsonAdapters {
class DynamicFloatAdapter extends TypeAdapter<DynamicFloat> { class DynamicFloatAdapter extends TypeAdapter<DynamicFloat> {