refactor(hero): 将英雄属性相关引用统一替换为 HeroAttrs

- 移除废弃的 AttributeExample 示例类文件
- 全面替换各模块中对技能属性配置 SkillSet 中 Attrs 的引用,改用 HeroAttrs 中的 Attrs
- 保持代码引用整理一致性,优化属性相关模块的导入顺序和结构
- 无功能性改动,仅代码结构和引用路径调整,提高代码维护性和模块解耦性
This commit is contained in:
2025-10-25 10:34:55 +08:00
parent 326ceaf3d1
commit abbe4cc6a0
5 changed files with 79 additions and 79 deletions

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "6f2434a0-4835-4abf-9acb-30699979d1a8",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -120,21 +120,19 @@ export const HeroInfo: Record<number, heroInfo> = {
type:HType.support,lv:1,hp:95,mp:130,map:18,def:6,ap:10,dis:380,speed:105,skills:[6001,6005],
buff:[],debuff:[],info:"自然德鲁伊,精通自然魔法和生命治愈"},
// ========== 怪物 ==========
// 兽人战士 - 普通近战怪物
5201:{uuid:5201,name:"兽人战士",path:"mo1", fac:FacSet.MON, kind:1,
type:HType.warrior,lv:1,hp:40,mp:50,map:5,def:6,ap:8,dis:90,speed:100,skills:[6001],
buff:[],debuff:[],info:"普通近战怪物,具有基础政击和防御能力"},
// 兽人刺客 - 敏捷刺客怪物
5202:{uuid:5202,name:"兽人刺客",path:"mo1", fac:FacSet.MON, kind:1,
type:HType.assassin,lv:1,hp:30,mp:40,map:3,def:3,ap:12,dis:120,speed:150,skills:[6001],
buff:[],debuff:[],info:"敏捷刺客怪物,高速度低防御"},
// 兽人护卫 - 重装战士怪物
5203:{uuid:5203,name:"兽人护卫",path:"mo1", fac:FacSet.MON, kind:1,
type:HType.warrior,lv:1,hp:50,mp:50,map:5,def:10,ap:6,dis:90,speed:80,skills:[6001],
buff:[],debuff:[],info:"重装护卫怪物,高防御高生命"},
//怪物
5201:{uuid:5201,name:"兽人战士",path:"mo1", fac:FacSet.MON, kind:1,
type:HType.warrior,lv:1,hp:25,mp:100,map:10,def:5,ap:5,dis:90,speed:100,skills:[6005],
buff:[],debuff:[],info:"普通怪物-战士型"},
5202:{uuid:5202,name:"兽人刺客",path:"mo1", fac:FacSet.MON, kind:1,
type:HType.remote,lv:1,hp:20,mp:100,map:10,def:5,ap:5,dis:350,speed:100,skills:[6005],
buff:[],debuff:[],info:"普通怪物-战士型"},
5203:{uuid:5203,name:"兽人护卫",path:"mo1", fac:FacSet.MON, kind:1,
type:HType.warrior,lv:1,hp:25,mp:100,map:10,def:5,ap:5,dis:90,speed:100,skills:[6005],
buff:[],debuff:[],info:"普通怪物-战士型"},
};

View File

@@ -1,63 +0,0 @@
import { HType, calculateBaseAttributes, calculateAttributeInfluences } from "../common/config/heroSet";
import { Attrs } from "../common/config/SkillSet";
/**
* 英雄属性计算器使用示例
*/
export class AttributeExample {
/**
* 示例:计算指定类型和等级的英雄属性
* @param heroType 英雄类型
* @param level 英雄等级
*/
static calculateHeroAttributes(heroType: HType, level: number) {
// 1. 计算基础属性值
const baseAttributes = calculateBaseAttributes(heroType, level);
console.log("基础属性:", baseAttributes);
// 2. 计算基础属性对战斗属性的影响
const attributeInfluences = calculateAttributeInfluences(baseAttributes);
console.log("属性影响:", attributeInfluences);
// 3. 输出特定属性的影响值
console.log(`攻击力加成: ${attributeInfluences[Attrs.AP]}`);
console.log(`生命值加成: ${attributeInfluences[Attrs.HP_MAX]}`);
console.log(`魔法攻击力加成: ${attributeInfluences[Attrs.MAP]}`);
return {
baseAttributes,
attributeInfluences
};
}
/**
* 示例:为英雄应用属性影响
* @param hero 英雄对象
* @param level 英雄等级
*/
static applyAttributesToHero(hero: any, level: number) {
// 计算基础属性
const baseAttributes = calculateBaseAttributes(hero.type, level);
// 计算属性影响
const attributeInfluences = calculateAttributeInfluences(baseAttributes);
// 应用属性影响到英雄
hero.ap += attributeInfluences[Attrs.AP];
hero.hp += attributeInfluences[Attrs.HP_MAX];
hero.map += attributeInfluences[Attrs.MAP];
hero.mp += attributeInfluences[Attrs.MP_MAX];
hero.mdef += attributeInfluences[Attrs.MDEF];
hero.as += attributeInfluences[Attrs.AS];
hero.dodge += attributeInfluences[Attrs.DODGE];
hero.hit += attributeInfluences[Attrs.HIT];
hero.critical += attributeInfluences[Attrs.CRITICAL];
hero.lifesteal += attributeInfluences[Attrs.LIFESTEAL];
return hero;
}
}
// 使用示例
// const warriorAttrs = AttributeExample.calculateHeroAttributes(HType.warrior, 10);
// const mageAttrs = AttributeExample.calculateHeroAttributes(HType.mage, 10);