feat(skill): add trigger probability and pity system for attack/attacked triggers
1. 新增技能触发概率配置与保底叠加机制,仅对攻击/受击触发生效 2. 前端编辑器新增t_chance概率与pity_add保底增量配置项 3. 技能描述文案支持展示触发概率 4. 运行时新增概率判定与保底缓存逻辑,兼容存量配置
This commit is contained in:
@@ -81,11 +81,13 @@ const PLACEHOLDER_PATTERN = /\{(\w+)\}/g;
|
||||
* atking/atked 为周期循环触发(运行时按次数取模判定),拼为"每攻击N次"/"每受击N次"
|
||||
* 表达循环语义(N=1 时退化为"每次攻击"/"每次受击");其余类型直接用触发名(召唤/死亡后/回合开始)。
|
||||
*/
|
||||
function buildTriggerLabel(type: SkillTriggerType, tNum: number): string {
|
||||
function buildTriggerLabel(type: SkillTriggerType, tNum: number, chance?: number): string {
|
||||
if (type === SkillTriggerType.Atking || type === SkillTriggerType.Atked) {
|
||||
// 配置了 t_chance 且 < 100 时追加概率说明(保底叠加为隐藏机制,不在文案展示)
|
||||
const chanceSeg = chance !== undefined && chance < 100 ? `(${valueRich(Math.round(chance))}%概率)` : "";
|
||||
return tNum <= 1
|
||||
? `每次${SkillTriggerName[type]}`
|
||||
: `每${SkillTriggerName[type]}${valueRich(tNum)}次`;
|
||||
? `每次${SkillTriggerName[type]}${chanceSeg}`
|
||||
: `每${SkillTriggerName[type]}${valueRich(tNum)}次${chanceSeg}`;
|
||||
}
|
||||
return SkillTriggerName[type];
|
||||
}
|
||||
@@ -226,7 +228,7 @@ export function buildHeroSkillDesc(heroUuid: number, showName: boolean = true, s
|
||||
tmpl = tmpl ?? entries[0]?.desc;
|
||||
const text = tmpl ? renderDesc(tmpl, skill) : fallbackDesc(skill);
|
||||
// 触发语境:"每攻击N次"循环语义(buildTriggerLabel),逗号衔接效果文本
|
||||
const trig = buildTriggerLabel(type, item.t_num);
|
||||
const trig = buildTriggerLabel(type, item.t_num, item.t_chance);
|
||||
parts.push(`${trig}, ${text}`);
|
||||
}
|
||||
// dead 组内的复活效果(revive_hp / revive_count)并入同一行
|
||||
@@ -499,7 +501,7 @@ function collectTriggerTiers(hero: heroInfo, type: SkillTriggerType, skillUuid:
|
||||
tNum: e.t_num,
|
||||
};
|
||||
});
|
||||
const label = buildTriggerLabel(type, sorted[0].t_num);
|
||||
const label = buildTriggerLabel(type, sorted[0].t_num, sorted[0].t_chance);
|
||||
return { tiers, label };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user