refactor(config): 拆分英雄卡池到独立配置文件

将原CardPoolList中的英雄卡池逻辑迁移至heroSet.ts,统一管理英雄抽卡配置,简化主配置文件内容,同时更新MissionCardComp以使用新的英雄卡池数据源
This commit is contained in:
panFD
2026-08-23 18:03:44 +08:00
parent 0d7f53b463
commit fce401bcf9
3 changed files with 60 additions and 46 deletions

View File

@@ -91,44 +91,9 @@ export interface CardConfig {
target_hero_eid?: number;
}
/** 基础卡池(英雄、技能、功能) */
/** 基础卡池(技能、功能卡;英雄卡池已迁移至 heroSet.ts HeroCardPoolList */
export const CardPoolList: CardConfig[] = [];
// 动态生成英雄卡池:所有英雄统一生成 lv1 卡牌
function getHeroCost(cardLv: number): number {
if (cardLv === 1) return 5;
if (cardLv === 2) return 10;
return 15;
}
/**
* 英雄卡按 card_lv 分配抽取权重(几何递减,高等级越稀有)。
* 梯度lv1=40, lv2=25, lv3=15, lv4=8, lv5=3
*/
const HERO_WEIGHT_BY_LV: Record<number, number> = {
1: 40, 2: 25, 3: 15, 4: 8, 5: 3,
};
function getHeroWeight(cardLv: number): number {
return HERO_WEIGHT_BY_LV[cardLv] ?? HERO_WEIGHT_BY_LV[1];
}
HeroList.forEach(uuid => {
const hero = HeroInfo[uuid];
if (!hero) return;
CardPoolList.push({
uuid: hero.uuid,
type: CardType.Hero,
cost: getHeroCost(hero.card_lv ?? 1),
weight: getHeroWeight(hero.card_lv ?? 1),
card_lv: hero.card_lv ?? 1,
kind: CKind.Hero,
hero_lv: 1,
base_card_lv: hero.card_lv ?? 1,
});
});
export enum SpecialRefreshHeroType {
Any = 0,
Melee = 1,

View File

@@ -339,6 +339,19 @@ export interface HeroCardConfig {
base_card_lv?: number;
}
/**
* 英雄卡池条目(含费用和权重,用于 MissionCardComp 抽卡)
*/
export interface HeroCardPoolEntry {
uuid: number;
cost: number;
weight: number;
card_lv: number;
}
/** 英雄卡池:由 HeroList 动态生成(见文件末尾初始化代码) */
export const HeroCardPoolList: HeroCardPoolEntry[] = [];
/**
* 技能基础信息接口
*/
@@ -940,6 +953,41 @@ export const HeroComboSet: Record<number, HeroComboInfo> = {
/** 推荐阵容 id 列表(按品质/成型难度排序,供 UI 顺序展示) */
export const HeroComboList: number[] = [8001, 8002, 8003, 8004, 8005, 8006];
// ==================== 英雄卡池初始化(必须在 HeroList 定义之后执行) ====================
/**
* 英雄卡费用规则
* lv1=5, lv2=10, lv3+=15
*/
function getHeroCost(cardLv: number): number {
if (cardLv === 1) return 5;
if (cardLv === 2) return 10;
return 15;
}
/**
* 英雄卡按 card_lv 分配抽取权重(几何递减,高等级越稀有)
* 梯度lv1=40, lv2=25, lv3=15, lv4=8, lv5=3
*/
const HERO_WEIGHT_BY_LV: Record<number, number> = {
1: 40, 2: 25, 3: 15, 4: 8, 5: 3,
};
function getHeroWeight(cardLv: number): number {
return HERO_WEIGHT_BY_LV[cardLv] ?? HERO_WEIGHT_BY_LV[1];
}
// 动态生成英雄卡池:所有英雄统一生成 lv1 卡牌
HeroList.forEach(uuid => {
const hero = HeroInfo[uuid];
if (!hero) return;
HeroCardPoolList.push({
uuid: hero.uuid,
cost: getHeroCost(hero.card_lv ?? 1),
weight: getHeroWeight(hero.card_lv ?? 1),
card_lv: hero.card_lv ?? 1,
});
});
// ==================== 英雄强度评分公式 ====================
/** 英雄强度公式调参权重(可在编辑器或运行时热调)