feat(skill-system): 新增网格AOE技能的目标选择逻辑

新增DTType.aoe_grid枚举类型用于标识3*3网格范围攻击技能
实现该类型技能的目标位置解析逻辑,区分敌我单位的中路列选择
调整6201至6206号技能的类型为aoe_grid
This commit is contained in:
pan
2026-06-17 10:46:36 +08:00
parent b6b2dff986
commit 747b6d17cf
2 changed files with 42 additions and 7 deletions

View File

@@ -13,6 +13,8 @@ import { GameEvent } from "../common/config/GameEvent";
import { SkillTriggerType } from "../common/config/heroSet";
import { SkillTriggerHelper } from "./SkillTriggerHelper";
import { MissionEconomy } from "../map/MissionEconomy";
import { MissionMonCompComp } from "../map/MissionMonComp";
import { MissionHeroComp } from "../map/MissionHeroComp";
/**
* ==================== 自动施法系统 ====================
@@ -686,9 +688,41 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
/**
* 解析对敌技能目标点:
* - 非范围技能:按施法方向生成目标点
* - 范围技能:优先前排敌人位置
* - range 范围技能:优先前排敌人位置
* - aoe_grid 范围技能以中路第2或第3列为目标若存在敌人优先第2列否则第3列这里简化为直接返回第2列中路的固定坐标或者根据情况处理
*/
private resolveEnemyCastTargetPos(config: SkillConfig, heroAttrs: HeroAttrsComp, heroView: HeroViewComp, nearestEnemy: HeroViewComp, maxRange: number): Vec3 | null {
if (config.DTType === DTType.aoe_grid) {
const isHero = heroAttrs.fac === FacSet.HERO;
if (isHero) {
// 英雄打怪物目标为怪物网格的第2列(idx 1)中路(row 1)或第3列(idx 2)中路
// MissionMonComp.MON_POSITIONS 顺序:
// 列1: 0,1,2 (X=60)
// 列2: 3,4,5 (X=140) -> 第2列中路是 index 4
// 列3: 6,7,8 (X=220) -> 第3列中路是 index 7
// 简单起见可以固定取第2列中路(index 4)或第3列中路(index 7)
// 若最近的敌人在更后排,也可以取那个敌人的列。
// 需求:三类 需要以中路 第 2、 3列为目标。
// 我们直接返回第2列中路坐标(X=140, Y=GAME_LINE)或者根据最近敌人判断。
// 需求说明为第 2 或 第 3 列这里我们可以根据目标位置如果目标在第3列及以后打第3列否则打第2列。
let targetCol = 1; // 0-based, so 1 is 2nd col
if (nearestEnemy && nearestEnemy.node) {
// 判断目标所在的列
const ex = nearestEnemy.node.position.x;
// X=60(列1), X=140(列2), X=220(列3), X=300(列4)
if (ex >= 200) targetCol = 2; // 第3列
}
const targetIdx = targetCol * 3 + 1; // 1是中路
return MissionMonCompComp.MON_POSITIONS[targetIdx].clone();
} else {
// 怪物打英雄,英雄网格:
// 列1: 0,1,2 (X=-210)
// 列2: 3,4,5 (X=-300)
// 英雄只有2列第2列中路是 index 4
return MissionHeroComp.HERO_POSITIONS[4].clone();
}
}
if (config.RType === RType.bezier) {
return nearestEnemy.node?.position.clone() ?? null;
}