mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-23 10:44:36 +01:00
Force path resonance to always be at max energy when starting battle in SU
This commit is contained in:
@@ -24,7 +24,7 @@ public class GameData {
|
||||
@Getter private static Int2ObjectMap<EquipmentExcel> equipExcelMap = new Int2ObjectOpenHashMap<>();
|
||||
@Getter private static Int2ObjectMap<RelicExcel> relicExcelMap = new Int2ObjectOpenHashMap<>();
|
||||
@Getter private static Int2ObjectMap<PropExcel> propExcelMap = new Int2ObjectOpenHashMap<>();
|
||||
@Getter private static Int2ObjectMap<NpcExcel> npcExcelMap = new Int2ObjectOpenHashMap<>();
|
||||
@Getter private static Int2ObjectMap<BattleEventDataExcel> npcExcelMap = new Int2ObjectOpenHashMap<>();
|
||||
@Getter private static Int2ObjectMap<NpcMonsterExcel> npcMonsterExcelMap = new Int2ObjectOpenHashMap<>();
|
||||
@Getter private static Int2ObjectMap<StageExcel> stageExcelMap = new Int2ObjectOpenHashMap<>();
|
||||
@Getter private static Int2ObjectMap<MazePlaneExcel> mazePlaneExcelMap = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package emu.lunarcore.data.excel;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import emu.lunarcore.data.GameResource;
|
||||
import emu.lunarcore.data.ResourceType;
|
||||
import emu.lunarcore.game.rogue.RogueBuffType;
|
||||
import emu.lunarcore.util.Utils;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@ResourceType(name = {"BattleEventData.json"})
|
||||
public class BattleEventDataExcel extends GameResource {
|
||||
private int BattleEventID;
|
||||
private String Config;
|
||||
|
||||
private static final Pattern roguePattern = Pattern.compile("(?<=Avatar_RogueBattleevent)(.*?)(?=_Config.json)");
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return BattleEventID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
try {
|
||||
Matcher matcher = roguePattern.matcher(this.Config);
|
||||
|
||||
if (matcher.find()) {
|
||||
int rogueBuffType = Utils.parseSafeInt(matcher.group(0));
|
||||
var type = RogueBuffType.getById(rogueBuffType);
|
||||
|
||||
if (type != null) {
|
||||
type.setBattleEventSkill(this.BattleEventID);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,11 +13,12 @@ import emu.lunarcore.game.inventory.GameItem;
|
||||
import emu.lunarcore.game.player.Player;
|
||||
import emu.lunarcore.game.player.lineup.PlayerLineup;
|
||||
import emu.lunarcore.game.scene.entity.EntityMonster;
|
||||
import emu.lunarcore.proto.ClientTurnSnapshotOuterClass.ClientTurnSnapshot;
|
||||
import emu.lunarcore.proto.SceneBattleInfoOuterClass.SceneBattleInfo;
|
||||
import emu.lunarcore.proto.SceneMonsterOuterClass.SceneMonster;
|
||||
import emu.lunarcore.proto.SceneMonsterWaveOuterClass.SceneMonsterWave;
|
||||
import emu.lunarcore.util.Utils;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -33,6 +34,8 @@ public class Battle {
|
||||
private final List<GameItem> drops;
|
||||
private final long timestamp;
|
||||
|
||||
private IntList turnSnapshotList; // TODO maybe turn it into a map?
|
||||
|
||||
@Setter private int staminaCost;
|
||||
@Setter private int levelOverride;
|
||||
@Setter private int roundsLimit;
|
||||
@@ -58,6 +61,13 @@ public class Battle {
|
||||
this.stages.addAll(stages);
|
||||
}
|
||||
|
||||
public IntList getTurnSnapshotList() {
|
||||
if (this.turnSnapshotList == null) {
|
||||
this.turnSnapshotList = new IntArrayList();
|
||||
}
|
||||
return this.turnSnapshotList;
|
||||
}
|
||||
|
||||
public StageType getStageType() {
|
||||
StageExcel stage = this.getFirstStage();
|
||||
if (stage != null) {
|
||||
@@ -180,6 +190,21 @@ public class Battle {
|
||||
proto.addBuffList(buff.toProto());
|
||||
}
|
||||
|
||||
// Client turn snapshots
|
||||
if (this.turnSnapshotList != null) {
|
||||
for (int id : this.turnSnapshotList) {
|
||||
var snapshot = ClientTurnSnapshot.newInstance()
|
||||
.setBattleEventId(id);
|
||||
|
||||
// Temp solution
|
||||
snapshot.getMutableStatus().getMutableSpBar()
|
||||
.setCurSp(10000)
|
||||
.setMaxSp(10000);
|
||||
|
||||
proto.addTurnSnapshotList(snapshot);
|
||||
}
|
||||
}
|
||||
|
||||
return proto;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class RogueBuffData {
|
||||
}
|
||||
|
||||
public MazeBuff toMazeBuff() {
|
||||
return new MazeBuff(id, level, 0, 0xffffffff);
|
||||
return new MazeBuff(id, level, 0xffffffff, 0xffffffff);
|
||||
}
|
||||
|
||||
public RogueBuff toProto() {
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
package emu.lunarcore.game.rogue;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
public enum RogueBuffType {
|
||||
@@ -15,8 +20,19 @@ public enum RogueBuffType {
|
||||
Propagation (127);
|
||||
|
||||
private final int val;
|
||||
@Setter private int battleEventSkill;
|
||||
|
||||
private static final Int2ObjectMap<RogueBuffType> map = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
static {
|
||||
Arrays.stream(values()).forEach(type -> map.put(type.getVal(), type));
|
||||
}
|
||||
|
||||
private RogueBuffType(int val) {
|
||||
this.val = val;
|
||||
}
|
||||
|
||||
public static RogueBuffType getById(int id) {
|
||||
return map.get(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import emu.lunarcore.data.excel.RogueAeonExcel;
|
||||
import emu.lunarcore.data.excel.RogueAreaExcel;
|
||||
import emu.lunarcore.data.excel.RogueMapExcel;
|
||||
import emu.lunarcore.game.battle.Battle;
|
||||
import emu.lunarcore.game.enums.RogueBuffAeonType;
|
||||
import emu.lunarcore.game.player.Player;
|
||||
import emu.lunarcore.game.player.lineup.PlayerLineup;
|
||||
import emu.lunarcore.proto.AvatarTypeOuterClass.AvatarType;
|
||||
@@ -74,7 +75,7 @@ public class RogueInstance {
|
||||
|
||||
if (aeonExcel != null) {
|
||||
this.aeonId = aeonExcel.getAeonID();
|
||||
this.aeonBuffType = aeonExcel.getRogueBuffType();
|
||||
this.aeonBuffType = aeonExcel.getRogueBuffType();
|
||||
}
|
||||
|
||||
this.initRooms();
|
||||
@@ -300,7 +301,7 @@ public class RogueInstance {
|
||||
this.roomScore = this.getExcel().getScoreMap().get(completedRooms);
|
||||
this.earnedTalentCoin = this.roomScore / 10;
|
||||
|
||||
// Add
|
||||
// Add coins to player
|
||||
if (this.earnedTalentCoin > 0) {
|
||||
this.getPlayer().addTalentPoints(this.earnedTalentCoin);
|
||||
this.getPlayer().save();
|
||||
@@ -309,7 +310,7 @@ public class RogueInstance {
|
||||
|
||||
// Dialogue stuff
|
||||
|
||||
public void selectDialogue(int dialogueEventId) {
|
||||
public void onSelectDialogue(int dialogueEventId) {
|
||||
|
||||
}
|
||||
|
||||
@@ -318,7 +319,15 @@ public class RogueInstance {
|
||||
public synchronized void onBattleStart(Battle battle) {
|
||||
// Add rogue blessings as battle buffs
|
||||
for (var buff : this.getBuffs().values()) {
|
||||
// Convert blessing to battle buff
|
||||
battle.addBuff(buff.toMazeBuff());
|
||||
// Set battle buff energy to max
|
||||
if (buff.getExcel().getBattleEventBuffType() == RogueBuffAeonType.BattleEventBuff) {
|
||||
RogueBuffType type = RogueBuffType.getById(getAeonBuffType());
|
||||
if (type != null && type.getBattleEventSkill() != 0) {
|
||||
battle.getTurnSnapshotList().add(type.getBattleEventSkill());
|
||||
}
|
||||
}
|
||||
}
|
||||
// Set monster level for battle
|
||||
RogueMapExcel mapExcel = GameData.getRogueMapExcel(this.getExcel().getMapId(), this.getCurrentSiteId());
|
||||
|
||||
@@ -15,7 +15,7 @@ public class HandlerSelectRogueDialogueEventCsReq extends PacketHandler {
|
||||
var req = SelectRogueDialogueEventCsReq.parseFrom(data);
|
||||
|
||||
if (session.getPlayer().getRogueInstance() != null) {
|
||||
session.getPlayer().getRogueInstance().selectDialogue(req.getDialogueEventId());
|
||||
session.getPlayer().getRogueInstance().onSelectDialogue(req.getDialogueEventId());
|
||||
}
|
||||
|
||||
session.send(new PacketSelectRogueDialogueEventScRsp(req.getDialogueEventId()));
|
||||
|
||||
Reference in New Issue
Block a user