Files
pixelheros/assets/script/game/common/config/heroSet.ts
panw 1589851592 feat(i18n): 扩展翻译函数支持参数替换并更新中文文本
- 修改 I18nString 类以支持参数替换,将阈值等动态值插入翻译文本
- 更新多个配置文件中的翻译调用,传入相应的参数值
- 修正中文语言文件中的导航栏标签文本
2026-04-29 10:39:54 +08:00

225 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.
import { v3 } from "cc"
import { BoxSet, FacSet } from "./GameSet"
import { oops } from "db://oops-framework/core/Oops"
class I18nString {
constructor(private key: string, private params?: any[]) {}
private getTranslated(): string {
let str = oops.language.getLangByID(this.key) || this.key;
if (this.params && this.params.length > 0) {
for (let i = 0; i < this.params.length; i++) {
str = str.replace(`{${i}}`, String(this.params[i]));
}
}
return str;
}
toString() { return this.getTranslated(); }
valueOf() { return this.getTranslated(); }
toJSON() { return this.getTranslated(); }
get length() { return this.toString().length; }
}
export const t = (key: string, ...params: any[]) => new I18nString(key, params) as unknown as string;
export enum HType {
Melee = 0,
Mid = 1,
Long = 2,
}
export const HTypeName ={
0:"近战",
1:"中程",
2:"远程",
}
export const HeroPos={
0:{pos:v3(-320,BoxSet.GAME_LINE,0)},
1:{pos:v3(0,BoxSet.GAME_LINE,0)},
2:{pos:v3(0,BoxSet.GAME_LINE,0)},
}
export const FormationPointX = {
[HType.Melee]: -20,
[HType.Mid]: 100,
[HType.Long]: 100,
} as const;
export const HeroDisVal: Record<HType.Melee | HType.Mid | HType.Long, number> = {
[HType.Melee]: 200,
[HType.Mid]: 400,
[HType.Long]: 660,
}
export const resolveFormationTargetX = (fac: FacSet, type: HType): number => {
const resolvedRangeType = type as HType.Melee | HType.Mid | HType.Long;
const side = fac === FacSet.MON ? 1 : -1;
return FormationPointX[resolvedRangeType] * side;
}
export enum MonStart {
SLINE_1=140, //上线y
SLINE_2=100, //下线y
SLINE_3=180, //下线y
SLINE_4=60, //y起始点
START_X=320, //x起始点
START_I=90, //x轴间隔
}
/**
* 英雄/怪物基础信息接口
*/
export interface heroInfo {
uuid: number; // 唯一标识英雄5000段,怪物5200段
name: string; // 显示名称
icon?: string; // 图标名称(对应美术资源名)
path: string; // 资源路径(对应美术资源名)
fac: FacSet; // 阵营FacSet.HERO 或 FacSet.MON
kind?: number; // 未使用
lv: number; // 英雄等级
cards_lv?: number; // 卡片等级
type: HType; // 攻击定位(近战/中程/远程)
hp: number; // 生命值上限
ap: number; // 攻击力
call?:number[]; // 召唤后触发的技能uuid列表
dead?:number[]; // 死亡后触发的技能uuid列表
fstart?:number[]; // 战斗开始时释放的技能uuid列表
fend?:number[]; // 战斗结束时释放的技能uuid列表
field?:number[]; // 驻场技能uuid列表英雄在场时对全局生效
atking?:{s_uuid:number, t_num:number}[]; // 普通攻击后触发的技能配置s_uuid: 技能id, t_num: 触发所需的普攻次数
atked?:{s_uuid:number, t_num:number}[]; // 受击后触发的技能配置s_uuid: 技能id, t_num: 触发所需的受击次数
revive?:{s_uuid:number,r_num:number,upr:number};
// dis: number; // 攻击距离(像素)
speed: number; // 移动速度(像素/秒)
skills: Record<number, HSkillInfo> ; // 携带技能ID列表
info: string; // 描述文案
}
/**
* 英雄/怪物基础信息接口
*/
export interface HSkillInfo {
uuid: number; // 唯一标识英雄5000段,怪物5200段
lv:number; // 技能等级
cd:number; // 技能cd
ccd:number; // 占位当前cd用于cd计时
}
/*
*=============英雄配置列表================
* 英雄规则设定
* 设定中的英雄都是1级,最高可以升级到3级不在列表内提现,升级在游戏内进行)
* skills[0]是普通攻击技能
* skills[1]是等级1时的技能,skills[2]是等级2时的技能,skills[3]是等级3时的技能,最多3级
*
* 属性基准(cards_lv:1,lv:1) SPEED:800,AP:30 | HP:300 | skills[0].cd=1
* 坦克(cards_lv:1,lv:1) SPEED:800,AP:25 | HP:450 | skills[0].cd=0.75
* 近战dps(cards_lv:1,lv:1) SPEED:800,AP:50 | HP:250 | skills[0].cd=1.1
* 远程dps(cards_lv:1,lv:1) SPEED:800,AP:60 | HP:150 | skills[0].cd=1.3
*远程法dps(cards_lv:1,lv:1) SPEED:800,AP:60 | HP:150 | skills[0].cd=1.4
* 远程辅助(cards_lv:1,lv:1) SPEED:800,AP:20 | HP:150 | skills[0].cd=1
*/
export const HeroInfo: Record<number, heroInfo> = {
// ========== 近战英雄 ==========
5001:{uuid:5001,name:t("hero_name_5001"),path:"hk1", fac:FacSet.HERO,cards_lv:1,lv:1,type:HType.Melee,hp:150,ap:25,speed:800,atking:[{s_uuid:6301,t_num:2}],
skills:{6001:{uuid:6001,lv:1,cd:1.5,ccd:0}},info:t("hero_info_5001")},
5002:{uuid:5002,name:t("hero_name_5002"),path:"hk3", fac:FacSet.HERO,cards_lv:3,lv:1,type:HType.Melee,hp:150,ap:75,speed:800,atked:[{s_uuid:6301,t_num:2}],
skills:{6001:{uuid:6001,lv:1,cd:1.5,ccd:0}},info:t("hero_info_5002")},
5003:{uuid:5003,name:t("hero_name_5003"),path:"hk4", fac:FacSet.HERO,cards_lv:2,lv:1,type:HType.Melee,hp:100,ap:100,speed:800,
skills:{6001:{uuid:6001,lv:1,cd:1.5,ccd:0}},info:t("hero_info_5003")},
5004:{uuid:5004,name:t("hero_name_5004"),path:"hc1", fac:FacSet.HERO,cards_lv:4,lv:1,type:HType.Melee,hp:100,ap:200,speed:800,
skills:{6001:{uuid:6001,lv:1,cd:0.7,ccd:0}},info:t("hero_info_5004")},
5005:{uuid:5005,name:t("hero_name_5005"),path:"hk2", fac:FacSet.HERO,cards_lv:4,lv:1,type:HType.Melee,hp:100,ap:200,speed:800,
skills:{6001:{uuid:6001,lv:1,cd:1.5,ccd:0}},info:t("hero_info_5005")},
// ========== 法师英雄 ==========
5101:{uuid:5101,name:t("hero_name_5101"),path:"hm2", fac:FacSet.HERO,cards_lv:1,lv:1,type:HType.Long,hp:50,ap:60,speed:800,revive:{s_uuid:6501,r_num:1,upr:0.5},
skills:{6201:{uuid:6007,lv:1,cd:1,ccd:0}},info:t("hero_info_5101")},
5102:{uuid:5102,name:t("hero_name_5102"),path:"hm1", fac:FacSet.HERO,cards_lv:2,lv:1,type:HType.Long,hp:30,ap:120,speed:800,
skills:{6203:{uuid:6002,lv:1,cd:1,ccd:0}},info:t("hero_info_5102")},
5103:{uuid:5103,name:t("hero_name_5103"),path:"hm9", fac:FacSet.HERO,cards_lv:3,lv:1,type:HType.Long,hp:45,ap:180,speed:800,
skills:{6201:{uuid:6002,lv:1,cd:1,ccd:0}},info:t("hero_info_5103")},
5104:{uuid:5104,name:t("hero_name_5104"),path:"hm4", fac:FacSet.HERO,cards_lv:4,lv:1,type:HType.Long,hp:60,ap:240,speed:800,
skills:{6201:{uuid:66002201,lv:1,cd:1,ccd:0}},info:t("hero_info_5104")},
5105:{uuid:5105,name:t("hero_name_5105"),path:"hm3", fac:FacSet.HERO,cards_lv:5,lv:1,type:HType.Long,hp:75,ap:300,speed:800,
skills:{6203:{uuid:6002,lv:1,cd:1,ccd:0}},info:t("hero_info_5105") },
// ========== 远程英雄 ==========
5201:{uuid:5201,name:t("hero_name_5201"),path:"ha1", fac:FacSet.HERO,cards_lv:1,lv:1,type:HType.Long,hp:15,ap:60,speed:800,
skills:{6101:{uuid:6005,lv:1,cd:0.9,ccd:0}},info:t("hero_info_5201")},
5202:{uuid:5202,name:t("hero_name_5202"),path:"ha2", fac:FacSet.HERO,cards_lv:3,lv:1,type:HType.Long,hp:45,ap:180,speed:800,
skills:{6011:{uuid:6005,lv:1,cd:0.9,ccd:0}},info:t("hero_info_5202")},
5203:{uuid:5203,name:t("hero_name_5203"),path:"ha3", fac:FacSet.HERO,cards_lv:3,lv:1,type:HType.Long,hp:45,ap:180,speed:800,
skills:{6011:{uuid:6005,lv:1,cd:0.9,ccd:0}},info:t("hero_info_5203")},
// ========== 腐竹英雄 ==========
5301:{uuid:5301,name:t("hero_name_5301"),path:"hh1", fac:FacSet.HERO,cards_lv:1,lv:1,type:HType.Long,hp:15,ap:20,speed:800,atking:[{s_uuid:6302,t_num:2}],
skills:{6202:{uuid:6004,lv:1,cd:1.2,ccd:0}},info:t("hero_info_5301") },
5302:{uuid:5302,name:t("hero_name_5302"),path:"hz1", fac:FacSet.HERO,cards_lv:2,lv:1,type:HType.Long,hp:30,ap:40,speed:800,atking:[{s_uuid:6304,t_num:2}],
skills:{6202:{uuid:6004,lv:1,cd:1.2,ccd:0}},info:t("hero_info_5302")},
5303:{uuid:5303,name:t("hero_name_5303"),path:"hm6", fac:FacSet.HERO,cards_lv:4,lv:1,type:HType.Long,hp:60,ap:80,speed:800,
skills:{6202:{uuid:6004,lv:1,cd:1.2,ccd:0}},info:t("hero_info_5303")},
5304:{uuid:5304,name:t("hero_name_5304"),path:"hm7", fac:FacSet.HERO,cards_lv:6,lv:1,type:HType.Long,hp:90,ap:120,speed:800,
skills:{6202:{uuid:6004,lv:1,cd:1.2,ccd:0}},info:t("hero_info_5304")},
/*
*=============怪物配置列表================
* 基础近战型(lv:1) SPEED:800 |AP:12 | HP:120 | skills[0].cd=0.65
* 重型坦克型(lv:1) SPEED:800 |AP:30 | HP:350 | skills[0].cd=2
* 远程dps(lv:1) SPEED:800 |AP:45 | HP:80 | skills[0].cd=1.5
* 远程辅助(lv:1) SPEED:800 |AP:20 | HP:80 | skills[0].cd=1
* 精英 (lv:1) SPEED:800 |AP:20 | HP:1500 | skills[0].cd=1
*/
//============== 兽人系列 ===============
// 近战型
6001:{uuid:6001,name:t("mon_name_6001"),path:"mo1", fac:FacSet.MON,cards_lv:1,lv:1,type:HType.Melee,hp:120,ap:12,speed:800,
skills:{6001:{uuid:6001,lv:1,cd:0.65,ccd:0}},info:""},
6002:{uuid:6002,name:t("mon_name_6002"),path:"mo3", fac:FacSet.MON,cards_lv:1,lv:1,type:HType.Melee,hp:120,ap:12,speed:800,
skills:{6001:{uuid:6001,lv:1,cd:0.65,ccd:0},6004:{uuid:6004,lv:1,cd:10,ccd:0}},info:""},
6003:{uuid:6003,name:t("mon_name_6003"),path:"mo4", fac:FacSet.MON,cards_lv:1,lv:1,type:HType.Melee,hp:350,ap:30,speed:800,
skills:{6001:{uuid:6001,lv:1,cd:2,ccd:0}},info:""},
// 4. 远程
6004:{uuid:6004,name:t("mon_name_6004"),path:"mo2", fac:FacSet.MON,cards_lv:1,lv:1,type:HType.Long,hp:80,ap:45,speed:800,
skills:{6001:{uuid:6101,lv:1,cd:1.5,ccd:0}},info:""},
6005:{uuid:6005,name:t("mon_name_6005"),path:"mo5", fac:FacSet.MON,cards_lv:1,lv:1,type:HType.Long,hp:80,ap:20,speed:800,
skills:{6001:{uuid:6203,lv:1,cd:1.5,ccd:0}},info:""},
// 6. 精英/BOSS型
6006:{uuid:6006,name:t("mon_name_6006"),path:"mo6", fac:FacSet.MON,cards_lv:1,lv:1,type:HType.Melee,hp:1500,ap:20,speed:800,
skills:{6002:{uuid:6002,lv:1,cd:2,ccd:0},6004:{uuid:6004,lv:1,cd:10,ccd:0}},info:""},
//============== 亡灵系列 ===============
// 近战型
6101:{uuid:6101,name:t("mon_name_6101"),path:"mud1", fac:FacSet.MON,cards_lv:1,lv:1,type:HType.Melee,hp:120,ap:12,speed:800,
skills:{6001:{uuid:6001,lv:1,cd:0.65,ccd:0}},info:""},
6103:{uuid:6103,name:t("mon_name_6103"),path:"mud3", fac:FacSet.MON,cards_lv:1,lv:1,type:HType.Melee,hp:120,ap:12,speed:800,
skills:{6001:{uuid:6001,lv:1,cd:0.65,ccd:0}},info:""},
// 4. 远程
6102:{uuid:6102,name:t("mon_name_6102"),path:"mud2", fac:FacSet.MON,cards_lv:1,lv:1,type:HType.Long,hp:80,ap:45,speed:800,
skills:{6001:{uuid:6101,lv:1,cd:1.5,ccd:0}},info:""},
// 6105:{uuid:6105,name:"兽人法师",path:"mud5", fac:FacSet.MON,cards_lv:1,lv:1,type:HType.Melee,hp:80,ap:20,speed:800,
// skills:{6001:{uuid:6001,lv:1,cd:1,ccd:0},6003:{uuid:6003,lv:1,cd:10,ccd:0}},info:""},
// 6. 精英/BOSS型
6104:{uuid:6104,name:t("mon_name_6104"),path:"mud4", fac:FacSet.MON,cards_lv:1,lv:1,type:HType.Long,hp:350,ap:30,speed:800,
skills:{6204:{uuid:6204,lv:1,cd:2,ccd:0},6206:{uuid:6206,lv:1,cd:10,ccd:0}},info:""},
6105:{uuid:6105,name:t("mon_name_6105"),path:"mud5", fac:FacSet.MON,cards_lv:1,lv:1,type:HType.Melee,hp:1500,ap:20,speed:800,
skills:{6002:{uuid:6002,lv:1,cd:2,ccd:0},6005:{uuid:6005,lv:1,cd:10,ccd:0}},info:""},
};
export const HeroList: number[] = [
5001, 5002, 5003, 5004, 5005,
5101, 5102, 5103, 5104, 5105,
5201, 5202, 5203,
5301, 5302, 5303, 5304
];