diff --git a/assets/script/game/common/config/HeroSkillDesc.ts b/assets/script/game/common/config/HeroSkillDesc.ts index 1b41689c..8039183f 100644 --- a/assets/script/game/common/config/HeroSkillDesc.ts +++ b/assets/script/game/common/config/HeroSkillDesc.ts @@ -10,7 +10,7 @@ * * 输出(双格式,供 UI 按需取用): * - buildSkillDesc(source) → 纯文本(Label 用),数值无颜色 - * - buildSkillDescRich(source) → 富文本(RichText 用,BBCode),数值用 高亮 + * - buildSkillDescRich(source) → 富文本(RichText 用,BBCode),技能名蓝色、数值绿色高亮 * 两者共用同一套结构化行构建逻辑,仅渲染阶段区分,保证纯/富文本内容严格一致。 * * 通用性(纯配置驱动): @@ -82,8 +82,14 @@ const ATTR_NAME: Partial> = { [Attrs.hp_max]: "最大生命", }; -/** 富文本数值高亮色(深绿色,与项目绿色系同源,深色面板上清晰可读) */ -const RICH_VALUE_COLOR = "#1E8449"; +/** 富文本数值高亮色(亮绿色,与项目绿色系同源,深色面板上清晰可读) */ +const RICH_VALUE_COLOR = "#27AE60"; + +/** 富文本技能名高亮色(蓝色,与数值绿色区分,标识技能名「」片段) */ +const RICH_NAME_COLOR = "#2E86C1"; + +/** 技能名「」匹配模式(仅本模块行首/行中技能名片段使用) */ +const SKILL_NAME_PATTERN = /「([^」]*)」/g; /** 解析目标描述文本(与战斗 SCastSystem 目标选取语义严格一致) */ function buildTargetDesc(skill: SkillConfig): string { @@ -308,14 +314,17 @@ export function buildSkillDesc(source: ISkillDescSource): string { } /** - * 富文本描述(RichText 用,BBCode):数值用 高亮。 + * 富文本描述(RichText 用,BBCode):技能名用 蓝色、数值用 亮绿色高亮。 * @param source 触发技能数据源(同 buildSkillDesc) - * @returns 多行富文本串,数值片段包裹 ,用 \n 分隔 + * @returns 多行富文本串,技能名片段包裹 、数值片段包裹 ,用 \n 分隔 */ export function buildSkillDescRich(source: ISkillDescSource): string { return buildSkillLines(source) - .map(l => l.value - ? `${l.prefix}${l.value}${l.suffix}` - : `${l.prefix}${l.suffix}`) + .map(l => { + const prefix = l.prefix.replace(SKILL_NAME_PATTERN, `「$1」`); + return l.value + ? `${prefix}${l.value}${l.suffix}` + : `${prefix}${l.suffix}`; + }) .join("\n"); }