feat(英雄AI): 重构英雄移动系统,基于攻击距离类型实现智能战术走位

1. 新增SkillRange枚举定义近/中/远程攻击类型
2. 在HeroAttrsComp和hero配置中添加rangeType字段
3. 重写HeroMoveSystem,根据rangeType实现差异化移动策略
4. 移除技能施放的攻击状态限制,优化AI决策逻辑
This commit is contained in:
walkpan
2026-01-06 18:26:18 +08:00
parent fcc2aaf0a0
commit bb28492550
6 changed files with 295 additions and 288 deletions

View File

@@ -43,17 +43,30 @@ export enum SType {
damage = 0,
heal = 1,
shield = 2,
atk_speed = 3,
power_up = 4,
ap_up = 5,
dod_up = 6,
crit_up = 7,
crit_dmg_up = 8,
wfuny_up = 9,
zhaohuan = 10,
buff = 11,
zhaohuan = 3,
buff = 4,
}
/**
* 攻击距离类型分类
* 用于AI决策和技能配置规范化
*/
export enum SkillRange {
/** 近战: < 150 (贴脸输出) */
Melee = 0,
/** 中程: 150 - 400 (投掷/短法术) */
Mid = 1,
/** 远程: > 400 (弓箭/长法术) */
Long = 2
}
/** 距离类型的标准数值定义 */
export const SkillDisVal: Record<SkillRange, number> = {
[SkillRange.Melee]: 120,
[SkillRange.Mid]: 360,
[SkillRange.Long]: 720
};
//受伤动画名称
export enum AtkedName {
atked = "atked",
@@ -169,6 +182,7 @@ export interface SkillConfig {
speed:number, // 移动速度
with:number, // 宽度(暂时无用)
dis:Number, // 距离/范围
rangeType?: SkillRange, // [新增] 距离类型标记用于AI辅助判断
ready:number, // 前摇时间
EAnm:number, // 结束动画ID
DAnm:number, // 命中后动画ID
@@ -183,50 +197,58 @@ export interface SkillConfig {
export const SkillSet: Record<number, SkillConfig> = {
5000:{uuid:5000,name:"反伤",sp_name:"thorns",icon:"3036",TGroup:TGroup.Enemy,SType:SType.damage,act:"atk",DTType:DTType.single,
ap:0,cd:60,t_num:1,hit_num:1,hit:1,hitcd:0.2,speed:720,with:0,dis:800,
rangeType: SkillRange.Long,
ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.animationEnd,
buffs:[],neAttrs:[],info:"反伤",
},
// ========== 基础攻击 ========== 6001-6099
6001: {
uuid:6001,name:"挥击",sp_name:"atk_s1",icon:"3036",TGroup:TGroup.Enemy,SType:SType.damage,act:"atk",DTType:DTType.single,
ap:100,cd:1,t_num:1,hit_num:1,hit:1,hitcd:0.2,speed:720,with:0,dis:120,
ap:100,cd:1,t_num:1,hit_num:1,hit:1,hitcd:0.2,speed:720,with:0,dis:SkillDisVal[SkillRange.Melee],
rangeType: SkillRange.Melee,
ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.animationEnd,
buffs:[],neAttrs:[],info:"向最前方敌人扔出石斧,造成100%攻击的伤害",
},
6002: {
uuid:6002,name:"挥砍",sp_name:"atk_s4",icon:"3036",TGroup:TGroup.Enemy,SType:SType.damage,act:"atk",DTType:DTType.single,
ap:100,cd:1,t_num:1,hit_num:1,hit:1,hitcd:0.2,speed:720,with:0,dis:120,
ap:100,cd:1,t_num:1,hit_num:1,hit:1,hitcd:0.2,speed:720,with:0,dis:SkillDisVal[SkillRange.Melee],
rangeType: SkillRange.Melee,
ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.animationEnd,
buffs:[],neAttrs:[],info:"向最前方敌人扔出石斧,造成100%攻击的伤害",
},
6005: {
uuid:6005,name:"水球",sp_name:"m_water_ball_1",icon:"3039",TGroup:TGroup.Enemy,SType:SType.damage,act:"atk",DTType:DTType.single,
ap:100,cd:5,t_num:1,hit_num:1,hit:2,hitcd:0.3,speed:720,with:90,dis:360,
ap:100,cd:5,t_num:1,hit_num:1,hit:2,hitcd:0.3,speed:720,with:90,dis:SkillDisVal[SkillRange.Mid],
rangeType: SkillRange.Mid,
ready:8001,EAnm:0,DAnm:9001,RType:RType.linear,EType:EType.collision,
buffs:[],neAttrs:[],info:"召唤水球攻击前方敌人,造成100%魔法攻击的伤害",
},
// ========== 基础buff ========== 6100-6199
6100: {
uuid:6100,name:"治疗",sp_name:"buff_wind",icon:"3036",TGroup:TGroup.Self,SType:SType.heal,act:"atk",DTType:DTType.single,
ap:30,cd:5,t_num:1,hit_num:1,hit:1,hitcd:0.2,speed:720,with:0,dis:720,
ap:30,cd:5,t_num:1,hit_num:1,hit:1,hitcd:0.2,speed:720,with:0,dis:SkillDisVal[SkillRange.Long],
rangeType: SkillRange.Long,
ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.animationEnd,
buffs:[],neAttrs:[],info:"治疗自己,回复30%最大生命值",
},
6101:{
uuid:6101,name:"魔法盾",sp_name:"buff_wind",icon:"3036",TGroup:TGroup.Self,SType:SType.shield,act:"atk",DTType:DTType.single,
ap:30,cd:7,t_num:1,hit_num:1,hit:1,hitcd:0.2,speed:720,with:0,dis:720,
ap:30,cd:7,t_num:1,hit_num:1,hit:1,hitcd:0.2,speed:720,with:0,dis:SkillDisVal[SkillRange.Long],
rangeType: SkillRange.Long,
ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.animationEnd,
buffs:[],neAttrs:[],info:"获得30%最大生命值的护盾,持续60秒",
},
6102:{
uuid:6102,name:"强壮",sp_name:"buff_wind",icon:"3036",TGroup:TGroup.Team,SType:SType.buff,act:"atk",DTType:DTType.single,
ap:30,cd:10,t_num:1,hit_num:1,hit:1,hitcd:0.2,speed:720,with:0,dis:720,
ap:30,cd:10,t_num:1,hit_num:1,hit:1,hitcd:0.2,speed:720,with:0,dis:SkillDisVal[SkillRange.Long],
rangeType: SkillRange.Long,
ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.animationEnd,
buffs:[{buff:Attrs.AP,BType:BType.VALUE,value:10,time:30,chance:1}],neAttrs:[],info:"增加目标10%攻击力,持续30秒",
},
6103:{
uuid:6103,name:"群体强壮",sp_name:"buff_wind",icon:"3036",TGroup:TGroup.Team,SType:SType.buff,act:"atk",DTType:DTType.range,
ap:30,cd:10,t_num:3,hit_num:1,hit:1,hitcd:0.2,speed:720,with:0,dis:720,
ap:30,cd:10,t_num:3,hit_num:1,hit:1,hitcd:0.2,speed:720,with:0,dis:SkillDisVal[SkillRange.Long],
rangeType: SkillRange.Long,
ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.animationEnd,
buffs:[{buff:Attrs.AP,BType:BType.RATIO,value:10,time:30,chance:1}],neAttrs:[],info:"增加目标10%攻击力,持续30秒",
},
@@ -235,7 +257,8 @@ export const SkillSet: Record<number, SkillConfig> = {
uuid:6201, name:"怪物近战", sp_name:"atk_s1", icon:"3036",
TGroup:TGroup.Enemy, SType:SType.damage, act:"atk", DTType:DTType.single,
ap:100, cd:1, t_num:1, hit_num:1, hit:1, hitcd:0.2, speed:0, with:0,
dis:50, // 近战距离
dis:50, // 怪物近战特殊距离
rangeType: SkillRange.Melee,
ready:0, EAnm:0, DAnm:9001, RType:RType.fixed, EType:EType.animationEnd,
buffs:[], neAttrs:[], info:"怪物基础近战攻击",
},
@@ -243,7 +266,8 @@ export const SkillSet: Record<number, SkillConfig> = {
uuid:6203, name:"怪物射击", sp_name:"arrow_1", icon:"3039",
TGroup:TGroup.Enemy, SType:SType.damage, act:"atk", DTType:DTType.single,
ap:80, cd:2, t_num:1, hit_num:1, hit:1, hitcd:0.2, speed:800, with:0,
dis:600, // 远程距离
dis:600, // 怪物远程特殊距离
rangeType: SkillRange.Long,
ready:0, EAnm:0, DAnm:9001, RType:RType.linear, EType:EType.collision,
buffs:[], neAttrs:[], info:"怪物基础远程攻击",
},
@@ -262,5 +286,3 @@ export const EAnmConf: Record<number, IEndAnm> = {
};
export const CanSelectSkills = [6001, 6002, 6005, 6100, 6101, 6102, 6103];