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];

View File

@@ -1,7 +1,7 @@
import { v3 } from "cc"
import { BoxSet, FacSet } from "./GameSet"
import { smc } from "../SingletonModuleComp"
import { BuffConf } from "./SkillSet"
import { BuffConf, SkillRange } from "./SkillSet"
export enum AttrSet {
ATTR_MAX = 85,
@@ -114,6 +114,7 @@ export interface heroInfo {
ap: number; // 攻击力
def: number; // 防御(伤害减免)
dis: number; // 攻击距离(像素)
rangeType: SkillRange; // 攻击距离类型 (近/中/远)
speed: number; // 移动速度(像素/秒)
skills: number[]; // 携带技能ID列表
buff: BuffConf[]; // 自带buff配置通常为空由技能动态添加
@@ -129,36 +130,43 @@ export const HeroInfo: Record<number, heroInfo> = {
// 刘邦 - 领导型战士(善于用人,知人善任)
5001:{uuid:5001,name:"刘邦",path:"hk1", fac:FacSet.HERO, kind:1,as:1.5,
type:HType.warrior,lv:1,hp:200,mp:200,def:0,ap:15,dis:120,speed:120,skills:[6001,6002],
rangeType: SkillRange.Melee,
buff:[],tal:[],info:"楚汉争霸领袖,领导统御型战士"},
// 荆轲 - 刺客(敏捷型,高速度和暴击率)
5002:{uuid:5002,name:"荆轲",path:"hc1", fac:FacSet.HERO, kind:1,as:1.5,
type:HType.assassin,lv:1,hp:80,mp:60,def:0,ap:22,dis:120,speed:180,skills:[6002,6001],
rangeType: SkillRange.Melee,
buff:[],tal:[],info:"战国刺客,刺杀专精敏捷型刺客"},
// 赵武灵王 - 远程射手(胡服骑射,机动型高移动速度和远程攻击)
5005:{uuid:5005,name:"赵武灵王",path:"ha1", fac:FacSet.HERO, kind:2,as:1.5,
type:HType.remote,lv:1,hp:100,mp:80,def:0,ap:18,dis:450,speed:140,skills:[6002,6001],
rangeType: SkillRange.Long,
buff:[],tal:[],info:"胡服骑射改革者,机动型高远程输出"},
// 张良 - 智谋法师(运筹帷幄,智谋型法师)
5007:{uuid:5007,name:"张良",path:"hh1", fac:FacSet.HERO, kind:2,as:1.5,
type:HType.mage,lv:1,hp:88,mp:135,def:0,ap:15,dis:350,speed:100,skills:[6002,6001],
rangeType: SkillRange.Mid,
buff:[],tal:[],info:"运筹帷幄谋士,智谋型法师"},
// 屈原 - 元素法师(离骚诗韵,元素型高魔法输出)
5008:{uuid:5008,name:"屈原",path:"hm1", fac:FacSet.HERO, kind:2,as:1.5,
type:HType.mage,lv:1,hp:85,mp:140,def:0,ap:16,dis:400,speed:90,skills:[6002,6001],
rangeType: SkillRange.Mid,
buff:[],tal:[],info:"离骚诗韵,元素型高魔法输出"},
// 孙膑 - 谋略法师(兵法谋略,谋略型法师)
5009:{uuid:5009,name:"孙膑",path:"hm2", fac:FacSet.HERO, kind:2,as:1.5,
type:HType.mage,lv:1,hp:92,mp:135,def:0,ap:14,dis:420,speed:95,skills:[6002,6001],
rangeType: SkillRange.Long,
buff:[],tal:[],info:"兵法谋略,谋略型法师"},
// 萧何 - 后勤辅助(后勤保障,后勤型辅助)
5010:{uuid:5010,name:"萧何",path:"hz1", fac:FacSet.HERO, kind:2,as:1.5,
type:HType.support,lv:1,hp:115,mp:145,def:0,ap:8,dis:380,speed:105,skills:[6002,6001],
rangeType: SkillRange.Mid,
buff:[],tal:[],info:"后勤保障,后勤型辅助"},
@@ -169,40 +177,49 @@ export const HeroInfo: Record<number, heroInfo> = {
// 1. 基础近战型
5201:{uuid:5201,name:"兽人战士",path:"mo1", fac:FacSet.MON, kind:1,as:3.0,
type:HType.warrior,lv:1,hp:40,mp:100,def:0,ap:5,dis:60,speed:180,skills:[6005],
rangeType: SkillRange.Melee,
buff:[],tal:[],info:"标准炮灰确保英雄能完成3次普攻积累天赋计数"},
// 2. 快速突击型
5301:{uuid:5301,name:"兽人斥候",path:"mo1", fac:FacSet.MON, kind:1,as:1.2,
type:HType.assassin,lv:1,hp:30,mp:100,def:0,ap:12,dis:50,speed:400,skills:[6005],
rangeType: SkillRange.Melee,
buff:[],tal:[],info:"快速突击:极高移速贴脸,检测护盾(7102)刷新率"},
// 3. 重型坦克型
5401:{uuid:5401,name:"兽人卫士",path:"mo1", fac:FacSet.MON, kind:1,as:5.0,
type:HType.warrior,lv:1,hp:400,mp:100,def:5,ap:25,dis:90,speed:60,skills:[6005],
rangeType: SkillRange.Melee,
buff:[],tal:[],info:"重型坦克:数值墙,检测玩家破甲(7008)与持续输出"},
// 4. 远程骚扰型
5501:{uuid:5501,name:"兽人射手",path:"mo1", fac:FacSet.MON, kind:1,as:3.0,
type:HType.remote,lv:1,hp:50,mp:100,def:0,ap:15,dis:800,speed:90,skills:[6203],
rangeType: SkillRange.Long,
buff:[],tal:[],info:"远程骚扰:跨屏打击,迫使阵地分散或移动英雄"},
// 5. 特殊机制型
5601:{uuid:5601,name:"兽人自爆兵",path:"mo1", fac:FacSet.MON, kind:1,as:3.0,
type:HType.assassin,lv:1,hp:60,mp:100,def:0,ap:250,dis:50,speed:220,skills:[6005],
rangeType: SkillRange.Melee,
buff:[],tal:[],info:"特殊机制:极端伤害,漏怪即秒杀,检测减伤(7103)"},
// 召唤师:持续召唤小怪(后续可在技能系统中实现 SType.zhaohuan
5602:{uuid:5602,name:"兽人召唤师",path:"mo1", fac:FacSet.MON, kind:1,as:3.0,
type:HType.mage,lv:1,hp:120,mp:300,def:5,ap:8,dis:380,speed:100,skills:[6005],
rangeType: SkillRange.Mid,
buff:[],tal:[],info:"战术目标:持续召唤小怪,检测英雄大招清场频率"},
// 治疗者:为周围怪物回血(此处以提升治疗效果和生命回复为基础被动)
5603:{uuid:5603,name:"兽人祭司",path:"mo1", fac:FacSet.MON, kind:1,as:3.0,
type:HType.support,lv:1,hp:120,mp:300,def:5,ap:6,dis:90,speed:105,skills:[6005],
rangeType: SkillRange.Melee,
buff:[],tal:[],info:"战术目标:为怪群回血,检测玩家沉默(7006)覆盖率"},
// 光环怪为周围怪物提供增益此处以Buff效果提升与移动速度提升为基础被动
// Attrs.BUFF_UP=60 (RATIO=1)Attrs.SPEED=63 (RATIO=1)
5604:{uuid:5604,name:"兽人图腾师",path:"mo1", fac:FacSet.MON, kind:1,as:3.0,
type:HType.support,lv:1,hp:100,mp:250,def:5,ap:7,dis:90,speed:110,skills:[6005],
rangeType: SkillRange.Melee,
buff:[],tal:[],info:"战术目标:提供加速光环,改变怪群推进节奏"},
// 6. 精英/BOSS型
5701:{uuid:5701,name:"兽人首领(BOSS)",path:"mo1", fac:FacSet.MON, kind:1,as:2.5,
type:HType.warrior,lv:3,hp:25000,mp:500,def:20,ap:80,dis:120,speed:120,skills:[6005],
rangeType: SkillRange.Melee,
buff:[],tal:[],info:"终极考验极高HP检测大招重置与辐射协同输出"},
};
};