mirror of
https://github.com/Melledy/Nebula.git
synced 2025-12-23 17:54:36 +01:00
Implement proper melody drops in Monolith
This commit is contained in:
@@ -56,9 +56,6 @@ public class GameConstants {
|
|||||||
public static final int MAX_PENDING_FRIENDSHIPS = 30;
|
public static final int MAX_PENDING_FRIENDSHIPS = 30;
|
||||||
|
|
||||||
public static final int TOWER_COIN_ITEM_ID = 11;
|
public static final int TOWER_COIN_ITEM_ID = 11;
|
||||||
public static final int[] TOWER_COMMON_SUB_NOTE_SKILLS = new int[] {
|
|
||||||
90011, 90012, 90013, 90014, 90015, 90016, 90017
|
|
||||||
};
|
|
||||||
public static final int[] TOWER_EVENTS_IDS = new int[] {
|
public static final int[] TOWER_EVENTS_IDS = new int[] {
|
||||||
101, 102, 104, 105, 106, 107, 108, 114, 115, 116, 126, 127, 128
|
101, 102, 104, 105, 106, 107, 108, 114, 115, 116, 126, 127, 128
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import java.util.Arrays;
|
|||||||
|
|
||||||
import emu.nebula.data.BaseDef;
|
import emu.nebula.data.BaseDef;
|
||||||
import emu.nebula.data.ResourceType;
|
import emu.nebula.data.ResourceType;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -12,6 +13,7 @@ public class StarTowerDef extends BaseDef {
|
|||||||
private int Id;
|
private int Id;
|
||||||
private int GroupId;
|
private int GroupId;
|
||||||
private int Difficulty;
|
private int Difficulty;
|
||||||
|
private int SubNoteSkillDropGroupId;
|
||||||
private int[] FloorNum;
|
private int[] FloorNum;
|
||||||
|
|
||||||
private transient int maxFloors;
|
private transient int maxFloors;
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package emu.nebula.data.resources;
|
||||||
|
|
||||||
|
import emu.nebula.data.BaseDef;
|
||||||
|
import emu.nebula.data.ResourceType;
|
||||||
|
import emu.nebula.util.Utils;
|
||||||
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
|
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||||
|
import it.unimi.dsi.fastutil.ints.IntList;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@ResourceType(name = "SubNoteSkillDropGroup.json")
|
||||||
|
public class SubNoteSkillDropGroupDef extends BaseDef {
|
||||||
|
private int Id;
|
||||||
|
private int GroupId;
|
||||||
|
private int SubNoteSkillId;
|
||||||
|
|
||||||
|
private static Int2ObjectMap<IntList> GROUPS = new Int2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoad() {
|
||||||
|
var packageList = GROUPS.computeIfAbsent(this.GroupId, i -> new IntArrayList());
|
||||||
|
packageList.add(this.SubNoteSkillId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getRandomDrop(int groupId) {
|
||||||
|
var dropList = GROUPS.get(groupId);
|
||||||
|
|
||||||
|
if (dropList == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Utils.randomElement(dropList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IntList getGroup(int groupId) {
|
||||||
|
return GROUPS.get(groupId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,11 +5,11 @@ import java.util.List;
|
|||||||
|
|
||||||
import dev.morphia.annotations.Entity;
|
import dev.morphia.annotations.Entity;
|
||||||
|
|
||||||
import emu.nebula.GameConstants;
|
|
||||||
import emu.nebula.data.GameData;
|
import emu.nebula.data.GameData;
|
||||||
import emu.nebula.data.resources.SecondarySkillDef;
|
import emu.nebula.data.resources.SecondarySkillDef;
|
||||||
import emu.nebula.data.resources.StarTowerDef;
|
import emu.nebula.data.resources.StarTowerDef;
|
||||||
import emu.nebula.data.resources.StarTowerStageDef;
|
import emu.nebula.data.resources.StarTowerStageDef;
|
||||||
|
import emu.nebula.data.resources.SubNoteSkillDropGroupDef;
|
||||||
import emu.nebula.game.achievement.AchievementCondition;
|
import emu.nebula.game.achievement.AchievementCondition;
|
||||||
import emu.nebula.game.achievement.AchievementManager;
|
import emu.nebula.game.achievement.AchievementManager;
|
||||||
import emu.nebula.game.character.ElementType;
|
import emu.nebula.game.character.ElementType;
|
||||||
@@ -84,9 +84,6 @@ public class StarTowerGame {
|
|||||||
private ItemParamMap potentials;
|
private ItemParamMap potentials;
|
||||||
private IntSet secondarySkills;
|
private IntSet secondarySkills;
|
||||||
|
|
||||||
// Sub note skill drop list
|
|
||||||
private IntList subNoteDropList;
|
|
||||||
|
|
||||||
// Modifiers
|
// Modifiers
|
||||||
private StarTowerModifiers modifiers;
|
private StarTowerModifiers modifiers;
|
||||||
|
|
||||||
@@ -123,9 +120,6 @@ public class StarTowerGame {
|
|||||||
|
|
||||||
this.newInfos = new ItemParamMap();
|
this.newInfos = new ItemParamMap();
|
||||||
|
|
||||||
// Init melody drop list
|
|
||||||
this.subNoteDropList = new IntArrayList();
|
|
||||||
|
|
||||||
// Init modifiers
|
// Init modifiers
|
||||||
this.modifiers = new StarTowerModifiers(this);
|
this.modifiers = new StarTowerModifiers(this);
|
||||||
|
|
||||||
@@ -141,12 +135,6 @@ public class StarTowerGame {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add sub note skill id to drop list
|
|
||||||
int subNoteSkill = character.getData().getElementType().getSubNoteSkillItemId();
|
|
||||||
if (subNoteSkill > 0 && !this.subNoteDropList.contains(subNoteSkill)) {
|
|
||||||
this.subNoteDropList.add(subNoteSkill);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add to character list
|
// Add to character list
|
||||||
charList.add(id);
|
charList.add(id);
|
||||||
}
|
}
|
||||||
@@ -178,11 +166,6 @@ public class StarTowerGame {
|
|||||||
// Temp data to cache for rare potential count
|
// Temp data to cache for rare potential count
|
||||||
this.rarePotentialCount = new ItemParamMap();
|
this.rarePotentialCount = new ItemParamMap();
|
||||||
|
|
||||||
// Finish setting up droppable sub note skills
|
|
||||||
for (int id : GameConstants.TOWER_COMMON_SUB_NOTE_SKILLS) {
|
|
||||||
this.subNoteDropList.add(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enter first room
|
// Enter first room
|
||||||
this.enterNextRoom();
|
this.enterNextRoom();
|
||||||
this.getRoom().setMapInfo(req);
|
this.getRoom().setMapInfo(req);
|
||||||
@@ -784,7 +767,8 @@ public class StarTowerGame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getRandomSubNoteId() {
|
public int getRandomSubNoteId() {
|
||||||
return Utils.randomElement(this.getSubNoteDropList());
|
int groupId = this.getData().getSubNoteSkillDropGroupId();
|
||||||
|
return SubNoteSkillDropGroupDef.getRandomDrop(groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlayerChangeInfo addRandomSubNoteSkills(PlayerChangeInfo change) {
|
private PlayerChangeInfo addRandomSubNoteSkills(PlayerChangeInfo change) {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class StarTowerHawkerCase extends StarTowerBaseCase {
|
|||||||
}
|
}
|
||||||
for (int i = 0; i < subNotes; i++) {
|
for (int i = 0; i < subNotes; i++) {
|
||||||
// Randomize sub note
|
// Randomize sub note
|
||||||
int id = Utils.randomElement(this.getGame().getSubNoteDropList());
|
int id = this.getGame().getRandomSubNoteId();
|
||||||
|
|
||||||
// Create sub note shop item
|
// Create sub note shop item
|
||||||
StarTowerShopGoods goods = null;
|
StarTowerShopGoods goods = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user