From c23b53ec53d76ef7529b4c4b2a83efb7d5d3694e Mon Sep 17 00:00:00 2001 From: floofymrow <124401935+ramen-cat-coder@users.noreply.github.com> Date: Tue, 16 Jun 2026 18:58:30 -0700 Subject: [PATCH 1/3] custom system --- battle/entity/Entity.java | 5 +++++ io/assets/Admin.java | 3 +++ io/assets/UpdateCheck.java | 27 +++++++++++++++++++++++ pack/Identifier.java | 1 + pack/PackData.java | 44 ++++++++++++++++++++++++++++++++++++++ pack/UserProfile.java | 8 ++++++- 6 files changed, 87 insertions(+), 1 deletion(-) diff --git a/battle/entity/Entity.java b/battle/entity/Entity.java index 087b34b4..cd30657f 100755 --- a/battle/entity/Entity.java +++ b/battle/entity/Entity.java @@ -21,9 +21,11 @@ import common.util.pack.EffAnim; import common.util.pack.EffAnim.*; import common.util.pack.Soul; +import common.util.stage.Music; import common.util.stage.StageLimit; import common.util.unit.Level; import common.util.unit.Trait; +import io.BCMusic; import java.util.*; @@ -1565,6 +1567,9 @@ public void altAbi(int alt) { public boolean damaged(AttackAb atk) { damageTaken += atk.atk; + BCMusic.setBCUSE(0); + System.out.println("Called"); + int dmg = getDamage(atk, atk.atk); boolean proc = true; diff --git a/io/assets/Admin.java b/io/assets/Admin.java index 070c4bb4..89ba7b47 100644 --- a/io/assets/Admin.java +++ b/io/assets/Admin.java @@ -89,6 +89,9 @@ public void initProfile() { UserProfile.getBCData().load((str) -> { }, (d) -> { }); + UserProfile.getBCUData().load((str) -> { + }, (d) -> { + }); BasisSet.read(); // UserProfile.loadPacks(); TODO } diff --git a/io/assets/UpdateCheck.java b/io/assets/UpdateCheck.java index 4884b6b4..6d7675ca 100644 --- a/io/assets/UpdateCheck.java +++ b/io/assets/UpdateCheck.java @@ -116,6 +116,7 @@ public static class AnnouncementJson { public ApkJson[] apk_update; public long text_update; public int music; + public int customMusic; } @@ -246,6 +247,32 @@ public static List checkNewMusic(int count) { return ans; } + public static List checkNewCustomMusic(int count) { + boolean[] exists = new boolean[count]; + File musicFolder = CommonStatic.ctx.getAssetFile("./music/"); + if (musicFolder.exists()) { + File[] musicList = musicFolder.listFiles(); + + if (musicList != null) { + for (File music : musicList) + if (music.getName().length() == 9 && music.getName().endsWith("_c.ogg")) { + int id = CommonStatic.parseIntN(music.getName()); + if (id < count && id != -1) // prevents array index out of bounds + exists[id] = true; + } + } + } + List ans = new ArrayList<>(); + for (int i = 0; i < count; i++) + if (!exists[i]) { + File target = CommonStatic.ctx.getAssetFile("./music/" + Data.trio(i) + ".ogg"); + File temp = CommonStatic.ctx.getAssetFile("./music/.ogg.temp"); + String url = URL_MUSIC + Data.trio(i) + "_c.ogg"; + ans.add(new Downloader(target, temp, "bcu custom music " + Data.trio(i), false, url)); + } + return ans; + } + public static Context.SupExc> checkMusic(int count) { return () -> { boolean[] exi = new boolean[count]; diff --git a/pack/Identifier.java b/pack/Identifier.java index 808d4b79..cdd12bd6 100644 --- a/pack/Identifier.java +++ b/pack/Identifier.java @@ -22,6 +22,7 @@ public class Identifier> implements Comparable>, Cloneable { public static final String DEF = "000000"; + public static final String BCU = "000001"; @Nullable public static > T get(Identifier id) { diff --git a/pack/PackData.java b/pack/PackData.java index 3e601b81..ae7a677d 100644 --- a/pack/PackData.java +++ b/pack/PackData.java @@ -276,6 +276,50 @@ private void loadUnits(Consumer bar) { } + public static class DefBcuPack extends PackData { + + public VFileRoot root = new VFileRoot("."); + + protected DefBcuPack() { + + } + + @Override + public String getSID() { + return Identifier.BCU; + } + + public void load(Consumer progress, Consumer bar) { + System.out.println("LOADING BCU DATA"); + progress.accept("loading BCU musics"); + loadMusic(); + } + + @Override + public String toString() { + return "Custom BCU Data"; + } + + private void loadMusic() { + File dict = CommonStatic.ctx.getAssetFile("./music/"); + if (!dict.exists()) + return; + File[] fs = dict.listFiles(); + for (File f : fs) { + String str = f.getName(); + if (str.length() != 9) + continue; + if (!str.endsWith("_c.ogg")) + continue; + int id = CommonStatic.parseIntN(str.substring(0, 3)); + if (id == -1) + continue; + System.out.println("Loaded " + str + " as custom"); + musics.set(id, new Music(new Identifier<>(Identifier.BCU, Music.class, id), 0, new FDFile(f))); + } + } + } + @JsonClass(noTag = NoTag.LOAD) public static class PackDesc { public String BCU_VERSION; diff --git a/pack/UserProfile.java b/pack/UserProfile.java index 4c190760..b8b64d42 100644 --- a/pack/UserProfile.java +++ b/pack/UserProfile.java @@ -71,11 +71,12 @@ public static List getAll(String pack, Class cls) { } /** - * get all packs, including default pack + * get all packs, including default and bcu pack */ public static Collection getAllPacks() { List ans = new ArrayList<>(); ans.add(getBCData()); + ans.add(getBCUData()); ans.addAll(getUserPacks()); return ans; } @@ -84,6 +85,10 @@ public static DefPack getBCData() { return profile().def; } + public static PackData.DefBcuPack getBCUData() { + return profile().defbcu; + } + /** * get a PackData from a String */ @@ -345,6 +350,7 @@ public static void unregister(String id) { } public final DefPack def = new DefPack(); + public final PackData.DefBcuPack defbcu = new PackData.DefBcuPack(); public final Map packmap = new HashMap<>(); public final Set packlist = new HashSet<>(); From f0a5280bfc093eee385575c30d27cbcd5496a0e1 Mon Sep 17 00:00:00 2001 From: floofymrow <124401935+ramen-cat-coder@users.noreply.github.com> Date: Tue, 16 Jun 2026 20:31:35 -0700 Subject: [PATCH 2/3] Fix a bug --- io/assets/UpdateCheck.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/io/assets/UpdateCheck.java b/io/assets/UpdateCheck.java index 6d7675ca..89f133da 100644 --- a/io/assets/UpdateCheck.java +++ b/io/assets/UpdateCheck.java @@ -265,10 +265,11 @@ public static List checkNewCustomMusic(int count) { List ans = new ArrayList<>(); for (int i = 0; i < count; i++) if (!exists[i]) { - File target = CommonStatic.ctx.getAssetFile("./music/" + Data.trio(i) + ".ogg"); - File temp = CommonStatic.ctx.getAssetFile("./music/.ogg.temp"); + File target = CommonStatic.ctx.getAssetFile("./music/" + Data.trio(i) + "_c.ogg"); + File temp = CommonStatic.ctx.getAssetFile("./music/_c.ogg.temp"); String url = URL_MUSIC + Data.trio(i) + "_c.ogg"; ans.add(new Downloader(target, temp, "bcu custom music " + Data.trio(i), false, url)); + System.out.println("bcu custom music " + Data.trio(i)); } return ans; } From e8a5df8a1798f1c1770b96623cc545f3fb6f6c3d Mon Sep 17 00:00:00 2001 From: floofymrow <124401935+ramen-cat-coder@users.noreply.github.com> Date: Tue, 16 Jun 2026 20:35:34 -0700 Subject: [PATCH 3/3] remove test code --- battle/entity/Entity.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/battle/entity/Entity.java b/battle/entity/Entity.java index cd30657f..0e693903 100755 --- a/battle/entity/Entity.java +++ b/battle/entity/Entity.java @@ -1567,9 +1567,6 @@ public void altAbi(int alt) { public boolean damaged(AttackAb atk) { damageTaken += atk.atk; - BCMusic.setBCUSE(0); - System.out.println("Called"); - int dmg = getDamage(atk, atk.atk); boolean proc = true;