mirror of
https://github.com/Melledy/Nebula.git
synced 2025-12-17 14:54:46 +01:00
Implement potential selector in monoliths
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package emu.nebula.game.tower;
|
||||
|
||||
import emu.nebula.proto.PublicStarTower.StarTowerRoomCase;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -15,32 +17,59 @@ public class StarTowerCase {
|
||||
|
||||
// Extra data
|
||||
private int teamLevel;
|
||||
|
||||
private int subNoteSkillNum;
|
||||
|
||||
private int floorId;
|
||||
private int roomType;
|
||||
|
||||
// Select
|
||||
private int[] ids;
|
||||
// Selector
|
||||
private IntList ids;
|
||||
|
||||
public StarTowerCase(CaseType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void addId(int id) {
|
||||
if (this.ids == null) {
|
||||
this.ids = new IntArrayList();
|
||||
}
|
||||
|
||||
this.ids.add(id);
|
||||
}
|
||||
|
||||
public int selectId(int index) {
|
||||
if (this.getIds() == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (index < 0 || index >= this.getIds().size()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this.getIds().getInt(index);
|
||||
}
|
||||
|
||||
public StarTowerRoomCase toProto() {
|
||||
var proto = StarTowerRoomCase.newInstance()
|
||||
.setId(this.getId());
|
||||
|
||||
switch (this.type) {
|
||||
case Battle -> {
|
||||
proto.getMutableBattleCase();
|
||||
proto.getMutableBattleCase()
|
||||
.setSubNoteSkillNum(this.getSubNoteSkillNum());
|
||||
}
|
||||
case OpenDoor -> {
|
||||
proto.getMutableDoorCase();
|
||||
proto.getMutableDoorCase()
|
||||
.setFloor(this.getFloorId())
|
||||
.setType(this.getRoomType());
|
||||
}
|
||||
case SyncHP -> {
|
||||
case SyncHP, RecoveryHP -> {
|
||||
proto.getMutableSyncHPCase();
|
||||
}
|
||||
case SelectSpecialPotential -> {
|
||||
proto.getMutableSelectSpecialPotentialCase();
|
||||
proto.getMutableSelectSpecialPotentialCase()
|
||||
.setTeamLevel(this.getTeamLevel())
|
||||
.addAllIds(this.getIds().toIntArray());
|
||||
}
|
||||
case PotentialSelect -> {
|
||||
proto.getMutableSelectPotentialCase();
|
||||
|
||||
Reference in New Issue
Block a user