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

@@ -18,6 +18,7 @@ export enum TGroup {
export enum DTType { export enum DTType {
single = 0, single = 0,
range = 1, range = 1,
aoe_grid = 2, // 3*3 网格范围攻击以中路第2、3列为目标
} }
export enum SkillKind { export enum SkillKind {
@@ -294,36 +295,36 @@ export const SkillSet: Record<number, SkillConfig> = {
**/ **/
6201: { 6201: {
uuid: 6201, name: "雷墙", sp_name: "box_1", icon: "1173", TGroup: TGroup.Enemy, readyAnm: "blues", endAnm: "", act: "max", uuid: 6201, name: "雷墙", sp_name: "box_1", icon: "1173", TGroup: TGroup.Enemy, readyAnm: "blues", endAnm: "", act: "max",
DTType: DTType.range, stun: 0, ap: 150, hit_count: 6, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote, DTType: DTType.aoe_grid, stun: 0, ap: 150, hit_count: 6, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
RType: RType.fixed, EType: EType.animationEnd, info: "召唤雷墙阻挡敌人,有概率击晕", RType: RType.fixed, EType: EType.animationEnd, info: "召唤雷墙阻挡敌人,有概率击晕",
}, },
6202: { 6202: {
uuid: 6202, name: "火墙", sp_name: "box_2", icon: "1173", TGroup: TGroup.Enemy, readyAnm: "blues", endAnm: "", act: "max", uuid: 6202, name: "火墙", sp_name: "box_2", icon: "1173", TGroup: TGroup.Enemy, readyAnm: "blues", endAnm: "", act: "max",
DTType: DTType.range, stun: 0, ap: 150, hit_count: 6, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote, DTType: DTType.aoe_grid, stun: 0, ap: 150, hit_count: 6, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
RType: RType.fixed, EType: EType.animationEnd, info: "召唤雷墙阻挡敌人,有概率击晕", RType: RType.fixed, EType: EType.animationEnd, info: "召唤雷墙阻挡敌人,有概率击晕",
}, },
6203: { 6203: {
uuid: 6203, name: "飓风", sp_name: "box_3", icon: "1173", TGroup: TGroup.Enemy, readyAnm: "blues", endAnm: "", act: "max", uuid: 6203, name: "飓风", sp_name: "box_3", icon: "1173", TGroup: TGroup.Enemy, readyAnm: "blues", endAnm: "", act: "max",
DTType: DTType.range, stun: 0, ap: 150, hit_count: 6, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote, DTType: DTType.aoe_grid, stun: 0, ap: 150, hit_count: 6, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
RType: RType.fixed, EType: EType.animationEnd, info: "召唤雷墙阻挡敌人,有概率击晕", RType: RType.fixed, EType: EType.animationEnd, info: "召唤雷墙阻挡敌人,有概率击晕",
}, },
6204: { 6204: {
uuid: 6204, name: "水墙", sp_name: "box_4", icon: "1173", TGroup: TGroup.Enemy, readyAnm: "blues", endAnm: "", act: "max", uuid: 6204, name: "水墙", sp_name: "box_4", icon: "1173", TGroup: TGroup.Enemy, readyAnm: "blues", endAnm: "", act: "max",
DTType: DTType.range, stun: 0, ap: 150, hit_count: 6, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote, DTType: DTType.aoe_grid, stun: 0, ap: 150, hit_count: 6, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
RType: RType.fixed, EType: EType.animationEnd, info: "召唤雷墙阻挡敌人,有概率击晕", RType: RType.fixed, EType: EType.animationEnd, info: "召唤雷墙阻挡敌人,有概率击晕",
}, },
6205: { 6205: {
uuid: 6205, name: "风墙", sp_name: "box_5", icon: "1173", TGroup: TGroup.Enemy, readyAnm: "blues", endAnm: "", act: "max", uuid: 6205, name: "风墙", sp_name: "box_5", icon: "1173", TGroup: TGroup.Enemy, readyAnm: "blues", endAnm: "", act: "max",
DTType: DTType.range, stun: 0, ap: 150, hit_count: 6, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote, DTType: DTType.aoe_grid, stun: 0, ap: 150, hit_count: 6, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
RType: RType.fixed, EType: EType.animationEnd, info: "召唤风墙困住敌人,有概率击晕", RType: RType.fixed, EType: EType.animationEnd, info: "召唤风墙困住敌人,有概率击晕",
}, },
6206: { 6206: {
uuid: 6206, name: "陨石术", sp_name: "box_6", icon: "1173", TGroup: TGroup.Enemy, readyAnm: "blues", endAnm: "", act: "max", uuid: 6206, name: "陨石术", sp_name: "box_6", icon: "1173", TGroup: TGroup.Enemy, readyAnm: "blues", endAnm: "", act: "max",
DTType: DTType.range, stun: 0, ap: 150, hit_count: 6, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote, DTType: DTType.aoe_grid, stun: 0, ap: 150, hit_count: 6, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
RType: RType.fixed, EType: EType.animationEnd, info: "召唤陨石范围攻击敌人,有概率击晕", RType: RType.fixed, EType: EType.animationEnd, info: "召唤陨石范围攻击敌人,有概率击晕",
}, },

View File

@@ -13,6 +13,8 @@ import { GameEvent } from "../common/config/GameEvent";
import { SkillTriggerType } from "../common/config/heroSet"; import { SkillTriggerType } from "../common/config/heroSet";
import { SkillTriggerHelper } from "./SkillTriggerHelper"; import { SkillTriggerHelper } from "./SkillTriggerHelper";
import { MissionEconomy } from "../map/MissionEconomy"; 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 { 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) { if (config.RType === RType.bezier) {
return nearestEnemy.node?.position.clone() ?? null; return nearestEnemy.node?.position.clone() ?? null;
} }