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:
pan
2026-09-21 15:25:02 +08:00
parent 51256a2813
commit be6d941b90
5 changed files with 261 additions and 152 deletions

View File

@@ -15,9 +15,17 @@
<el-option v-for="n in 5" :key="n" :label="`Lv${n}`" :value="n" />
</el-select>
</el-form-item>
<el-form-item label="t_num (1=每次,3≈33%,4≈25%)">
<el-form-item label="t_num 次数阈值(1=每次)">
<el-input-number v-model="entry.t_num" :min="1" :controls="false" style="width: 100%" />
</el-form-item>
<template v-if="chanceVisible">
<el-form-item label="t_chance 触发概率%(空=100)">
<el-input-number v-model="entry.t_chance" :min="0" :max="100" :controls="false" style="width: 100%" placeholder="缺省必触发" />
</el-form-item>
<el-form-item label="pity_add 保底叠加%(空=0)">
<el-input-number v-model="entry.pity_add" :min="0" :max="100" :controls="false" style="width: 100%" placeholder="未触发时下次概率增量" />
</el-form-item>
</template>
<el-form-item label="组名(仅第1档)" v-if="idx === 0">
<el-input v-model="entry.name" />
</el-form-item>
@@ -42,18 +50,22 @@
</template>
<script setup>
import { ref } from 'vue'
import { computed, ref } from 'vue'
import OverrideEditor from './OverrideEditor.vue'
import { defaultTriggerEntry } from '../constants'
const props = defineProps({
model: { type: Object, required: true }, // TriggerGrouped
// 触发组 key(atking/atked/fstart/fend/dead),决定是否展示概率参数
group: { type: String, default: '' },
skillOptions: { type: Array, default: () => [] },
skillMap: { type: Object, default: () => ({}) },
// 全部 buff 候选(timed_buff_id 下拉用),由 App 透传
buffOptions: { type: Array, default: () => [] },
})
const newSid = ref(null)
// 概率参数仅攻/受击触发消费(fstart/fend/dead 固定触发)
const chanceVisible = computed(() => props.group === 'atking' || props.group === 'atked')
function skillName(sid) {
return props.skillMap[sid]?.name || ''