refactor(skillSet): 基本功完成 新buff系统 优化DBuff与Attrs映射及转换逻辑
- 规范化DBuff的枚举命名,修正属性对应关系 - 统一DBuff与Attrs的双向映射,通过TransformBuffs函数处理转换 - 移除旧的getAttrFieldFromDebuff方法,改用更灵活的映射数组 - 更新Attrs枚举,增加被易伤、防护盾等新属性 - 重新调整AttrsType映射,保证属性类型一致性 refactor(hero): 重构Hero和Monster初始化属性及buff系统 - Hero初始化时完善基础属性赋值,新增基础移动速度与攻击距离 - Hero使用initAttrs替代initBuffsDebuffs,重构buff/debuff初始化流程 - Monster初始化简化,统一按Hero写法初始化基础属性和Attrs - 实现buff/debuff属性智能覆盖与叠加时长的改进逻辑 - 属性计算改用统一逻辑,支持数值型和百分比型准确计算 - 增加属性值范围限制,确保部分属性在合理区间内 refactor(heroViewComp): 优化buff/debuff管理及状态判断 - 统一buff和debuff的持久与临时管理字典及更新方法 - 优化临时buff/debuff的更新时间处理,自动触发属性重新计算 - 提供isStun和isFrost接口简化眩晕、冰冻状态判断 - 规范注释及代码格式,提升可读性和维护性 refactor(skillConComp): 优化眩晕与冰冻状态判断逻辑 - 移除遍历判断,改用HeroViewComp的isStun和isFrost方法 - 简化技能冷却更新逻辑,提升性能 chore(heroSet): 添加AttrSet枚举定义属性最大值限制 docs(rogueConfig): 更新说明文档中的属性枚举定义说明 - 将属性增强枚举由BuffAttr修改为Attrs,以保持一致性
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* 功能说明:
|
||||
* - 提供基于怪物类型的属性加成配置
|
||||
* - 使用BuffAttr枚举定义属性增强
|
||||
* - 使用Attrs枚举定义属性增强
|
||||
* - 供游戏系统调用获取怪物增强数据
|
||||
*
|
||||
* @author 游戏开发团队
|
||||
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
import { QualitySet } from "../common/config/BoxSet";
|
||||
import { BuffAttr } from "../common/config/SkillSet";
|
||||
import { Attrs } from "../common/config/SkillSet";
|
||||
import { getMonList } from "../common/config/heroSet";
|
||||
|
||||
/**
|
||||
@@ -92,16 +92,14 @@ export const StageConfigRules = {
|
||||
* 按权重排序,数值越大优先级越高
|
||||
*/
|
||||
export const AvailableEnhancementPool = [
|
||||
{ buffType: BuffAttr.HP, weight: 10, baseValue: 80, name: "生命值增强" },
|
||||
{ buffType: BuffAttr.ATK, weight: 9, baseValue: 50, name: "攻击力增强" },
|
||||
{ buffType: BuffAttr.CRITICAL, weight: 8, baseValue: 30, name: "暴击率增强" },
|
||||
{ buffType: BuffAttr.DEF, weight: 7, baseValue: 40, name: "防御增强" },
|
||||
{ buffType: BuffAttr.CRITICAL_DMG, weight: 6, baseValue: 60, name: "暴击伤害增强" },
|
||||
{ buffType: BuffAttr.DODGE, weight: 5, baseValue: 25, name: "闪避增强" },
|
||||
{ buffType: BuffAttr.ATK_CD, weight: 4, baseValue: 20, name: "攻击速度增强" },
|
||||
{ buffType: BuffAttr.LIFESTEAL, weight: 3, baseValue: 15, name: "吸血" },
|
||||
{ buffType: BuffAttr.DMG_RED, weight: 2, baseValue: 20, name: "免伤" },
|
||||
{ buffType: BuffAttr.PUNCTURE, weight: 1, baseValue: 2, name: "穿刺" }
|
||||
{ buffType: Attrs.HP_MAX, weight: 10, baseValue: 80, name: "生命值增强" },
|
||||
{ buffType: Attrs.AP, weight: 9, baseValue: 50, name: "攻击力增强" },
|
||||
{ buffType: Attrs.CRITICAL, weight: 8, baseValue: 30, name: "暴击率增强" },
|
||||
{ buffType: Attrs.DEF, weight: 7, baseValue: 40, name: "防御增强" },
|
||||
{ buffType: Attrs.CRITICAL_DMG, weight: 6, baseValue: 60, name: "暴击伤害增强" },
|
||||
{ buffType: Attrs.DODGE, weight: 5, baseValue: 25, name: "闪避增强" },
|
||||
{ buffType: Attrs.AS, weight: 4, baseValue: 20, name: "攻击速度增强" },
|
||||
{ buffType: Attrs.LIFESTEAL, weight: 3, baseValue: 15, name: "吸血" },
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -128,8 +126,8 @@ export const MonsterTypeBaseConfig = {
|
||||
export interface MonsterEnhancementData {
|
||||
name: string;
|
||||
description: string;
|
||||
buffs: { [key in BuffAttr]?: number };
|
||||
buffList: Array<{ buffType: BuffAttr; value: number; name: string }>;
|
||||
buffs: { [key in Attrs]?: number };
|
||||
buffList: Array<{ buffType: Attrs; value: number; name: string }>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,7 +136,7 @@ export interface MonsterEnhancementData {
|
||||
* @param excludeTypes 排除的属性类型
|
||||
* @returns 选中的增强属性数组
|
||||
*/
|
||||
export function selectRandomEnhancements(count: number, excludeTypes: BuffAttr[] = []): Array<{buffType: BuffAttr, weight: number, baseValue: number, name: string}> {
|
||||
export function selectRandomEnhancements(count: number, excludeTypes: Attrs[] = []): Array<{buffType: Attrs, weight: number, baseValue: number, name: string}> {
|
||||
if (count <= 0) return [];
|
||||
|
||||
// 过滤掉排除的属性类型
|
||||
@@ -147,7 +145,7 @@ export function selectRandomEnhancements(count: number, excludeTypes: BuffAttr[]
|
||||
if (availablePool.length === 0) return [];
|
||||
|
||||
const selectedEnhancements = [];
|
||||
const usedTypes = new Set<BuffAttr>();
|
||||
const usedTypes = new Set<Attrs>();
|
||||
|
||||
for (let i = 0; i < count && i < availablePool.length; i++) {
|
||||
// 计算权重总和
|
||||
@@ -185,7 +183,7 @@ export function getMonsterEnhancement(monsterType: MonsterType, useRandom: boole
|
||||
const baseConfig = MonsterTypeBaseConfig[monsterType];
|
||||
const enhancementCount = MonsterEnhancementCountConfig[monsterType];
|
||||
|
||||
let selectedEnhancements: Array<{buffType: BuffAttr, weight: number, baseValue: number, name: string}> = [];
|
||||
let selectedEnhancements: Array<{buffType: Attrs, weight: number, baseValue: number, name: string}> = [];
|
||||
|
||||
if (useRandom) {
|
||||
// 随机生成增强属性
|
||||
@@ -198,8 +196,8 @@ export function getMonsterEnhancement(monsterType: MonsterType, useRandom: boole
|
||||
}
|
||||
|
||||
// 构建buffs对象
|
||||
const buffs: { [key in BuffAttr]?: number } = {};
|
||||
const buffList: Array<{ buffType: BuffAttr; value: number; name: string }> = [];
|
||||
const buffs: { [key in Attrs]?: number } = {};
|
||||
const buffList: Array<{ buffType: Attrs; value: number; name: string }> = [];
|
||||
|
||||
selectedEnhancements.forEach(enhancement => {
|
||||
buffs[enhancement.buffType] = enhancement.baseValue;
|
||||
|
||||
Reference in New Issue
Block a user