Files
pixelheros/assets/script/game/common/config/EquipSet.ts
pan a46577fd45 fix: 统一调整UI文本样式与buff描述措辞
1. 修正多个prefab文件的文本控件尺寸、行高和字体大小,统一UI显示效果
2. 将所有英雄属性buff描述从"英雄XX"调整为"全体XX",匹配实际全局生效的效果
2026-08-03 15:13:32 +08:00

167 lines
11 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* @file EquipSet.ts
* @description 装备卡池独立配置
*
* 职责:
* 定义所有装备卡的静态数据与技能卡池CardSet.CardPoolList彻底分离。
* 装备卡不再参与抽卡,改为商店直购,任务开始时一次性全部展示。
*
* 装备生效机制:
* 购买 → 派发 GameEvent.UseEquipCard → MissEquipComp 接收 → EBox ECS 实体
* → EquipBoxComptrigger_type=Field被动驻场→ FieldSkillHelper 全局聚合属性加成
*
* 依赖:
* - CardConfig / CardTriggerType / CardType / CKindCardSet
* - SKILL_CARD_WAVESGameSet—— wave 档位定义
* - FieldSkillSetSkillSet—— 属性词条配置
*/
import { CardConfig, CardType, CKind, CardTriggerType } from "./CardSet";
import { SKILL_CARD_WAVES } from "./GameSet";
/** wave → card_lv 映射wave 1→lv1, wave 5→lv2, wave 8→lv3 */
const waveToCardLv: Record<number, number> = {};
SKILL_CARD_WAVES.forEach((w, i) => { waveToCardLv[w] = i + 1; });
/** 装备卡原始数据(仅装备相关字段,由 EquipSet 内部转换为 CardConfig */
interface EquipRawData {
uuid: number;
wave: number;
name: string;
info: string;
icon?: string; // 图标ID对应 ui6 图集 frame 名)
field: number[];
cost?: number;
}
/** 装备卡原始数据表 */
const EquipRawList: EquipRawData[] = [
// ==================== wave 1 档(基础强度) ====================
{ uuid: 8701, wave: SKILL_CARD_WAVES[0], icon: "Helmet-FA_Helmet_021_Gray", name: "战后恢复", info: "战斗结束生命回复量+10%", field: [7001] },
{ uuid: 8702, wave: SKILL_CARD_WAVES[0], icon: "Sword-FA_WP_Main_Sword_003_GrayGold", name: "攻击加成", info: "全体攻击力+10%", field: [7002] },
{ uuid: 8703, wave: SKILL_CARD_WAVES[0], icon: "Blunt-FA_WP_Main_Blunt_002_Wood", name: "击晕加成", info: "全体击晕概率+10%", field: [7003] },
{ uuid: 8704, wave: SKILL_CARD_WAVES[0], icon: "Axe-FA_WP_Main_Axe_001_WoodGray", name: "暴击加成", info: "全体暴击率+10%", field: [7004] },
{ uuid: 8705, wave: SKILL_CARD_WAVES[0], icon: "Bow-FA_WP_Main_Bow_003_WoodGreen", name: "暴伤加成", info: "全体暴击伤害+20%", field: [7005] },
{ uuid: 8706, wave: SKILL_CARD_WAVES[0], icon: "Crossbow-FA_WP_Main_Crossbow_001_WoodWhite", name: "攻速加成", info: "全体攻击速度+10%", field: [7006] },
{ uuid: 8707, wave: SKILL_CARD_WAVES[0], icon: "Chest-FA_Chest_014_Gray", name: "生命加成", info: "全体最大生命+10%", field: [7007] },
{ uuid: 8708, wave: SKILL_CARD_WAVES[0], icon: "Wand-FA_WP_Main_Wand_001_GrayGreen", name: "风怒加成", info: "全体风怒概率+10%", field: [7008] },
{ uuid: 8709, wave: SKILL_CARD_WAVES[0], icon: "Spear-FA_WP_Main_Spear_004_WoodBlue", name: "穿刺加成", info: "全体穿刺概率+10%", field: [7009] },
{ uuid: 8710, wave: SKILL_CARD_WAVES[0], icon: "Shield-FA_WP_Sub_Shield_007_GoldGray", name: "金币收益", info: "每回合金币收益+1", field: [7010] },
{ uuid: 8711, wave: SKILL_CARD_WAVES[0], icon: "Staff-FA_WP_Main_Staff_003_WoodSkyblue", name: "出售强化", info: "卖出英雄金币+1", field: [7011] },
// 多词条装备
{ uuid: 8720, wave: SKILL_CARD_WAVES[0], icon: "Shield-FA_WP_Sub_Shield_007_GoldGray", name: "勇者护符", info: "全体攻击力+10%, 暴击率+10%, 暴击伤害+20%", field: [7002, 7004, 7005] },
// ==================== wave 5 档(强度 ×2 ====================
{ uuid: 8751, wave: SKILL_CARD_WAVES[1], icon: "Helmet-FA_Helmet_022_DarkBlue", name: "战后恢复+", info: "战斗结束生命回复量+20%", field: [7201] },
{ uuid: 8752, wave: SKILL_CARD_WAVES[1], icon: "Sword-FA_WP_Main_Sword_007_Blue", name: "攻击加成+", info: "全体攻击力+20%", field: [7202] },
{ uuid: 8753, wave: SKILL_CARD_WAVES[1], icon: "Blunt-FA_WP_Main_Blunt_004_Gray", name: "击晕加成+", info: "全体击晕概率+20%", field: [7203] },
{ uuid: 8754, wave: SKILL_CARD_WAVES[1], icon: "Axe-FA_WP_Main_Axe_006_WoodBronze", name: "暴击加成+", info: "全体暴击率+20%", field: [7204] },
{ uuid: 8755, wave: SKILL_CARD_WAVES[1], icon: "Bow-FA_WP_Main_Bow_010_Blue", name: "暴伤加成+", info: "全体暴击伤害+40%", field: [7205] },
{ uuid: 8756, wave: SKILL_CARD_WAVES[1], icon: "Crossbow-FA_WP_Main_Crossbow_004_Gray", name: "攻速加成+", info: "全体攻击速度+20%", field: [7206] },
{ uuid: 8757, wave: SKILL_CARD_WAVES[1], icon: "Chest-FA_Chest_014_BlueGold", name: "生命加成+", info: "全体最大生命+20%", field: [7207] },
{ uuid: 8758, wave: SKILL_CARD_WAVES[1], icon: "Wand-FA_WP_Main_Wand_003_BlueWood", name: "风怒加成+", info: "全体风怒概率+20%", field: [7208] },
{ uuid: 8759, wave: SKILL_CARD_WAVES[1], icon: "Spear-FA_WP_Main_Spear_007_GraySkyblue", name: "穿刺加成+", info: "全体穿刺概率+20%", field: [7209] },
{ uuid: 8760, wave: SKILL_CARD_WAVES[1], icon: "Shield-FA_WP_Sub_Shield_008_BlueGold", name: "金币收益+", info: "每回合金币收益+2", field: [7210] },
{ uuid: 8761, wave: SKILL_CARD_WAVES[1], icon: "Shield-FA_WP_Sub_Shield_008_BlueGold", name: "购买优惠+", info: "购买卡牌费用-2金币", field: [7212] },
{ uuid: 8762, wave: SKILL_CARD_WAVES[1], icon: "Staff-FA_WP_Main_Staff_007_WoodGray", name: "刷新优惠", info: "刷新卡牌费用-1金币", field: [7213] },
// 多词条装备
{ uuid: 8770, wave: SKILL_CARD_WAVES[1], icon: "Chest-FA_Chest_014_BlueGold", name: "守卫护甲", info: "全体最大生命+20%, 战后生命回复+20%, 攻速+20%", field: [7207, 7201, 7206] },
// ==================== wave 8 档(强度 ×3 ====================
{ uuid: 8801, wave: SKILL_CARD_WAVES[2], icon: "Helmet-FA_Helmet_021_RedGold", name: "战后恢复++", info: "战斗结束生命回复量+30%", field: [7401] },
{ uuid: 8802, wave: SKILL_CARD_WAVES[2], icon: "Sword-FA_WP_Main_Sword_001_Gold", name: "攻击加成++", info: "全体攻击力+30%", field: [7402] },
{ uuid: 8803, wave: SKILL_CARD_WAVES[2], icon: "Blunt-FA_WP_Main_Blunt_006_OrangeGray", name: "击晕加成++", info: "全体击晕概率+30%", field: [7403] },
{ uuid: 8804, wave: SKILL_CARD_WAVES[2], icon: "Axe-FA_WP_Main_Axe_012_WoodGold", name: "暴击加成++", info: "全体暴击率+30%", field: [7404] },
{ uuid: 8805, wave: SKILL_CARD_WAVES[2], icon: "Bow-FA_WP_Main_Bow_010_Gold", name: "暴伤加成++", info: "全体暴击伤害+60%", field: [7405] },
{ uuid: 8806, wave: SKILL_CARD_WAVES[2], icon: "Crossbow-FA_WP_Main_Crossbow_005_WoodGold", name: "攻速加成++", info: "全体攻击速度+30%", field: [7406] },
{ uuid: 8807, wave: SKILL_CARD_WAVES[2], icon: "Chest-FA_Chest_015_RedGold", name: "生命加成++", info: "全体最大生命+30%", field: [7407] },
{ uuid: 8808, wave: SKILL_CARD_WAVES[2], icon: "Wand-FA_WP_Main_Wand_004_WoodGold", name: "风怒加成++", info: "全体风怒概率+30%", field: [7408] },
{ uuid: 8809, wave: SKILL_CARD_WAVES[2], icon: "Spear-FA_WP_Main_Spear_008_GrayGold", name: "穿刺加成++", info: "全体穿刺概率+30%", field: [7409] },
{ uuid: 8810, wave: SKILL_CARD_WAVES[2], icon: "Shield-FA_WP_Sub_Shield_009_RedGold", name: "金币收益++", info: "每回合金币收益+3", field: [7410] },
// 触发次数强化
{ uuid: 8811, wave: SKILL_CARD_WAVES[2], icon: "Wand-FA_WP_Main_Wand_004_WoodGold", name: "召唤强化++", info: "召唤触发技能次数+1", field: [7014] },
{ uuid: 8812, wave: SKILL_CARD_WAVES[2], icon: "Staff-FA_WP_Main_Staff_005_WoodGold", name: "死亡强化++", info: "死亡触发技能次数+1", field: [7015] },
{ uuid: 8813, wave: SKILL_CARD_WAVES[2], icon: "Spear-FA_WP_Main_Spear_008_GrayGold", name: "开场强化++", info: "战斗开始触发技能次数+1", field: [7016] },
{ uuid: 8814, wave: SKILL_CARD_WAVES[2], icon: "Blunt-FA_WP_Main_Blunt_006_OrangeGray", name: "结束强化++", info: "战斗结束触发技能次数+1", field: [7017] },
{ uuid: 8815, wave: SKILL_CARD_WAVES[2], icon: "Sword-FA_WP_Main_Sword_001_Gold", name: "攻击强化++", info: "攻击触发技能次数+1", field: [7018] },
{ uuid: 8816, wave: SKILL_CARD_WAVES[2], icon: "Shield-FA_WP_Sub_Shield_009_RedGold", name: "受击强化++", info: "被攻击触发技能次数+1", field: [7019] },
// 多词条装备
{ uuid: 8820, wave: SKILL_CARD_WAVES[2], icon: "Sword-FA_WP_Main_Sword_001_Gold", name: "神圣之刃", info: "全体攻击力+30%, 暴击率+30%, 暴击伤害+60%, 攻速+30%", field: [7402, 7404, 7405, 7406] },
];
/**
* 装备卡池列表(转换为 CardConfig 格式)
*
* 所有装备卡统一配置:
* - type: Skill复用卡牌体系
* - trigger_type: Field被动驻场
* - keep_waves: -1持续到战斗结束
* - is_inst: false不主动施法
* - cost: 由原始数据指定,默认 0
*/
export const EquipPoolList: CardConfig[] = EquipRawList.map(data => ({
uuid: data.uuid,
type: CardType.Skill,
cost: data.cost ?? 0,
weight: 10,
wave: data.wave,
kind: CKind.Skill,
card_lv: waveToCardLv[data.wave] ?? 1,
icon: data.icon,
name: data.name,
info: data.info,
is_inst: false,
t_times: 999,
t_inv: 0,
keep_waves: -1,
field: data.field,
trigger_type: CardTriggerType.Field,
}));
/**
* 按权重抽取 N 张装备卡unique 保证一次刷新内不重复,不足时允许重复补齐)。
* @param count 需要抽取的数量
*/
export function drawEquipCards(count: number): CardConfig[] {
const safeCount = Math.max(0, Math.floor(count));
if (EquipPoolList.length === 0 || safeCount <= 0) return [];
const picked: CardConfig[] = [];
let available = [...EquipPoolList];
while (picked.length < safeCount) {
if (available.length === 0) break;
const pick = weightedPick(available);
if (!pick) break;
picked.push(pick);
available = available.filter(c => c.uuid !== pick.uuid);
}
// 不足时允许重复补齐
const filled = [...picked];
while (filled.length < safeCount) {
const fallback = weightedPick(EquipPoolList);
if (!fallback) break;
filled.push(fallback);
}
return filled;
}
/** 单次按权重抽取一张卡 */
function weightedPick(cards: CardConfig[]): CardConfig | null {
if (cards.length === 0) return null;
const totalWeight = cards.reduce((total, card) => total + (card.weight ?? 0), 0);
let random = Math.random() * totalWeight;
for (const card of cards) {
random -= (card.weight ?? 0);
if (random <= 0) return card;
}
return cards[cards.length - 1];
}
/**
* 按 UUID 查找装备卡配置
* @param uuid 装备卡 UUID
*/
export function findEquipByUuid(uuid: number): CardConfig | undefined {
return EquipPoolList.find(e => e.uuid === uuid);
}