refactor(skill): 重构大招CD配置体系,统一档位管理

1. 新增大招CD档位配置ULT_CDS/ULT_CD_MAP,与普攻档位分离
2. 为职业默认值添加大招CD档配置,支持按职业类型适配
3. 改造技能编辑器与英雄向导,支持选择大招CD档位
4. 批量更新现有英雄数据与配置文件,统一使用档位化CD配置
5. 补充文档说明,规范大招CD配置规则
This commit is contained in:
panFD
2026-09-14 23:00:06 +08:00
parent 8c8810bb7e
commit 93dc59a616
8 changed files with 187 additions and 118 deletions

View File

@@ -226,6 +226,7 @@ import { api } from './api'
import {
HERO_ROLES, GROW_TYPES, H_TYPES,
ROLE_ATK_SKILL, ROLE_ULT_SKILL, SUPPORT_ULT,
ROLE_DEFAULTS, ULT_CD_MAP,
defaultSkill,
} from './constants'
import SkillEditor from './components/SkillEditor.vue'
@@ -458,9 +459,10 @@ function addUltSkill() {
const first = ultSkillOptions.value[0]
if (!first) return ElMessage.warning('当前职业无可用大招底座')
const sk = defaultSkill(first.uuid)
// 大招提供 lv8(SkillLv.Lv2)/lv16(SkillLv.Lv3) 档位,不默认注入 summon_count
sk.cd = 8
sk.cdExpr = null
// 大招 CD 按职业默认档生成(UltCdSet 档位),提供 lv8(SkillLv.Lv2)/lv16(SkillLv.Lv3) 档位,不默认注入 summon_count
const ultCdConf = ULT_CD_MAP[ROLE_DEFAULTS[current.value.roleKey]?.ultCd] || ULT_CD_MAP.Normal
sk.cd = ultCdConf.cd
sk.cdExpr = ultCdConf.cdExpr
sk.overrides = {}
sk.lv_entries = [
{ lv: 8, s_lv: 2, overrides: {}, desc: '' },

View File

@@ -69,8 +69,13 @@
<el-option v-for="uuid in ultSkillOptions" :key="uuid" :label="`${uuid} ${skillName(uuid)}`" :value="uuid" />
</el-select>
</el-form-item>
<el-form-item label="大招CD档">
<el-select v-model="form.ultCd">
<el-option v-for="s in ULT_CDS" :key="s.key" :label="s.label" :value="s.key" />
</el-select>
</el-form-item>
</div>
<div class="muted" style="font-size: 11px">普攻自动按攻速档生成 cd/cdExpr + lv2 档(ap120);大招自动 cd:8 + lv8/lv16 档</div>
<div class="muted" style="font-size: 11px">普攻自动按攻速档生成 cd/cdExpr + lv2 档(ap120);大招自动按CD档生成 cd/cdExpr + lv8/lv16 档</div>
</div>
<div class="panel">
@@ -115,7 +120,7 @@
<script setup>
import { ref, computed } from 'vue'
import {
HERO_ROLES, H_TYPES, ATK_SPEEDS, ATK_SPEED_MAP,
HERO_ROLES, H_TYPES, ATK_SPEEDS, ATK_SPEED_MAP, ULT_CDS, ULT_CD_MAP,
ROLE_DEFAULTS, TRIGGER_GROUPS,
ROLE_ATK_SKILL, ROLE_ULT_SKILL, SUPPORT_ULT,
defaultHero,
@@ -141,6 +146,7 @@ function emptyForm() {
rarity: 4,
typeKey: 'Melee',
atkSpeed: 'Normal',
ultCd: 'Normal',
statBase: { hp: 0, ap: 0, def: 0 },
path: '',
atkUuid: null,
@@ -166,11 +172,12 @@ function presetTriggerLabel(p) {
function onRoleChange(roleKey) {
form.value.roleKey = roleKey
// 职业默认值:形态/攻速/稀有度/三维偏移(用户可微调)
// 职业默认值:形态/攻速/大招CD档/稀有度/三维偏移(用户可微调)
const d = ROLE_DEFAULTS[roleKey]
if (d) {
form.value.typeKey = d.typeKey
form.value.atkSpeed = d.atkSpeed
form.value.ultCd = d.ultCd || 'Normal'
form.value.rarity = d.rarity
form.value.statBase = { ...d.statBase }
}
@@ -209,12 +216,13 @@ function confirm() {
desc: '',
lv_entries: [{ lv: 2, s_lv: 2, overrides: { ap: 120 }, desc: '' }],
}
// 大招:cd:8 + lv8/lv16 档(对齐 addUltSkill 惯例)
// 大招:cd/cdExpr 按大招CD档生成;lv8/lv16 档(对齐 addUltSkill 惯例)
const ultCdConf = ULT_CD_MAP[f.ultCd] || ULT_CD_MAP.Normal
hero.skills[1] = {
uuid: f.ultUuid,
name: '',
cd: 8,
cdExpr: null,
cd: ultCdConf.cd,
cdExpr: ultCdConf.cdExpr,
overrides: {},
desc: '',
lv_entries: [

View File

@@ -12,9 +12,9 @@
<el-form-item label="显示名">
<el-input v-model="skill.name" placeholder="对外展示名(可选)" />
</el-form-item>
<el-form-item label="攻速档位">
<el-select v-model="cdSpeedKey" @change="onSpeedChange">
<el-option v-for="s in ATK_SPEEDS" :key="s.key" :label="s.label" :value="s.key" />
<el-form-item :label="isUlt ? '大招CD档位' : '攻速档位'">
<el-select v-model="cdTierKey" @change="onTierChange">
<el-option v-for="s in (isUlt ? ULT_CDS : ATK_SPEEDS)" :key="s.key" :label="s.label" :value="s.key" />
</el-select>
</el-form-item>
<el-form-item label="CD(秒)">
@@ -64,7 +64,7 @@
<script setup>
import { computed } from 'vue'
import { ATK_SPEEDS } from '../constants'
import { ATK_SPEEDS, ATK_SPEED_MAP, ULT_CDS, ULT_CD_MAP } from '../constants'
import OverrideEditor from './OverrideEditor.vue'
const props = defineProps({
@@ -89,27 +89,24 @@ if (props.basicLv2) {
}
}
const cdSpeedKey = refFromCd(props.skill)
function refFromCd(skill) {
// 简单映射回攻速档
return computed({
get() {
const found = ATK_SPEEDS.find((s) => Math.abs(cdOf(s.key) - skill.cd) < 0.001)
return found?.key || 'Normal'
},
set() {},
})
// 档位配置:大招(isUlt)走 UltCdSet 档(6~10s),普攻走 AtkSpeedSet 档(0.75~1.5s),两档数值不重叠可按 cd 反查
function tierConf(key) {
return (props.isUlt ? ULT_CD_MAP : ATK_SPEED_MAP)[key]
}
function cdOf(key) {
const map = { VeryFast: 0.75, Fast: 0.9, Normal: 1.05, Slow: 1.2, VerySlow: 1.5 }
return map[key] ?? 1.05
}
const cdTierKey = computed({
get() {
const list = props.isUlt ? ULT_CDS : ATK_SPEEDS
const found = list.find((s) => Math.abs(tierConf(s.key).cd - props.skill.cd) < 0.001)
return found?.key || 'Normal'
},
set() {},
})
function onSpeedChange(key) {
props.skill.cd = cdOf(key)
props.skill.cdExpr = `AtkSpeedSet[AtkSpeedLv.${key}].cd`
function onTierChange(key) {
const conf = tierConf(key)
props.skill.cd = conf.cd
props.skill.cdExpr = conf.cdExpr
}
function onCdManual() {
props.skill.cdExpr = null

View File

@@ -31,6 +31,15 @@ export const ATK_SPEEDS = [
{ key: 'VerySlow', label: '极慢(1.50s)', value: 5 },
]
// 大招 CD 档位(与 heroSet.ts UltCdSet 对齐):按技能效果类型分档交错释放节奏
export const ULT_CDS = [
{ key: 'VeryFast', label: '极频(6s) 单体爆发', value: 1 },
{ key: 'Fast', label: '高频(7s) 频繁压制', value: 2 },
{ key: 'Normal', label: '标准(8s) 群体伤害/控制', value: 3 },
{ key: 'Slow', label: '低频(9s) 中度团队增益', value: 4 },
{ key: 'VerySlow', label: '稀有(10s) 全体增益/治疗/护盾', value: 5 },
]
// 按职业映射普攻底座
export const ROLE_ATK_SKILL = {
Tank: [6004],
@@ -54,15 +63,15 @@ export const ROLE_ULT_SKILL = {
// 辅助类技能(任意职业可用作大招)
export const SUPPORT_ULT = [6301, 6302, 6407, 6412, 6413, 6414, 6415, 6416, 6501, 6514, 6515, 6516, 6517, 6518, 6519]
// 职业默认值(新建英雄向导用):形态/攻速/稀有度/三维偏移
// 职业默认值(新建英雄向导用):形态/攻速/大招CD档/稀有度/三维偏移
// 数值取自现有英雄样本中位数,向导内可手动微调
export const ROLE_DEFAULTS = {
Tank: { typeKey: 'Melee', atkSpeed: 'Slow', rarity: 4, statBase: { hp: 20, ap: 0, def: 10 } },
Warrior: { typeKey: 'Melee', atkSpeed: 'Slow', rarity: 4, statBase: { hp: 5, ap: 20, def: 5 } },
Assassin: { typeKey: 'Mid', atkSpeed: 'Fast', rarity: 4, statBase: { hp: 0, ap: 30, def: 0 } },
Archer: { typeKey: 'Long', atkSpeed: 'Normal', rarity: 4, statBase: { hp: 0, ap: 30, def: 0 } },
Mage: { typeKey: 'Long', atkSpeed: 'Slow', rarity: 4, statBase: { hp: -5, ap: 10, def: 0 } },
Support: { typeKey: 'Long', atkSpeed: 'Normal', rarity: 4, statBase: { hp: 10, ap: 20, def: 0 } },
Tank: { typeKey: 'Melee', atkSpeed: 'Slow', ultCd: 'VerySlow', rarity: 4, statBase: { hp: 20, ap: 0, def: 10 } },
Warrior: { typeKey: 'Melee', atkSpeed: 'Slow', ultCd: 'Normal', rarity: 4, statBase: { hp: 5, ap: 20, def: 5 } },
Assassin: { typeKey: 'Mid', atkSpeed: 'Fast', ultCd: 'VeryFast', rarity: 4, statBase: { hp: 0, ap: 30, def: 0 } },
Archer: { typeKey: 'Long', atkSpeed: 'Normal', ultCd: 'Normal', rarity: 4, statBase: { hp: 0, ap: 30, def: 0 } },
Mage: { typeKey: 'Long', atkSpeed: 'Slow', ultCd: 'Normal', rarity: 4, statBase: { hp: -5, ap: 10, def: 0 } },
Support: { typeKey: 'Long', atkSpeed: 'Normal', ultCd: 'VerySlow', rarity: 4, statBase: { hp: 10, ap: 20, def: 0 } },
}
// 攻速档 → cd 数值 / cdExpr 表达式 映射(向导生成普攻用)
@@ -74,6 +83,15 @@ export const ATK_SPEED_MAP = {
VerySlow: { cd: 1.5, cdExpr: 'AtkSpeedSet[AtkSpeedLv.VerySlow].cd' },
}
// 大招 CD 档 → cd 数值 / cdExpr 表达式 映射(向导/技能编辑器生成大招用,与 ULT_CDS 同源)
export const ULT_CD_MAP = {
VeryFast: { cd: 6, cdExpr: 'UltCdSet[UltCdLv.VeryFast].cd' },
Fast: { cd: 7, cdExpr: 'UltCdSet[UltCdLv.Fast].cd' },
Normal: { cd: 8, cdExpr: 'UltCdSet[UltCdLv.Normal].cd' },
Slow: { cd: 9, cdExpr: 'UltCdSet[UltCdLv.Slow].cd' },
VerySlow: { cd: 10, cdExpr: 'UltCdSet[UltCdLv.VerySlow].cd' },
}
// 触发组 key 列表(向导/模板管理共用)
export const TRIGGER_GROUPS = [
{ key: 'atking', label: 'atking 攻击后' },