fixed # 补全部分卡牌

fixed # 修复部分已知BUG
This commit is contained in:
2026-10-04 19:32:38 +08:00
parent c448da39c2
commit 94a2a6724b
163 changed files with 14008 additions and 1537 deletions
+22 -18
View File
@@ -10,42 +10,46 @@ export function getBondDeck(definition) {
[...DEFAULT_BOND_DECK] : deck;
}
const emptyGrowth = () => Array.from({ length: 10 }, () => ({
maxHp: null,
hand: null,
draw: null,
handLimit: null,
energy: null,
skills: null,
// 当前关羽/张飞的可用基础配置;等级先只影响到场概率,数值曲线与新技能后续单独配置。
const baseGrowth = () => Array.from({ length: 10 }, () => ({
maxHp: 40,
hand: 4,
draw: 2,
handLimit: 5,
energy: 3,
skills: [],
}));
export const bondDefinitions = {
guanyu: {
name: "关羽", character: "guanyu", portrait: null,
deck: null, intents: null, growth: emptyGrowth(),
name: "关羽", character: "mengsan_guanyu_shuying",
portrait: "extension/术樱包/mengsan/assets/portraits/guanyu-portrait.jpg",
deck: null, intents: null, growth: baseGrowth(),
},
zhangfei: {
name: "张飞", character: "zhangfei", portrait: null,
deck: null, intents: null, growth: emptyGrowth(),
name: "张飞", character: "mengsan_zhangfei_shuying",
portrait: "extension/术樱包/mengsan/assets/portraits/zhangfei-portrait.jpg",
deck: null, intents: null, growth: baseGrowth(),
},
};
export function getBondCombat(id, level) {
const definition = bondDefinitions[id];
const definition = Object.hasOwn(bondDefinitions, id) ? bondDefinitions[id] : null;
if (!definition || !Number.isInteger(level) || level < 1 || level > 10) {
return null;
}
const stats = definition.growth[level - 1];
const unlocked = Array.isArray(definition.growth) ? Array.from(definition.growth.slice(0, level)) : [];
const stats = unlocked[level - 1];
if (!stats || !["maxHp", "hand", "draw", "handLimit", "energy"]
.every(key => Number.isInteger(stats[key]) && stats[key] >= 0)
.every(key => Number.isInteger(stats[key]) && stats[key] >= 0 && stats[key] <= 99)
|| stats.maxHp < 1 || stats.energy < 1
|| !Array.isArray(stats.skills)
|| !stats.skills.every(skill => typeof skill === "string" && skill)) {
|| unlocked.some(growth => !growth || !Array.isArray(growth.skills) ||
!growth.skills.every(skill => typeof skill === "string" && skill))) {
return null;
}
const skills = new Set();
for (const growth of definition.growth.slice(0, level)) {
for (const skill of growth.skills || []) skills.add(skill);
for (const growth of unlocked) {
for (const skill of growth.skills) skills.add(skill);
}
return {
id: `bond_${id}`, bondId: id, character: definition.character,