fix(战斗): 修正近战英雄的攻击逻辑和技能配置
- 将兽人召唤师、祭司、图腾师的类型从远程改为近战,以匹配其实际战斗行为 - 修复空挥技能的错误动画名称引用 - 重构SCastSystem的目标选择逻辑,移除冗余的combat_target处理 - 简化敌人查找逻辑,直接根据攻击范围寻找最近目标
This commit is contained in:
@@ -186,7 +186,7 @@ export interface SkillConfig {
|
||||
export const SkillSet: Record<number, SkillConfig> = {
|
||||
// ========== 基础攻击 ========== 6001-6099
|
||||
6001: {
|
||||
uuid:6001,name:"空挥",sp_name:"atk_s2",icon:"1026",TGroup:TGroup.Enemy,TType:TType.Frontline,readyAnm:"",endAnm:"",act:"atk",DTType:DTType.single,
|
||||
uuid:6001,name:"空挥",sp_name:"atk_s1",icon:"1026",TGroup:TGroup.Enemy,TType:TType.Frontline,readyAnm:"",endAnm:"",act:"atk",DTType:DTType.single,
|
||||
ap:100,hit_count:1,hitcd:0.2,speed:720,with:0,
|
||||
ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.animationEnd,
|
||||
buffs:[],debuffs:[],info:"对前方目标造成100%攻击的伤害",
|
||||
|
||||
@@ -197,11 +197,11 @@ export const HeroInfo: Record<number, heroInfo> = {
|
||||
5601:{uuid:5601,name:"兽人自爆兵",icon:"1001",path:"mo1", fac:FacSet.MON, kind:1,as:3.0,ss:10,
|
||||
type:HType.Melee,lv:1,hp:80,ap:200,speed:220,skills:[6001,6003],info:"特殊机制:极端伤害,漏怪即秒杀,检测减伤(7103)"},
|
||||
5602:{uuid:5602,name:"兽人召唤师",icon:"1001",path:"mo1", fac:FacSet.MON, kind:1,as:3.0,ss:10,
|
||||
type:HType.Long,lv:1,hp:150,ap:10,speed:100,skills:[6001,6003],info:"战术目标:持续召唤小怪,检测英雄大招清场频率"},
|
||||
type:HType.Melee,lv:1,hp:150,ap:10,speed:100,skills:[6001,6003],info:"战术目标:持续召唤小怪,检测英雄大招清场频率"},
|
||||
5603:{uuid:5603,name:"兽人祭司",icon:"1001",path:"mo1", fac:FacSet.MON, kind:1,as:3.0,ss:10,
|
||||
type:HType.Long,lv:1,hp:150,ap:10,speed:105,skills:[6001,6003],info:"战术目标:为怪群回血,检测玩家沉默(7006)覆盖率"},
|
||||
type:HType.Melee,lv:1,hp:150,ap:10,speed:105,skills:[6001,6003],info:"战术目标:为怪群回血,检测玩家沉默(7006)覆盖率"},
|
||||
5604:{uuid:5604,name:"兽人图腾师",icon:"1001",path:"mo1", fac:FacSet.MON, kind:1,as:3.0,ss:10,
|
||||
type:HType.Long,lv:1,hp:150,ap:10,speed:110,skills:[6001,6003],info:"战术目标:提供加速光环,改变怪群推进节奏"},
|
||||
type:HType.Melee,lv:1,hp:150,ap:10,speed:110,skills:[6001,6003],info:"战术目标:提供加速光环,改变怪群推进节奏"},
|
||||
// 6. 精英/BOSS型
|
||||
5701:{uuid:5701,name:"兽人首领(BOSS)",icon:"1001",path:"mo4", fac:FacSet.MON, kind:1,as:2.5,ss:10,
|
||||
type:HType.Melee,lv:3,hp:2000,ap:60,speed:120,skills:[6001,6003],info:"终极考验:极高HP,检测大招重置与辐射协同输出"},
|
||||
|
||||
@@ -46,7 +46,9 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
}
|
||||
|
||||
private pickCastSkill(heroAttrs: HeroAttrsComp, heroView: HeroViewComp): { skillId: number; targets: HeroViewComp[]; isFriendly: boolean } {
|
||||
const { target, inRange } = this.resolveCastTarget(heroAttrs, heroView);
|
||||
const type = heroAttrs.type as HType;
|
||||
const maxRange = this.resolveMaxCastRange(heroAttrs, type);
|
||||
const target = this.findNearestEnemyInRange(heroAttrs, heroView, maxRange);
|
||||
const skillCandidates = [heroAttrs.skill_id, heroAttrs.atk_id];
|
||||
for (const s_uuid of skillCandidates) {
|
||||
if (!s_uuid) continue;
|
||||
@@ -58,7 +60,7 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
if (this.isFriendlySkill(config.TGroup)) {
|
||||
return { skillId: s_uuid, targets: [heroView], isFriendly: true };
|
||||
}
|
||||
if (!target || !inRange) continue;
|
||||
if (!target) continue;
|
||||
return { skillId: s_uuid, targets: [target], isFriendly: false };
|
||||
}
|
||||
return this.emptyCastPlan;
|
||||
@@ -166,33 +168,7 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
return group === TGroup.Self || group === TGroup.Team || group === TGroup.Ally;
|
||||
}
|
||||
|
||||
private resolveCombatTarget(heroAttrs: HeroAttrsComp): HeroViewComp | null {
|
||||
if (heroAttrs.combat_target_eid <= 0) return null;
|
||||
const targetEntity = ecs.getEntityByEid(heroAttrs.combat_target_eid);
|
||||
if (!targetEntity) return null;
|
||||
const targetAttrs = targetEntity.get(HeroAttrsComp);
|
||||
const targetView = targetEntity.get(HeroViewComp);
|
||||
if (!targetAttrs || !targetView || !targetView.node || !targetView.node.isValid) return null;
|
||||
if (targetAttrs.is_dead || targetAttrs.is_reviving) return null;
|
||||
if (targetAttrs.fac === heroAttrs.fac) return null;
|
||||
return targetView;
|
||||
}
|
||||
|
||||
private resolveCastTarget(heroAttrs: HeroAttrsComp, heroView: HeroViewComp): { target: HeroViewComp | null; inRange: boolean } {
|
||||
const combatTarget = this.resolveCombatTarget(heroAttrs);
|
||||
if (combatTarget && this.isEnemyInCastRange(heroAttrs, heroView, combatTarget)) {
|
||||
return { target: combatTarget, inRange: true };
|
||||
}
|
||||
const nearestInRange = this.findNearestEnemy(heroAttrs, heroView, true);
|
||||
if (nearestInRange) {
|
||||
return { target: nearestInRange, inRange: true };
|
||||
}
|
||||
const fallback = combatTarget ?? this.findNearestEnemy(heroAttrs, heroView, false);
|
||||
if (!fallback) return { target: null, inRange: false };
|
||||
return { target: fallback, inRange: this.isEnemyInCastRange(heroAttrs, heroView, fallback) };
|
||||
}
|
||||
|
||||
private findNearestEnemy(heroAttrs: HeroAttrsComp, heroView: HeroViewComp, requireInRange: boolean): HeroViewComp | null {
|
||||
private findNearestEnemyInRange(heroAttrs: HeroAttrsComp, heroView: HeroViewComp, maxRange: number): HeroViewComp | null {
|
||||
if (!heroView.node) return null;
|
||||
const currentX = heroView.node.position.x;
|
||||
let nearest: HeroViewComp | null = null;
|
||||
@@ -204,7 +180,7 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
if (attrs.fac === heroAttrs.fac) return;
|
||||
if (attrs.is_dead || attrs.is_reviving) return;
|
||||
const dist = Math.abs(currentX - view.node.position.x);
|
||||
if (requireInRange && !this.isEnemyInCastRange(heroAttrs, heroView, view)) return;
|
||||
if (dist > maxRange) return;
|
||||
if (dist >= minDist) return;
|
||||
minDist = dist;
|
||||
nearest = view;
|
||||
@@ -212,14 +188,6 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
return nearest;
|
||||
}
|
||||
|
||||
private isEnemyInCastRange(heroAttrs: HeroAttrsComp, heroView: HeroViewComp, target: HeroViewComp): boolean {
|
||||
if (!heroView.node || !target.node) return false;
|
||||
const dist = Math.abs(heroView.node.position.x - target.node.position.x);
|
||||
const type = heroAttrs.type as HType;
|
||||
const maxRange = this.resolveMaxCastRange(heroAttrs, type);
|
||||
return dist <= maxRange;
|
||||
}
|
||||
|
||||
private resolveMaxCastRange(heroAttrs: HeroAttrsComp, type: HType): number {
|
||||
const cached = heroAttrs.getCachedMaxSkillDistance();
|
||||
if (cached > 0) return cached;
|
||||
|
||||
Reference in New Issue
Block a user