From 8a485bb6e64f9af3c42cc8f12397543bfc2d0575 Mon Sep 17 00:00:00 2001 From: walkpan Date: Sat, 23 May 2026 15:32:28 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=E8=8B=B1?= =?UTF-8?q?=E9=9B=84=E5=8D=A1=E6=B1=A0=E4=B8=BA=E5=8A=A8=E6=80=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新导入以包含HeroList,移除硬编码的英雄卡池条目,改为动态生成卡牌,适配英雄等级与卡池等级的计算规则,提升代码可维护性。 --- assets/script/game/common/config/CardSet.ts | 87 ++++++++++----------- 1 file changed, 40 insertions(+), 47 deletions(-) diff --git a/assets/script/game/common/config/CardSet.ts b/assets/script/game/common/config/CardSet.ts index 9b490ac5..ce9e3593 100644 --- a/assets/script/game/common/config/CardSet.ts +++ b/assets/script/game/common/config/CardSet.ts @@ -1,5 +1,5 @@ import * as exp from "constants" -import { HeroInfo, HType } from "./heroSet" +import { HeroInfo, HeroList, HType } from "./heroSet" import { FightSet } from "./GameSet" import { oops } from "db://oops-framework/core/Oops" @@ -81,51 +81,48 @@ export const CARD_POOL_MAX_LEVEL = CardLV.LV3 export const CARD_HERO_MAX_LEVEL = 1 /** 基础卡池(英雄、技能、功能) */ -export const CardPoolList: CardConfig[] = [ - { uuid: 5001, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5006, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5007, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5101, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5106, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5301, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5303, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, +export const CardPoolList: CardConfig[] = []; - { uuid: 5107, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 2, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5205, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 2, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5302, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 2, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5304, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 2, kind: CKind.Hero, hero_lv: 1 }, - - { uuid: 5002, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 3, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5008, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 3, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5009, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 3, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5108, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 3, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5305, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 3, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5403, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 3, kind: CKind.Hero, hero_lv: 1 }, - - - { uuid: 5001, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5002, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5003, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5004, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5005, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, - - { uuid: 5101, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5102, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5103, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5104, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5105, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, +// 动态生成英雄卡池 +HeroList.forEach(uuid => { + const hero = HeroInfo[uuid]; + if (!hero) return; - { uuid: 5201, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5202, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5203, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5204, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, - - { uuid: 5301, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5302, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, + const basePoolLv = hero.pool_lv || 1; + const baseHeroLv = hero.lv || 1; + const baseCost = 10; + const baseWeight = 25; - { uuid: 5401, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, - { uuid: 5402, type: CardType.Hero, cost: 10, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, + // 生成从 basePoolLv 到 CARD_POOL_MAX_LEVEL 的卡牌 + for (let pLv = basePoolLv; pLv <= CARD_POOL_MAX_LEVEL; pLv++) { + const offset = pLv - basePoolLv; + const targetHeroLv = baseHeroLv + offset; + + // 英雄的最高等级 是MERGE_MAX-1 + if (targetHeroLv > FightSet.MERGE_MAX - 1) { + break; + } + + // cost = 原始的cost*MERGE_NEED*hero_lv + let cost = baseCost; + if (targetHeroLv > 1) { + cost = baseCost * FightSet.MERGE_NEED * targetHeroLv; + } + + CardPoolList.push({ + uuid: hero.uuid, + type: CardType.Hero, + cost: cost, + weight: baseWeight, + pool_lv: pLv as CardLV, + kind: CKind.Hero, + hero_lv: targetHeroLv + }); + } +}); +// 添加非英雄卡牌 (技能、功能卡) +CardPoolList.push( // 技能卡牌 (以增益/辅助为主,因为在备战期没有敌人) { uuid: 6401, type: CardType.Skill, cost: 10, weight: 20, pool_lv: 1, kind: CKind.Skill, card_lv: 1, name: t("skill_name_6401"), info: t("skill_info_6401"), is_inst: true, t_times: 1, t_inv: 0 }, { uuid: 6402, type: CardType.Skill, cost: 10, weight: 20, pool_lv: 1, kind: CKind.Skill, card_lv: 1, name: t("skill_name_6402"), info: t("skill_info_6402"), is_inst: true, t_times: 1, t_inv: 0 }, @@ -135,11 +132,7 @@ export const CardPoolList: CardConfig[] = [ { uuid: 6406, type: CardType.Skill, cost: 10, weight: 20, pool_lv: 2, kind: CKind.Skill, card_lv: 1, name: t("skill_name_6406"), info: t("skill_info_6406"), is_inst: true, t_times: 1, t_inv: 0 }, { uuid: 6304, type: CardType.Skill, cost: 10, weight: 20, pool_lv: 3, kind: CKind.Skill, card_lv: 1, name: t("skill_name_6304"), info: t("skill_info_6304"), is_inst: true, t_times: 1, t_inv: 0 }, { uuid: 6305, type: CardType.Skill, cost: 10, weight: 20, pool_lv: 3, kind: CKind.Skill, card_lv: 1, name: t("skill_name_6305"), info: t("skill_info_6305"), is_inst: true, t_times: 1, t_inv: 0 }, - - // { uuid: 7101, type: CardType.SpecialRefresh, cost: 1, weight: 12, pool_lv: 1 ,kind: CKind.Card }, - // { uuid: 7102, type: CardType.SpecialRefresh, cost: 1, weight: 12, pool_lv: 1 ,kind: CKind.Card }, - // { uuid: 7103, type: CardType.SpecialRefresh, cost: 1, weight: 12, pool_lv: 1 ,kind: CKind.Card }, -] +); export enum SpecialRefreshHeroType {