Files
pixelheros/assets/script/game/common/config/HighlightSet.ts
panw 0c6ed9159a refactor(i18n): 引入 I18nString 类优化多语言配置定义
将多个配置文件中的多语言字符串从 getter 函数改为使用 I18nString 类实例。
修改 CardSet、HighlightSet、heroSet 和 SkillSet 中的 name、info、title、desc 等字段,
统一使用 t(key) 返回的 I18nString 实例,简化配置对象结构并保持动态语言切换能力。
2026-04-29 09:55:28 +08:00

143 lines
7.9 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 HighlightSet.ts
* @description 亮点成就配置文件
*
* 定义所有亮点成就的等级、触发条件、加分以及称号描述。
* 每个亮点都包含5个递进等级奖励分随等级增加。
*/
import { oops } from "db://oops-framework/core/Oops"
class I18nString {
constructor(private key: string) {}
toString() { return oops.language.getLangByID(this.key) || this.key; }
valueOf() { return oops.language.getLangByID(this.key) || this.key; }
toJSON() { return oops.language.getLangByID(this.key) || this.key; }
get length() { return this.toString().length; }
}
const t = (key: string) => new I18nString(key) as unknown as string;
export enum HighlightType {
CritMaster = "CritMaster", // 暴击大师
DeathExpert = "DeathExpert", // 送死达人
IronWall = "IronWall", // 铁壁铜墙
WindStorm = "WindStorm", // 风暴之王
OneHitKill = "OneHitKill", // 一击必杀
HealingLight = "HealingLight", // 治愈之光
PerfectClear = "PerfectClear", // 完美通关 (特殊,只有一档或布尔判定)
LuckyKing = "LuckyKing", // 欧皇附体
ThriftyPlayer = "ThriftyPlayer" // 节俭玩家
}
export interface HighlightLevel {
level: number; // 成就等级 (1-5)
threshold: number; // 达成阈值 (如暴击40次)
scoreBonus: number; // 额外加分
title: string; // 成就称号
desc: string; // 成就描述模板
}
export interface HighlightConfig {
type: HighlightType;
icon: string; // 显示前缀icon如 "🔥"
levels: HighlightLevel[];
}
export const HighlightSet: Record<HighlightType, HighlightConfig> = {
[HighlightType.CritMaster]: {
type: HighlightType.CritMaster,
icon: "🔥",
levels: [
{ level: 1, threshold: 20, scoreBonus: 50, title: t("hl_title_CritMaster_1"), desc: t("hl_desc_CritMaster") },
{ level: 2, threshold: 40, scoreBonus: 100, title: t("hl_title_CritMaster_2"), desc: t("hl_desc_CritMaster") },
{ level: 3, threshold: 60, scoreBonus: 150, title: t("hl_title_CritMaster_3"), desc: t("hl_desc_CritMaster") },
{ level: 4, threshold: 80, scoreBonus: 200, title: t("hl_title_CritMaster_4"), desc: t("hl_desc_CritMaster") },
{ level: 5, threshold: 100, scoreBonus: 300, title: t("hl_title_CritMaster_5"), desc: t("hl_desc_CritMaster") },
]
},
[HighlightType.DeathExpert]: {
type: HighlightType.DeathExpert,
icon: "💀",
levels: [
{ level: 1, threshold: 15, scoreBonus: 50, title: t("hl_title_DeathExpert_1"), desc: t("hl_desc_DeathExpert") },
{ level: 2, threshold: 25, scoreBonus: 100, title: t("hl_title_DeathExpert_2"), desc: t("hl_desc_DeathExpert") },
{ level: 3, threshold: 40, scoreBonus: 150, title: t("hl_title_DeathExpert_3"), desc: t("hl_desc_DeathExpert") },
{ level: 4, threshold: 60, scoreBonus: 200, title: t("hl_title_DeathExpert_4"), desc: t("hl_desc_DeathExpert") },
{ level: 5, threshold: 80, scoreBonus: 300, title: t("hl_title_DeathExpert_5"), desc: t("hl_desc_DeathExpert") },
]
},
[HighlightType.IronWall]: {
type: HighlightType.IronWall,
icon: "🛡️",
levels: [
{ level: 1, threshold: 15, scoreBonus: 50, title: t("hl_title_IronWall_1"), desc: t("hl_desc_IronWall") },
{ level: 2, threshold: 30, scoreBonus: 100, title: t("hl_title_IronWall_2"), desc: t("hl_desc_IronWall") },
{ level: 3, threshold: 50, scoreBonus: 150, title: t("hl_title_IronWall_3"), desc: t("hl_desc_IronWall") },
{ level: 4, threshold: 70, scoreBonus: 200, title: t("hl_title_IronWall_4"), desc: t("hl_desc_IronWall") },
{ level: 5, threshold: 100, scoreBonus: 300, title: t("hl_title_IronWall_5"), desc: t("hl_desc_IronWall") },
]
},
[HighlightType.WindStorm]: {
type: HighlightType.WindStorm,
icon: "⚡",
levels: [
{ level: 1, threshold: 10, scoreBonus: 50, title: t("hl_title_WindStorm_1"), desc: t("hl_desc_WindStorm") },
{ level: 2, threshold: 20, scoreBonus: 100, title: t("hl_title_WindStorm_2"), desc: t("hl_desc_WindStorm") },
{ level: 3, threshold: 35, scoreBonus: 150, title: t("hl_title_WindStorm_3"), desc: t("hl_desc_WindStorm") },
{ level: 4, threshold: 50, scoreBonus: 200, title: t("hl_title_WindStorm_4"), desc: t("hl_desc_WindStorm") },
{ level: 5, threshold: 70, scoreBonus: 300, title: t("hl_title_WindStorm_5"), desc: t("hl_desc_WindStorm") },
]
},
[HighlightType.OneHitKill]: {
type: HighlightType.OneHitKill,
icon: "🎯",
levels: [
{ level: 1, threshold: 100, scoreBonus: 50, title: t("hl_title_OneHitKill_1"), desc: t("hl_desc_OneHitKill") },
{ level: 2, threshold: 200, scoreBonus: 100, title: t("hl_title_OneHitKill_2"), desc: t("hl_desc_OneHitKill") },
{ level: 3, threshold: 400, scoreBonus: 150, title: t("hl_title_OneHitKill_3"), desc: t("hl_desc_OneHitKill") },
{ level: 4, threshold: 800, scoreBonus: 200, title: t("hl_title_OneHitKill_4"), desc: t("hl_desc_OneHitKill") },
{ level: 5, threshold: 1500, scoreBonus: 300, title: t("hl_title_OneHitKill_5"), desc: t("hl_desc_OneHitKill") },
]
},
[HighlightType.HealingLight]: {
type: HighlightType.HealingLight,
icon: "💊",
levels: [
{ level: 1, threshold: 200, scoreBonus: 50, title: t("hl_title_HealingLight_1"), desc: t("hl_desc_HealingLight") },
{ level: 2, threshold: 500, scoreBonus: 100, title: t("hl_title_HealingLight_2"), desc: t("hl_desc_HealingLight") },
{ level: 3, threshold: 1000, scoreBonus: 150, title: t("hl_title_HealingLight_3"), desc: t("hl_desc_HealingLight") },
{ level: 4, threshold: 2000, scoreBonus: 200, title: t("hl_title_HealingLight_4"), desc: t("hl_desc_HealingLight") },
{ level: 5, threshold: 4000, scoreBonus: 300, title: t("hl_title_HealingLight_5"), desc: t("hl_desc_HealingLight") },
]
},
[HighlightType.PerfectClear]: {
type: HighlightType.PerfectClear,
icon: "🏆",
levels: [
{ level: 1, threshold: 1, scoreBonus: 500, title: t("hl_title_PerfectClear_1"), desc: t("hl_desc_PerfectClear") },
]
},
[HighlightType.LuckyKing]: {
type: HighlightType.LuckyKing,
icon: "🎲",
levels: [
{ level: 1, threshold: 0.6, scoreBonus: 50, title: t("hl_title_LuckyKing_1"), desc: t("hl_desc_LuckyKing") },
{ level: 2, threshold: 0.7, scoreBonus: 100, title: t("hl_title_LuckyKing_2"), desc: t("hl_desc_LuckyKing") },
{ level: 3, threshold: 0.8, scoreBonus: 150, title: t("hl_title_LuckyKing_3"), desc: t("hl_desc_LuckyKing") },
{ level: 4, threshold: 0.9, scoreBonus: 200, title: t("hl_title_LuckyKing_4"), desc: t("hl_desc_LuckyKing") },
{ level: 5, threshold: 1.0, scoreBonus: 300, title: t("hl_title_LuckyKing_5"), desc: t("hl_desc_LuckyKing") },
]
},
[HighlightType.ThriftyPlayer]: {
type: HighlightType.ThriftyPlayer,
icon: "💰",
levels: [
{ level: 1, threshold: 0.75, scoreBonus: 50, title: t("hl_title_ThriftyPlayer_1"), desc: t("hl_desc_ThriftyPlayer") },
{ level: 2, threshold: 0.85, scoreBonus: 100, title: t("hl_title_ThriftyPlayer_2"), desc: t("hl_desc_ThriftyPlayer") },
{ level: 3, threshold: 0.95, scoreBonus: 150, title: t("hl_title_ThriftyPlayer_3"), desc: t("hl_desc_ThriftyPlayer") },
{ level: 4, threshold: 0.98, scoreBonus: 200, title: t("hl_title_ThriftyPlayer_4"), desc: t("hl_desc_ThriftyPlayer") },
{ level: 5, threshold: 1.00, scoreBonus: 300, title: t("hl_title_ThriftyPlayer_5"), desc: t("hl_desc_ThriftyPlayer") },
]
}
};