mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-16 23:34:50 +01:00
Basic path resonance implementation
This commit is contained in:
@@ -48,6 +48,7 @@ public class GameData {
|
|||||||
@Getter private static Int2ObjectMap<RogueRoomExcel> rogueRoomExcelMap = new Int2ObjectOpenHashMap<>();
|
@Getter private static Int2ObjectMap<RogueRoomExcel> rogueRoomExcelMap = new Int2ObjectOpenHashMap<>();
|
||||||
@Getter private static Int2ObjectMap<RogueMapExcel> rogueMapExcelMap = new Int2ObjectOpenHashMap<>();
|
@Getter private static Int2ObjectMap<RogueMapExcel> rogueMapExcelMap = new Int2ObjectOpenHashMap<>();
|
||||||
@Getter private static Int2ObjectMap<RogueMonsterExcel> rogueMonsterExcelMap = new Int2ObjectOpenHashMap<>();
|
@Getter private static Int2ObjectMap<RogueMonsterExcel> rogueMonsterExcelMap = new Int2ObjectOpenHashMap<>();
|
||||||
|
private static Int2ObjectMap<RogueBuffExcel> rogueBuffExcelMap = new Int2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
private static Int2ObjectMap<AvatarPromotionExcel> avatarPromotionExcelMap = new Int2ObjectOpenHashMap<>();
|
private static Int2ObjectMap<AvatarPromotionExcel> avatarPromotionExcelMap = new Int2ObjectOpenHashMap<>();
|
||||||
private static Int2ObjectMap<AvatarSkillTreeExcel> avatarSkillTreeExcelMap = new Int2ObjectOpenHashMap<>();
|
private static Int2ObjectMap<AvatarSkillTreeExcel> avatarSkillTreeExcelMap = new Int2ObjectOpenHashMap<>();
|
||||||
@@ -245,4 +246,8 @@ public class GameData {
|
|||||||
public static RogueMapExcel getRogueMapExcel(int rogueMapId, int siteId) {
|
public static RogueMapExcel getRogueMapExcel(int rogueMapId, int siteId) {
|
||||||
return rogueMapExcelMap.get((rogueMapId << 8) + siteId);
|
return rogueMapExcelMap.get((rogueMapId << 8) + siteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static RogueBuffExcel getRogueBuffExcel(int rogueBuffId, int level) {
|
||||||
|
return rogueBuffExcelMap.get((rogueBuffId << 4) + level);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ public class GameDepot {
|
|||||||
|
|
||||||
// Rogue
|
// Rogue
|
||||||
@Getter private static Int2ObjectMap<int[]> rogueMapGen = new Int2ObjectOpenHashMap<>();
|
@Getter private static Int2ObjectMap<int[]> rogueMapGen = new Int2ObjectOpenHashMap<>();
|
||||||
|
@Getter private static Int2ObjectMap<RogueBuffExcel> rogueAeonBuffs = new Int2ObjectOpenHashMap<>();
|
||||||
|
@Getter private static Int2ObjectMap<List<RogueBuffExcel>> rogueAeonEnhanceBuffs = new Int2ObjectOpenHashMap<>();
|
||||||
@Getter private static List<RogueBuffExcel> rogueRandomBuffList = new ArrayList<>();
|
@Getter private static List<RogueBuffExcel> rogueRandomBuffList = new ArrayList<>();
|
||||||
@Getter private static List<RogueMiracleExcel> rogueRandomMiracleList = new ArrayList<>();
|
@Getter private static List<RogueMiracleExcel> rogueRandomMiracleList = new ArrayList<>();
|
||||||
@Getter private static List<RogueNPCExcel> rogueRandomNpcList = new ArrayList<>();
|
@Getter private static List<RogueNPCExcel> rogueRandomNpcList = new ArrayList<>();
|
||||||
|
|||||||
@@ -1,29 +1,45 @@
|
|||||||
package emu.lunarcore.data.excel;
|
package emu.lunarcore.data.excel;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import emu.lunarcore.data.GameDepot;
|
import emu.lunarcore.data.GameDepot;
|
||||||
import emu.lunarcore.data.GameResource;
|
import emu.lunarcore.data.GameResource;
|
||||||
import emu.lunarcore.data.ResourceType;
|
import emu.lunarcore.data.ResourceType;
|
||||||
|
import emu.lunarcore.data.ResourceType.LoadPriority;
|
||||||
|
import emu.lunarcore.game.enums.RogueBuffAeonType;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@ResourceType(name = {"RogueBuff.json"})
|
@ResourceType(name = {"RogueBuff.json"}, loadPriority = LoadPriority.LOW)
|
||||||
public class RogueBuffExcel extends GameResource {
|
public class RogueBuffExcel extends GameResource {
|
||||||
private int MazeBuffID;
|
private int MazeBuffID;
|
||||||
private int MazeBuffLevel;
|
private int MazeBuffLevel;
|
||||||
private int RogueBuffType;
|
private int RogueBuffType;
|
||||||
private int RogueBuffRarity;
|
private int RogueBuffRarity;
|
||||||
private int AeonID;
|
private int AeonID;
|
||||||
|
private RogueBuffAeonType BattleEventBuffType = RogueBuffAeonType.Normal;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return MazeBuffID;
|
return (MazeBuffID << 4) + MazeBuffLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAeonBuff() {
|
||||||
|
return this.BattleEventBuffType != RogueBuffAeonType.Normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
|
// Add to random buff list
|
||||||
if (RogueBuffType >= 120 && RogueBuffType <= 126 && RogueBuffRarity >= 1 && RogueBuffRarity <= 3 && MazeBuffLevel == 1 && AeonID == 0) {
|
if (RogueBuffType >= 120 && RogueBuffType <= 126 && RogueBuffRarity >= 1 && RogueBuffRarity <= 3 && MazeBuffLevel == 1 && AeonID == 0) {
|
||||||
GameDepot.getRogueRandomBuffList().add(this);
|
GameDepot.getRogueRandomBuffList().add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add to aeon buff list
|
||||||
|
if (BattleEventBuffType == RogueBuffAeonType.BattleEventBuff) {
|
||||||
|
GameDepot.getRogueAeonBuffs().put(this.getAeonID(), this);
|
||||||
|
} else if (BattleEventBuffType == RogueBuffAeonType.BattleEventBuffEnhance) {
|
||||||
|
GameDepot.getRogueAeonEnhanceBuffs().computeIfAbsent(this.getAeonID(), e -> new ArrayList<>()).add(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package emu.lunarcore.game.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum RogueBuffAeonType {
|
||||||
|
Normal (0),
|
||||||
|
BattleEventBuff (1),
|
||||||
|
BattleEventBuffEnhance (2),
|
||||||
|
BattleEventBuffCross (3);
|
||||||
|
|
||||||
|
private final int val;
|
||||||
|
|
||||||
|
private RogueBuffAeonType(int value) {
|
||||||
|
this.val = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package emu.lunarcore.game.rogue;
|
package emu.lunarcore.game.rogue;
|
||||||
|
|
||||||
|
import emu.lunarcore.data.GameData;
|
||||||
|
import emu.lunarcore.data.excel.RogueBuffExcel;
|
||||||
import emu.lunarcore.game.battle.MazeBuff;
|
import emu.lunarcore.game.battle.MazeBuff;
|
||||||
import emu.lunarcore.proto.RogueBuffOuterClass.RogueBuff;
|
import emu.lunarcore.proto.RogueBuffOuterClass.RogueBuff;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -9,11 +11,21 @@ public class RogueBuffData {
|
|||||||
private int id;
|
private int id;
|
||||||
private int level;
|
private int level;
|
||||||
|
|
||||||
|
private transient RogueBuffExcel excel;
|
||||||
|
|
||||||
public RogueBuffData(int buffId, int level) {
|
public RogueBuffData(int buffId, int level) {
|
||||||
this.id = buffId;
|
this.id = buffId;
|
||||||
this.level = level;
|
this.level = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RogueBuffExcel getExcel() {
|
||||||
|
if (this.excel == null) {
|
||||||
|
this.excel = GameData.getRogueBuffExcel(this.getId(), this.getLevel());
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.excel;
|
||||||
|
}
|
||||||
|
|
||||||
public MazeBuff toMazeBuff() {
|
public MazeBuff toMazeBuff() {
|
||||||
return new MazeBuff(id, level, 0, 0xffffffff);
|
return new MazeBuff(id, level, 0, 0xffffffff);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,12 +25,20 @@ public class RogueBuffSelectMenu {
|
|||||||
public RogueBuffSelectMenu() {}
|
public RogueBuffSelectMenu() {}
|
||||||
|
|
||||||
public RogueBuffSelectMenu(RogueInstance rogue) {
|
public RogueBuffSelectMenu(RogueInstance rogue) {
|
||||||
|
this(rogue, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RogueBuffSelectMenu(RogueInstance rogue, boolean generateAeonBuffs) {
|
||||||
this.rogue = rogue;
|
this.rogue = rogue;
|
||||||
this.maxBuffs = 3;
|
this.maxBuffs = 3;
|
||||||
this.maxRerolls = rogue.getBaseRerolls();
|
this.maxRerolls = rogue.getBaseRerolls();
|
||||||
this.buffs = new ArrayList<>();
|
this.buffs = new ArrayList<>();
|
||||||
|
|
||||||
this.generateRandomBuffs();
|
if (generateAeonBuffs) {
|
||||||
|
this.generateAeonBuffs();
|
||||||
|
} else {
|
||||||
|
this.generateRandomBuffs();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMaxRerolls(int i) {
|
public void setMaxRerolls(int i) {
|
||||||
@@ -74,6 +82,26 @@ public class RogueBuffSelectMenu {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void generateAeonBuffs() {
|
||||||
|
this.getBuffs().clear();
|
||||||
|
|
||||||
|
var aeonBuffExcel = GameDepot.getRogueAeonBuffs().get(getRogue().getAeonId());
|
||||||
|
if (aeonBuffExcel == null) return;
|
||||||
|
|
||||||
|
// Check for rogue aeon buffs
|
||||||
|
if (!this.getRogue().getBuffs().containsKey(aeonBuffExcel.getMazeBuffID())) {
|
||||||
|
// We dont have the first aeon buff yet
|
||||||
|
this.getBuffs().add(new RogueBuffData(aeonBuffExcel.getMazeBuffID(), 1));
|
||||||
|
} else {
|
||||||
|
// Add path resonances that we currently dont have
|
||||||
|
for (var aeonEnhanceExcel : GameDepot.getRogueAeonEnhanceBuffs().get(getRogue().getAeonId())) {
|
||||||
|
if (!this.getRogue().getBuffs().containsKey(aeonEnhanceExcel.getMazeBuffID())) {
|
||||||
|
this.getBuffs().add(new RogueBuffData(aeonEnhanceExcel.getMazeBuffID(), 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void onLoad(RogueInstance rogue) {
|
protected void onLoad(RogueInstance rogue) {
|
||||||
this.rogue = rogue;
|
this.rogue = rogue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ public class RogueInstance {
|
|||||||
private int baseRerolls;
|
private int baseRerolls;
|
||||||
private int aeonId;
|
private int aeonId;
|
||||||
private int aeonBuffType;
|
private int aeonBuffType;
|
||||||
|
private int maxAeonBuffs;
|
||||||
private boolean isWin;
|
private boolean isWin;
|
||||||
|
|
||||||
@Deprecated // Morphia only!
|
@Deprecated // Morphia only!
|
||||||
@@ -66,6 +67,7 @@ public class RogueInstance {
|
|||||||
this.baseAvatarIds = new HashSet<>();
|
this.baseAvatarIds = new HashSet<>();
|
||||||
this.buffs = new HashMap<>();
|
this.buffs = new HashMap<>();
|
||||||
this.miracles = new HashMap<>();
|
this.miracles = new HashMap<>();
|
||||||
|
this.maxAeonBuffs = 4;
|
||||||
|
|
||||||
if (aeonExcel != null) {
|
if (aeonExcel != null) {
|
||||||
this.aeonId = aeonExcel.getAeonID();
|
this.aeonId = aeonExcel.getAeonID();
|
||||||
@@ -114,6 +116,42 @@ public class RogueInstance {
|
|||||||
return this.getRoomBySiteId(this.getCurrentSiteId());
|
return this.getRoomBySiteId(this.getCurrentSiteId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean shouldAddAeonBuff() {
|
||||||
|
int pathBuffs = 0; // Buffs on the current path
|
||||||
|
int aeonBuffs = 0;
|
||||||
|
|
||||||
|
for (var b : this.getBuffs().values()) {
|
||||||
|
var excel = b.getExcel();
|
||||||
|
if (excel == null) continue;
|
||||||
|
|
||||||
|
if (excel.getRogueBuffType() == this.getAeonBuffType()) {
|
||||||
|
if (excel.isAeonBuff()) {
|
||||||
|
aeonBuffs++;
|
||||||
|
} else {
|
||||||
|
pathBuffs++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip if we are already at max aeon buffs
|
||||||
|
if (aeonBuffs >= this.maxAeonBuffs) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (aeonBuffs) {
|
||||||
|
case 0:
|
||||||
|
return pathBuffs >= 3;
|
||||||
|
case 1:
|
||||||
|
return pathBuffs >= 6;
|
||||||
|
case 2:
|
||||||
|
return pathBuffs >= 10;
|
||||||
|
case 3:
|
||||||
|
return pathBuffs >= 14;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized void createBuffSelect(int amount) {
|
public synchronized void createBuffSelect(int amount) {
|
||||||
this.pendingBuffSelects += amount;
|
this.pendingBuffSelects += amount;
|
||||||
|
|
||||||
@@ -124,9 +162,19 @@ public class RogueInstance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public synchronized RogueBuffSelectMenu updateBuffSelect() {
|
public synchronized RogueBuffSelectMenu updateBuffSelect() {
|
||||||
if (this.pendingBuffSelects > 0 && this.getBuffSelect() == null) {
|
if (this.getBuffSelect() == null) {
|
||||||
this.buffSelect = new RogueBuffSelectMenu(this);
|
// Creates a new blessing selection menu if we have any pending buff selects
|
||||||
this.pendingBuffSelects--;
|
if (this.pendingBuffSelects > 0) {
|
||||||
|
// Regular blessing selection with 3 random blessings
|
||||||
|
this.buffSelect = new RogueBuffSelectMenu(this, false);
|
||||||
|
this.pendingBuffSelects--;
|
||||||
|
} else if (this.getAeonId() != 0) {
|
||||||
|
// Check if we should add aeon blessings
|
||||||
|
if (shouldAddAeonBuff()) {
|
||||||
|
this.buffSelect = new RogueBuffSelectMenu(this, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return this.buffSelect;
|
return this.buffSelect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,8 +191,10 @@ public class RogueInstance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public synchronized RogueBuffData selectBuff(int buffId) {
|
public synchronized RogueBuffData selectBuff(int buffId) {
|
||||||
|
// Sanity
|
||||||
if (this.getBuffSelect() == null) return null;
|
if (this.getBuffSelect() == null) return null;
|
||||||
|
|
||||||
|
// Validate buff from buff select menu
|
||||||
RogueBuffData buff = this.getBuffSelect().getBuffs()
|
RogueBuffData buff = this.getBuffSelect().getBuffs()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(b -> b.getId() == buffId)
|
.filter(b -> b.getId() == buffId)
|
||||||
@@ -153,6 +203,7 @@ public class RogueInstance {
|
|||||||
|
|
||||||
if (buff == null) return null;
|
if (buff == null) return null;
|
||||||
|
|
||||||
|
// Add buff
|
||||||
this.buffSelect = null;
|
this.buffSelect = null;
|
||||||
this.getBuffs().put(buff.getId(), buff);
|
this.getBuffs().put(buff.getId(), buff);
|
||||||
getPlayer().sendPacket(new PacketAddRogueBuffScNotify(buff, RogueBuffSource.ROGUE_BUFF_SOURCE_TYPE_SELECT));
|
getPlayer().sendPacket(new PacketAddRogueBuffScNotify(buff, RogueBuffSource.ROGUE_BUFF_SOURCE_TYPE_SELECT));
|
||||||
|
|||||||
Reference in New Issue
Block a user