mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-24 06:33:51 +08:00
Action id mapping fix
This commit is contained in:
parent
f389d2fb28
commit
c40213affc
@ -3,9 +3,10 @@ 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 java.util.Map;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@SuppressWarnings("ALL")
|
@SuppressWarnings("ALL")
|
||||||
public class AbilityLocalIdGenerator {
|
public class AbilityLocalIdGenerator {
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@ -29,10 +30,17 @@ public class AbilityLocalIdGenerator {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void initializeActionLocalIds(AbilityModifierAction actions[], Map<Integer, AbilityModifierAction> localIdToAction)
|
||||||
|
{
|
||||||
|
this.initializeActionLocalIds(actions, localIdToAction, false);
|
||||||
|
}
|
||||||
|
|
||||||
public void initializeActionLocalIds(
|
public void initializeActionLocalIds(
|
||||||
AbilityModifierAction[] actions, Map<Integer, AbilityModifierAction> localIdToAction) {
|
AbilityModifierAction[] actions,
|
||||||
|
Map<Integer, AbilityModifierAction> localIdToAction,
|
||||||
|
boolean preserveActionIndex) {
|
||||||
if (actions == null) return;
|
if (actions == null) return;
|
||||||
this.actionIndex = 0;
|
if (!preserveActionIndex) this.actionIndex = 0;
|
||||||
for (int i = 0; i < actions.length; i++) {
|
for (int i = 0; i < actions.length; i++) {
|
||||||
this.actionIndex++;
|
this.actionIndex++;
|
||||||
|
|
||||||
@ -40,17 +48,17 @@ public class AbilityLocalIdGenerator {
|
|||||||
localIdToAction.put((int) id, actions[i]);
|
localIdToAction.put((int) id, actions[i]);
|
||||||
|
|
||||||
if (actions[i].actions != null)
|
if (actions[i].actions != null)
|
||||||
this.initializeActionLocalIds(actions[i].actions, localIdToAction);
|
this.initializeActionLocalIds(actions[i].actions, localIdToAction, true);
|
||||||
else {
|
else {
|
||||||
if (actions[i].successActions != null)
|
if (actions[i].successActions != null)
|
||||||
this.initializeActionLocalIds(
|
this.initializeActionLocalIds(
|
||||||
actions[i].successActions, localIdToAction); // 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);
|
this.initializeActionLocalIds(actions[i].failActions, localIdToAction, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
actionIndex = 0;
|
if (!preserveActionIndex) actionIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initializeMixinsLocalIds(
|
public void initializeMixinsLocalIds(
|
||||||
|
Loading…
Reference in New Issue
Block a user