Files
pixelheros/assets/script/game/common/config/TDLevelOptions.ts
walkpan 5e9494e4f8 refactor(战斗系统): 简化属性系统并移除魔法相关属性
移除魔法攻击(MAP)、魔法防御(MDEF)、元素抗性等冗余属性
将伤害减免统一由DEF属性处理,重命名CRITICAL_RESIST为CRITICAL_RES
更新相关技能、天赋和怪物配置以适应新的属性系统
删除未使用的职业成长系数配置和基础属性映射逻辑
2026-01-01 22:08:26 +08:00

216 lines
15 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.
import { Attrs } from "./HeroAttrs";
import { ItalConf, talConf } from "./TalSet";
export interface ITDLevelOption {
attr: Attrs;
value: number;
showValue: number;
weight: number;
desc: string;
isSpecial: boolean;
note?: string;
}
// 静态生成的 1-20 级强化池配置表
export const LEVEL_OPTIONS_TABLE: Record<number, ITDLevelOption[]> = {
1: [
{ attr: Attrs.AP, value: 15, showValue: 15, weight: 100, desc: "攻击力 +15", isSpecial: false, note: "常规强化" },
{ attr: Attrs.HP_MAX, value: 100, showValue: 100, weight: 100, desc: "生命上限 +100", isSpecial: false, note: "常规强化" },
{ attr: Attrs.DEF, value: 5, showValue: 5, weight: 100, desc: "防御力 +5", isSpecial: false, note: "常规强化" },
{ attr: Attrs.AS, value: 5, showValue: 5, weight: 100, desc: "攻击速度 +5%", isSpecial: false, note: "常规强化" },
],
2: [
{ attr: Attrs.AP, value: 16.5, showValue: 16.5, weight: 100, desc: "攻击力 +16.5", isSpecial: false, note: "常规强化" },
{ attr: Attrs.HP_MAX, value: 110, showValue: 110, weight: 100, desc: "生命上限 +110", isSpecial: false, note: "常规强化" },
{ attr: Attrs.DEF, value: 5.5, showValue: 5.5, weight: 100, desc: "防御力 +5.5", isSpecial: false, note: "常规强化" },
{ attr: Attrs.AS, value: 5.25, showValue: 5.25, weight: 100, desc: "攻击速度 +5.25%", isSpecial: false, note: "常规强化" },
],
3: [
{ attr: Attrs.PUNCTURE, value: 1, showValue: 1, weight: 50, desc: "穿透数量 +1", isSpecial: true, note: "上限5层" },
{ attr: Attrs.CRITICAL, value: 14, showValue: 14, weight: 50, desc: "暴击率 +14%", isSpecial: true, note: "上限70%" },
{ attr: Attrs.CRITICAL_DMG, value: 40, showValue: 40, weight: 50, desc: "暴击伤害 +40%", isSpecial: true, note: "上限200%" },
{ attr: Attrs.STUN_CHANCE, value: 10, showValue: 10, weight: 30, desc: "眩晕概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.FREEZE_CHANCE, value: 10, showValue: 10, weight: 30, desc: "冰冻概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.BURN_CHANCE, value: 10, showValue: 10, weight: 30, desc: "燃烧概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.BACK_CHANCE, value: 10, showValue: 10, weight: 30, desc: "击退概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.SLOW_CHANCE, value: 10, showValue: 10, weight: 30, desc: "减速概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.LIFESTEAL, value: 10, showValue: 10, weight: 30, desc: "吸血比例 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.MANASTEAL, value: 10, showValue: 10, weight: 30, desc: "吸蓝比例 +10%", isSpecial: true, note: "上限50%" },
],
4: [
{ attr: Attrs.AP, value: 19.5, showValue: 19.5, weight: 100, desc: "攻击力 +19.5", isSpecial: false, note: "常规强化" },
{ attr: Attrs.HP_MAX, value: 130, showValue: 130, weight: 100, desc: "生命上限 +130", isSpecial: false, note: "常规强化" },
{ attr: Attrs.DEF, value: 6.5, showValue: 6.5, weight: 100, desc: "防御力 +6.5", isSpecial: false, note: "常规强化" },
{ attr: Attrs.AS, value: 5.75, showValue: 5.75, weight: 100, desc: "攻击速度 +5.75%", isSpecial: false, note: "常规强化" },
],
5: [
// 无强化等级
],
6: [
{ attr: Attrs.PUNCTURE, value: 1, showValue: 1, weight: 50, desc: "穿透数量 +1", isSpecial: true, note: "上限5层" },
{ attr: Attrs.CRITICAL, value: 14, showValue: 14, weight: 50, desc: "暴击率 +14%", isSpecial: true, note: "上限70%" },
{ attr: Attrs.CRITICAL_DMG, value: 40, showValue: 40, weight: 50, desc: "暴击伤害 +40%", isSpecial: true, note: "上限200%" },
{ attr: Attrs.STUN_CHANCE, value: 10, showValue: 10, weight: 30, desc: "眩晕概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.FREEZE_CHANCE, value: 10, showValue: 10, weight: 30, desc: "冰冻概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.BURN_CHANCE, value: 10, showValue: 10, weight: 30, desc: "燃烧概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.BACK_CHANCE, value: 10, showValue: 10, weight: 30, desc: "击退概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.SLOW_CHANCE, value: 10, showValue: 10, weight: 30, desc: "减速概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.LIFESTEAL, value: 10, showValue: 10, weight: 30, desc: "吸血比例 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.MANASTEAL, value: 10, showValue: 10, weight: 30, desc: "吸蓝比例 +10%", isSpecial: true, note: "上限50%" },
],
7: [
{ attr: Attrs.AP, value: 24, showValue: 24, weight: 100, desc: "攻击力 +24", isSpecial: false, note: "常规强化" },
{ attr: Attrs.HP_MAX, value: 160, showValue: 160, weight: 100, desc: "生命上限 +160", isSpecial: false, note: "常规强化" },
{ attr: Attrs.DEF, value: 8, showValue: 8, weight: 100, desc: "防御力 +8", isSpecial: false, note: "常规强化" },
{ attr: Attrs.AS, value: 6.5, showValue: 6.5, weight: 100, desc: "攻击速度 +6.5%", isSpecial: false, note: "常规强化" },
],
8: [
{ attr: Attrs.AP, value: 25.5, showValue: 25.5, weight: 100, desc: "攻击力 +25.5", isSpecial: false, note: "常规强化" },
{ attr: Attrs.HP_MAX, value: 170, showValue: 170, weight: 100, desc: "生命上限 +170", isSpecial: false, note: "常规强化" },
{ attr: Attrs.DEF, value: 8.5, showValue: 8.5, weight: 100, desc: "防御力 +8.5", isSpecial: false, note: "常规强化" },
{ attr: Attrs.AS, value: 6.75, showValue: 6.75, weight: 100, desc: "攻击速度 +6.75%", isSpecial: false, note: "常规强化" },
],
9: [
{ attr: Attrs.PUNCTURE, value: 1, showValue: 1, weight: 50, desc: "穿透数量 +1", isSpecial: true, note: "上限5层" },
{ attr: Attrs.CRITICAL, value: 14, showValue: 14, weight: 50, desc: "暴击率 +14%", isSpecial: true, note: "上限70%" },
{ attr: Attrs.CRITICAL_DMG, value: 40, showValue: 40, weight: 50, desc: "暴击伤害 +40%", isSpecial: true, note: "上限200%" },
{ attr: Attrs.STUN_CHANCE, value: 10, showValue: 10, weight: 30, desc: "眩晕概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.FREEZE_CHANCE, value: 10, showValue: 10, weight: 30, desc: "冰冻概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.BURN_CHANCE, value: 10, showValue: 10, weight: 30, desc: "燃烧概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.BACK_CHANCE, value: 10, showValue: 10, weight: 30, desc: "击退概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.SLOW_CHANCE, value: 10, showValue: 10, weight: 30, desc: "减速概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.LIFESTEAL, value: 10, showValue: 10, weight: 30, desc: "吸血比例 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.MANASTEAL, value: 10, showValue: 10, weight: 30, desc: "吸蓝比例 +10%", isSpecial: true, note: "上限50%" },
],
10: [
// 无强化等级
],
11: [
{ attr: Attrs.AP, value: 30, showValue: 30, weight: 100, desc: "攻击力 +30", isSpecial: false, note: "常规强化" },
{ attr: Attrs.HP_MAX, value: 200, showValue: 200, weight: 100, desc: "生命上限 +200", isSpecial: false, note: "常规强化" },
{ attr: Attrs.DEF, value: 10, showValue: 10, weight: 100, desc: "防御力 +10", isSpecial: false, note: "常规强化" },
{ attr: Attrs.AS, value: 7.5, showValue: 7.5, weight: 100, desc: "攻击速度 +7.5%", isSpecial: false, note: "常规强化" },
],
12: [
{ attr: Attrs.PUNCTURE, value: 1, showValue: 1, weight: 50, desc: "穿透数量 +1", isSpecial: true, note: "上限5层" },
{ attr: Attrs.CRITICAL, value: 14, showValue: 14, weight: 50, desc: "暴击率 +14%", isSpecial: true, note: "上限70%" },
{ attr: Attrs.CRITICAL_DMG, value: 40, showValue: 40, weight: 50, desc: "暴击伤害 +40%", isSpecial: true, note: "上限200%" },
{ attr: Attrs.STUN_CHANCE, value: 10, showValue: 10, weight: 30, desc: "眩晕概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.FREEZE_CHANCE, value: 10, showValue: 10, weight: 30, desc: "冰冻概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.BURN_CHANCE, value: 10, showValue: 10, weight: 30, desc: "燃烧概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.BACK_CHANCE, value: 10, showValue: 10, weight: 30, desc: "击退概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.SLOW_CHANCE, value: 10, showValue: 10, weight: 30, desc: "减速概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.LIFESTEAL, value: 10, showValue: 10, weight: 30, desc: "吸血比例 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.MANASTEAL, value: 10, showValue: 10, weight: 30, desc: "吸蓝比例 +10%", isSpecial: true, note: "上限50%" },
],
13: [
{ attr: Attrs.AP, value: 33, showValue: 33, weight: 100, desc: "攻击力 +33", isSpecial: false, note: "常规强化" },
{ attr: Attrs.HP_MAX, value: 220, showValue: 220, weight: 100, desc: "生命上限 +220", isSpecial: false, note: "常规强化" },
{ attr: Attrs.DEF, value: 11, showValue: 11, weight: 100, desc: "防御力 +11", isSpecial: false, note: "常规强化" },
{ attr: Attrs.AS, value: 8, showValue: 8, weight: 100, desc: "攻击速度 +8%", isSpecial: false, note: "常规强化" },
],
14: [
{ attr: Attrs.AP, value: 34.5, showValue: 34.5, weight: 100, desc: "攻击力 +34.5", isSpecial: false, note: "常规强化" },
{ attr: Attrs.HP_MAX, value: 230, showValue: 230, weight: 100, desc: "生命上限 +230", isSpecial: false, note: "常规强化" },
{ attr: Attrs.DEF, value: 11.5, showValue: 11.5, weight: 100, desc: "防御力 +11.5", isSpecial: false, note: "常规强化" },
{ attr: Attrs.AS, value: 8.25, showValue: 8.25, weight: 100, desc: "攻击速度 +8.25%", isSpecial: false, note: "常规强化" },
],
15: [
// 无强化等级
],
16: [
{ attr: Attrs.AP, value: 37.5, showValue: 37.5, weight: 100, desc: "攻击力 +37.5", isSpecial: false, note: "常规强化" },
{ attr: Attrs.HP_MAX, value: 250, showValue: 250, weight: 100, desc: "生命上限 +250", isSpecial: false, note: "常规强化" },
{ attr: Attrs.DEF, value: 12.5, showValue: 12.5, weight: 100, desc: "防御力 +12.5", isSpecial: false, note: "常规强化" },
{ attr: Attrs.AS, value: 8.75, showValue: 8.75, weight: 100, desc: "攻击速度 +8.75%", isSpecial: false, note: "常规强化" },
],
17: [
{ attr: Attrs.AP, value: 39, showValue: 39, weight: 100, desc: "攻击力 +39", isSpecial: false, note: "常规强化" },
{ attr: Attrs.HP_MAX, value: 260, showValue: 260, weight: 100, desc: "生命上限 +260", isSpecial: false, note: "常规强化" },
{ attr: Attrs.DEF, value: 13, showValue: 13, weight: 100, desc: "防御力 +13", isSpecial: false, note: "常规强化" },
{ attr: Attrs.AS, value: 9, showValue: 9, weight: 100, desc: "攻击速度 +9%", isSpecial: false, note: "常规强化" },
],
18: [
{ attr: Attrs.PUNCTURE, value: 1, showValue: 1, weight: 50, desc: "穿透数量 +1", isSpecial: true, note: "上限5层" },
{ attr: Attrs.CRITICAL, value: 14, showValue: 14, weight: 50, desc: "暴击率 +14%", isSpecial: true, note: "上限70%" },
{ attr: Attrs.CRITICAL_DMG, value: 40, showValue: 40, weight: 50, desc: "暴击伤害 +40%", isSpecial: true, note: "上限200%" },
{ attr: Attrs.STUN_CHANCE, value: 10, showValue: 10, weight: 30, desc: "眩晕概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.FREEZE_CHANCE, value: 10, showValue: 10, weight: 30, desc: "冰冻概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.BURN_CHANCE, value: 10, showValue: 10, weight: 30, desc: "燃烧概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.BACK_CHANCE, value: 10, showValue: 10, weight: 30, desc: "击退概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.SLOW_CHANCE, value: 10, showValue: 10, weight: 30, desc: "减速概率 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.LIFESTEAL, value: 10, showValue: 10, weight: 30, desc: "吸血比例 +10%", isSpecial: true, note: "上限50%" },
{ attr: Attrs.MANASTEAL, value: 10, showValue: 10, weight: 30, desc: "吸蓝比例 +10%", isSpecial: true, note: "上限50%" },
],
19: [
{ attr: Attrs.AP, value: 42, showValue: 42, weight: 100, desc: "攻击力 +42", isSpecial: false, note: "常规强化" },
{ attr: Attrs.HP_MAX, value: 280, showValue: 280, weight: 100, desc: "生命上限 +280", isSpecial: false, note: "常规强化" },
{ attr: Attrs.DEF, value: 14, showValue: 14, weight: 100, desc: "防御力 +14", isSpecial: false, note: "常规强化" },
{ attr: Attrs.AS, value: 9.5, showValue: 9.5, weight: 100, desc: "攻击速度 +9.5%", isSpecial: false, note: "常规强化" },
],
20: [
// 无强化等级
],
};
/**
* 获取指定等级的随机选项
*/
export const getNormalBuffs = (level: number, count: number = 4): ITDLevelOption[] => {
const pool = LEVEL_OPTIONS_TABLE[level];
if (!pool || pool.length === 0) return [];
const result: ITDLevelOption[] = [];
const tempPool = [...pool];
// 1. 根据权重进行随机抽样,直到选满 count 个或池子抽空
while (result.length < count && tempPool.length > 0) {
const totalWeight = tempPool.reduce((sum, item) => sum + item.weight, 0);
let randomVal = Math.random() * totalWeight;
for (let j = 0; j < tempPool.length; j++) {
randomVal -= tempPool[j].weight;
if (randomVal <= 0) {
result.push(tempPool[j]);
tempPool.splice(j, 1);
break;
}
}
}
// 2. 即使选出的数量正好是4个比如常规等级也必须进行最后的随机排序
// 使用 Fisher-Yates 洗牌算法
for (let i = result.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[result[i], result[j]] = [result[j], result[i]];
}
return result;
};
// 天赋获取等级
export const TALENT_LEVELS = [5, 10, 15, 20];
/**
* 获取天赋选项(从天赋池中随机抽取)
* @param count 选项数量默认4个
*/
export const getTalentBuffs = (count: number = 4): ItalConf[] => {
// 获取所有天赋列表
const allTalents = Object.values(talConf);
if (allTalents.length === 0) return [];
const result: ItalConf[] = [];
const tempPool = [...allTalents];
// 随机抽取指定数量
while (result.length < count && tempPool.length > 0) {
const index = Math.floor(Math.random() * tempPool.length);
result.push(tempPool[index]);
tempPool.splice(index, 1);
}
return result;
};