diff --git a/assets/script/game/common/config/GameSet.ts b/assets/script/game/common/config/GameSet.ts index 249cda6c..32d5c55c 100644 --- a/assets/script/game/common/config/GameSet.ts +++ b/assets/script/game/common/config/GameSet.ts @@ -14,19 +14,11 @@ export enum BoxSet { DEFAULT = 1, MONSTER = 2, HERO = 4, - // MONSTER_SKILL = 8, - // HERO_SKILL = 16, - // PLAYER=32, - // BOSS=64, - - // BOX_WIDTH = 64, - // BOX_HEIGHT = 64, //地图边界 LETF_END = -420, RIGHT_END = 420, - //游戏地平线 - GAME_LINE = 0, + GAME_LINE = 120, //攻击距离 } diff --git a/assets/script/game/common/config/heroSet.ts b/assets/script/game/common/config/heroSet.ts index 496fcd64..f455c7a0 100644 --- a/assets/script/game/common/config/heroSet.ts +++ b/assets/script/game/common/config/heroSet.ts @@ -1,5 +1,5 @@ import { v3 } from "cc" -import { FacSet } from "./GameSet" +import { BoxSet, FacSet } from "./GameSet" import { smc } from "../SingletonModuleComp" import { BuffConf } from "./SkillSet" @@ -46,23 +46,23 @@ export const getMonList = ()=>{ } export const HeroPos={ - 0:{pos:v3(-240,120,0)}, - 1:{pos:v3(0,120,0)}, - 2:{pos:v3(0,120,0)}, + 0:{pos:v3(-240,BoxSet.GAME_LINE,0)}, + 1:{pos:v3(0,BoxSet.GAME_LINE,0)}, + 2:{pos:v3(0,BoxSet.GAME_LINE,0)}, } export const MonSet = { - 0:{pos:v3(240,130,0)}, - 1:{pos:v3(240,110,0)}, - 2:{pos:v3(300,130,0)}, - 3:{pos:v3(300,110,0)}, - 4:{pos:v3(320,130,0)}, - 5:{pos:v3(320,110,0)}, - 6:{pos:v3(360,130,0)}, - 7:{pos:v3(360,110,0)}, - 8:{pos:v3(400,130,0)}, - 9:{pos:v3(400,110,0)}, - 10:{pos:v3(440,130,0)}, - 11:{pos:v3(440,110,0)}, + 0:{pos:v3(240,BoxSet.GAME_LINE+10,0)}, + 1:{pos:v3(240,BoxSet.GAME_LINE-10,0)}, + 2:{pos:v3(300,BoxSet.GAME_LINE+10,0)}, + 3:{pos:v3(300,BoxSet.GAME_LINE-10,0)}, + 4:{pos:v3(320,BoxSet.GAME_LINE+10,0)}, + 5:{pos:v3(320,BoxSet.GAME_LINE-10,0)}, + 6:{pos:v3(360,BoxSet.GAME_LINE+10,0)}, + 7:{pos:v3(360,BoxSet.GAME_LINE-10,0)}, + 8:{pos:v3(400,BoxSet.GAME_LINE+10,0)}, + 9:{pos:v3(400,BoxSet.GAME_LINE-10,0)}, + 10:{pos:v3(440,BoxSet.GAME_LINE+10,0)}, + 11:{pos:v3(440,BoxSet.GAME_LINE-10,0)}, } export enum MonStart { diff --git a/assets/script/game/hero/SACastSystem.ts b/assets/script/game/hero/SACastSystem.ts index a5d22e9a..4735a05b 100644 --- a/assets/script/game/hero/SACastSystem.ts +++ b/assets/script/game/hero/SACastSystem.ts @@ -8,6 +8,7 @@ import { Skill } from "../skill/Skill"; import { smc } from "../common/SingletonModuleComp"; import { TalComp } from "./TalComp"; import { TalEffet, TriType } from "../common/config/TalSet"; +import { BoxSet } from "../common/config/GameSet"; /** * ==================== 自动施法系统 ==================== @@ -192,7 +193,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat /** * 创建技能实体 */ - private createSkill(s_uuid: number, caster: HeroViewComp,targets,isWFuny:boolean) { + private createSkill(s_uuid: number, caster: HeroViewComp,targets:Vec3[]=[],isWFuny:boolean) { // 检查节点有效性 if (!caster.node || !caster.node.isValid) { console.warn("[SACastSystem] 施法者节点无效"); @@ -226,17 +227,9 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat */ private sTargets(caster: HeroViewComp): Vec3[] { // 简化版:选择最前方的敌人 - const targets: Vec3[] = []; - - // 这里可以调用 SkillConComp 的目标选择逻辑 - // 暂时返回默认位置 - if (caster == null) return targets; - if (caster.ent == null) return targets; - const heroAttrs = caster.ent.get(HeroAttrsComp); - const fac = heroAttrs?.fac ?? 0; - const defaultX = fac === 0 ? 400 : -400; - targets.push(v3(defaultX, 0, 0)); - + let heroAttrs = caster.ent.get(HeroAttrsComp); + if (!heroAttrs) return []; + let targets=this.sDefaultTargets(caster,heroAttrs.fac) return targets; } @@ -264,82 +257,30 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat return targets; } - /** - * 选择治疗技能目标 - */ - private sHealTargets(caster: HeroViewComp, config: any, maxTargets: number): Vec3[] { - const targets: Vec3[] = []; - const heroAttrs = caster.ent.get(HeroAttrsComp); - if (!heroAttrs) return targets; - - // 寻找血量最低的友军 - const allyPositions = this.findLowHealthAllies(caster, heroAttrs.fac, config.range || 200); - - for (let i = 0; i < Math.min(maxTargets, allyPositions.length); i++) { - targets.push(allyPositions[i]); - } - - // 如果没有找到友军,治疗自己 - if (targets.length === 0 && caster.node) { - targets.push(caster.node.position.clone()); - } - - return targets; - } - - /** - * 选择BUFF技能目标 - */ - private sBuffTargets(caster: HeroViewComp, config: any, maxTargets: number): Vec3[] { - // BUFF技能通常施放在自己或友军身上 - return this.sHealTargets(caster, config, maxTargets); - } - - /** - * 选择DEBUFF技能目标 - */ - private sDebuffTargets(caster: HeroViewComp, config: any, maxTargets: number): Vec3[] { - // DEBUFF技能通常施放在敌人身上 - return this.sDamageTargets(caster, config, maxTargets); - } + + /** * 选择默认目标 */ - private sDefaultTargets(caster: HeroViewComp, faction: number): Vec3[] { + private sDefaultTargets(caster: HeroViewComp, fac: number): Vec3[] { const targets: Vec3[] = []; - const defaultX = faction === 0 ? 400 : -400; - targets.push(v3(defaultX, 0, 0)); + const defaultX = fac === 0 ? 400 : -400; + targets.push(v3(defaultX, BoxSet.GAME_LINE, 1)); return targets; } /** * 查找附近的敌人 */ - private findNearbyEnemies(caster: HeroViewComp, faction: number, range: number): Vec3[] { - // 简化实现,实际应该查询ECS中的敌方实体 + private findNearbyEnemies(caster: HeroViewComp, fac: number, range: number): Vec3[] { const enemies: Vec3[] = []; - // 模拟敌人位置 - const enemyX = faction === 0 ? 300 : -300; - enemies.push(v3(enemyX, 0, 0)); - enemies.push(v3(enemyX + 50, 20, 0)); + return enemies; } - - /** - * 查找血量低的友军 - */ - private findLowHealthAllies(caster: HeroViewComp, faction: number, range: number): Vec3[] { - // 简化实现,实际应该查询ECS中的友方实体并按血量排序 - const allies: Vec3[] = []; - - // 如果自己血量低,优先治疗自己 - - - return allies; - } + /** * 检查技能攻击范围内是否有敌人