feat(物品系统): 添加物品使用功能及相关配置

- 在GameEvent枚举中添加UseItemCard事件
- 创建ItemSet物品配置表,包含8种不同效果的物品
- 在HeroAttrsComp中添加物品使用逻辑,处理物品效果应用
- 修改MissionCardComp支持物品购买界面和购买逻辑
- 添加物品购买后的视觉反馈和状态管理
This commit is contained in:
panw
2026-01-05 09:54:58 +08:00
parent 08487cd944
commit e576d19255
4 changed files with 218 additions and 3 deletions

View File

@@ -48,6 +48,7 @@ export enum GameEvent {
FuncSelect = "FuncSelect",
TalentSelect = "TalentSelect",
UseTalentCard = "UseTalentCard",
UseItemCard = "UseItemCard",
NewWave = "NewWave",
AD_BACK_TRUE = "AD_BACK_TRUE",
AD_BACK_FALSE = "AD_BACK_FALSE",

View File

@@ -0,0 +1,105 @@
import { Attrs, BType } from "./HeroAttrs";
/**
* 物品配置接口
*/
export interface ItemConf {
id: number;
name: string;
desc: string;
price: number;
duration: number; // 持续时间(秒)
attr: Attrs; // 提升的属性
value: number; // 提升的值
bType: BType; // 值类型(数值/百分比)
}
/**
* 物品配置表
* 20秒强效果60秒弱效果
*/
export const ItemSet: Record<number, ItemConf> = {
// ==================== 20秒强效果 (价格: 100) ====================
1001: {
id: 1001,
name: "狂暴药水",
desc: "20秒内攻击力+50%",
price: 100,
duration: 20,
attr: Attrs.AP,
value: 50,
bType: BType.RATIO
},
1002: {
id: 1002,
name: "急速药水",
desc: "20秒内攻速+50%",
price: 100,
duration: 20,
attr: Attrs.AS,
value: 50,
bType: BType.RATIO
},
1003: {
id: 1003,
name: "金钟罩",
desc: "20秒内防御+50%",
price: 100,
duration: 20,
attr: Attrs.DEF,
value: 50,
bType: BType.RATIO
},
1004: {
id: 1004,
name: "神行药水",
desc: "20秒内移速+50%",
price: 100,
duration: 20,
attr: Attrs.SPEED,
value: 50,
bType: BType.RATIO
},
// ==================== 60秒弱效果 (价格: 50) ====================
2001: {
id: 2001,
name: "力量药剂",
desc: "60秒内攻击力+20%",
price: 50,
duration: 60,
attr: Attrs.AP,
value: 20,
bType: BType.RATIO
},
2002: {
id: 2002,
name: "敏捷药剂",
desc: "60秒内攻速+20%",
price: 50,
duration: 60,
attr: Attrs.AS,
value: 20,
bType: BType.RATIO
},
2003: {
id: 2003,
name: "护甲药剂",
desc: "60秒内防御+20%",
price: 50,
duration: 60,
attr: Attrs.DEF,
value: 20,
bType: BType.RATIO
},
2004: {
id: 2004,
name: "轻灵药剂",
desc: "60秒内移速+20%",
price: 50,
duration: 60,
attr: Attrs.SPEED,
value: 20,
bType: BType.RATIO
},
};