fix(战斗): 调整近战攻击逻辑与攻击动画配置
- 将技能 6001 的触发类型改为碰撞检测,提高命中准确性 - 优化近战攻击距离计算,使用配置值并增加最小距离限制 - 移除攻击动画中的多余事件,缩短动画时长 - 调整攻击预制体的碰撞体尺寸和位置,使其与实际攻击范围匹配 - 简化远程英雄战斗逻辑,移除不必要的距离判断
This commit is contained in:
@@ -9,9 +9,9 @@
|
|||||||
"_native": "",
|
"_native": "",
|
||||||
"sample": 20,
|
"sample": 20,
|
||||||
"speed": 1,
|
"speed": 1,
|
||||||
"wrapMode": 1,
|
"wrapMode": 2,
|
||||||
"enableTrsBlending": false,
|
"enableTrsBlending": false,
|
||||||
"_duration": 0.25,
|
"_duration": 0.1,
|
||||||
"_hash": 500763545,
|
"_hash": 500763545,
|
||||||
"_tracks": [
|
"_tracks": [
|
||||||
{
|
{
|
||||||
@@ -22,18 +22,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_exoticAnimation": null,
|
"_exoticAnimation": null,
|
||||||
"_events": [
|
"_events": [],
|
||||||
{
|
|
||||||
"frame": 0.15,
|
|
||||||
"func": "",
|
|
||||||
"params": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"frame": 0.15,
|
|
||||||
"func": "atk",
|
|
||||||
"params": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_embeddedPlayers": [],
|
"_embeddedPlayers": [],
|
||||||
"_additiveSettings": {
|
"_additiveSettings": {
|
||||||
"__id__": 18
|
"__id__": 18
|
||||||
@@ -132,8 +121,8 @@
|
|||||||
"__type__": "cc.RealCurve",
|
"__type__": "cc.RealCurve",
|
||||||
"_times": [
|
"_times": [
|
||||||
0,
|
0,
|
||||||
0.15,
|
0.05000000074505806,
|
||||||
0.25
|
0.10000000149011612
|
||||||
],
|
],
|
||||||
"_values": [
|
"_values": [
|
||||||
{
|
{
|
||||||
@@ -146,9 +135,7 @@
|
|||||||
"leftTangent": 0,
|
"leftTangent": 0,
|
||||||
"leftTangentWeight": 1,
|
"leftTangentWeight": 1,
|
||||||
"easingMethod": 0,
|
"easingMethod": 0,
|
||||||
"__editorExtras__": {
|
"__editorExtras__": null
|
||||||
"tangentMode": 0
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.RealKeyframeValue",
|
"__type__": "cc.RealKeyframeValue",
|
||||||
@@ -160,9 +147,7 @@
|
|||||||
"leftTangent": 0,
|
"leftTangent": 0,
|
||||||
"leftTangentWeight": 1,
|
"leftTangentWeight": 1,
|
||||||
"easingMethod": 0,
|
"easingMethod": 0,
|
||||||
"__editorExtras__": {
|
"__editorExtras__": null
|
||||||
"tangentMode": 0
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.RealKeyframeValue",
|
"__type__": "cc.RealKeyframeValue",
|
||||||
@@ -174,9 +159,7 @@
|
|||||||
"leftTangent": 0,
|
"leftTangent": 0,
|
||||||
"leftTangentWeight": 1,
|
"leftTangentWeight": 1,
|
||||||
"easingMethod": 0,
|
"easingMethod": 0,
|
||||||
"__editorExtras__": {
|
"__editorExtras__": null
|
||||||
"tangentMode": 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"preExtrapolation": 1,
|
"preExtrapolation": 1,
|
||||||
@@ -192,8 +175,8 @@
|
|||||||
"__type__": "cc.RealCurve",
|
"__type__": "cc.RealCurve",
|
||||||
"_times": [
|
"_times": [
|
||||||
0,
|
0,
|
||||||
0.15,
|
0.05000000074505806,
|
||||||
0.25
|
0.10000000149011612
|
||||||
],
|
],
|
||||||
"_values": [
|
"_values": [
|
||||||
{
|
{
|
||||||
@@ -206,9 +189,7 @@
|
|||||||
"leftTangent": 0,
|
"leftTangent": 0,
|
||||||
"leftTangentWeight": 1,
|
"leftTangentWeight": 1,
|
||||||
"easingMethod": 0,
|
"easingMethod": 0,
|
||||||
"__editorExtras__": {
|
"__editorExtras__": null
|
||||||
"tangentMode": 0
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.RealKeyframeValue",
|
"__type__": "cc.RealKeyframeValue",
|
||||||
@@ -220,9 +201,7 @@
|
|||||||
"leftTangent": 0,
|
"leftTangent": 0,
|
||||||
"leftTangentWeight": 1,
|
"leftTangentWeight": 1,
|
||||||
"easingMethod": 0,
|
"easingMethod": 0,
|
||||||
"__editorExtras__": {
|
"__editorExtras__": null
|
||||||
"tangentMode": 0
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.RealKeyframeValue",
|
"__type__": "cc.RealKeyframeValue",
|
||||||
@@ -234,9 +213,7 @@
|
|||||||
"leftTangent": 0,
|
"leftTangent": 0,
|
||||||
"leftTangentWeight": 1,
|
"leftTangentWeight": 1,
|
||||||
"easingMethod": 0,
|
"easingMethod": 0,
|
||||||
"__editorExtras__": {
|
"__editorExtras__": null
|
||||||
"tangentMode": 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"preExtrapolation": 1,
|
"preExtrapolation": 1,
|
||||||
@@ -252,8 +229,8 @@
|
|||||||
"__type__": "cc.RealCurve",
|
"__type__": "cc.RealCurve",
|
||||||
"_times": [
|
"_times": [
|
||||||
0,
|
0,
|
||||||
0.15,
|
0.05000000074505806,
|
||||||
0.25
|
0.10000000149011612
|
||||||
],
|
],
|
||||||
"_values": [
|
"_values": [
|
||||||
{
|
{
|
||||||
@@ -266,9 +243,7 @@
|
|||||||
"leftTangent": 0,
|
"leftTangent": 0,
|
||||||
"leftTangentWeight": 1,
|
"leftTangentWeight": 1,
|
||||||
"easingMethod": 0,
|
"easingMethod": 0,
|
||||||
"__editorExtras__": {
|
"__editorExtras__": null
|
||||||
"tangentMode": 0
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.RealKeyframeValue",
|
"__type__": "cc.RealKeyframeValue",
|
||||||
@@ -280,9 +255,7 @@
|
|||||||
"leftTangent": 0,
|
"leftTangent": 0,
|
||||||
"leftTangentWeight": 1,
|
"leftTangentWeight": 1,
|
||||||
"easingMethod": 0,
|
"easingMethod": 0,
|
||||||
"__editorExtras__": {
|
"__editorExtras__": null
|
||||||
"tangentMode": 0
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.RealKeyframeValue",
|
"__type__": "cc.RealKeyframeValue",
|
||||||
@@ -294,9 +267,7 @@
|
|||||||
"leftTangent": 0,
|
"leftTangent": 0,
|
||||||
"leftTangentWeight": 1,
|
"leftTangentWeight": 1,
|
||||||
"easingMethod": 0,
|
"easingMethod": 0,
|
||||||
"__editorExtras__": {
|
"__editorExtras__": null
|
||||||
"tangentMode": 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"preExtrapolation": 1,
|
"preExtrapolation": 1,
|
||||||
|
|||||||
@@ -38,13 +38,10 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 22
|
"__id__": 22
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 24
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 26
|
"__id__": 24
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -237,7 +234,7 @@
|
|||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 40,
|
"x": 0,
|
||||||
"y": -50,
|
"y": -50,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
@@ -278,7 +275,7 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 80,
|
"width": 30,
|
||||||
"height": 100
|
"height": 100
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
@@ -300,7 +297,7 @@
|
|||||||
"node": {
|
"node": {
|
||||||
"__id__": 8
|
"__id__": 8
|
||||||
},
|
},
|
||||||
"_enabled": false,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 12
|
"__id__": 12
|
||||||
},
|
},
|
||||||
@@ -400,12 +397,12 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 80,
|
"width": 30,
|
||||||
"height": 100
|
"height": 100
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
"x": 0,
|
"x": 0.5,
|
||||||
"y": 0.5
|
"y": 0.5
|
||||||
},
|
},
|
||||||
"_id": ""
|
"_id": ""
|
||||||
@@ -414,35 +411,6 @@
|
|||||||
"__type__": "cc.CompPrefabInfo",
|
"__type__": "cc.CompPrefabInfo",
|
||||||
"fileId": "63NP9yq3hEUKD/OZZZ5t7x"
|
"fileId": "63NP9yq3hEUKD/OZZZ5t7x"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"__type__": "cc.Animation",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"__editorExtras__": {},
|
|
||||||
"node": {
|
|
||||||
"__id__": 1
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"__prefab": {
|
|
||||||
"__id__": 19
|
|
||||||
},
|
|
||||||
"playOnLoad": true,
|
|
||||||
"_clips": [
|
|
||||||
{
|
|
||||||
"__uuid__": "45017156-064b-43f2-a24e-176b6ce17ad8",
|
|
||||||
"__expectedType__": "cc.AnimationClip"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_defaultClip": {
|
|
||||||
"__uuid__": "45017156-064b-43f2-a24e-176b6ce17ad8",
|
|
||||||
"__expectedType__": "cc.AnimationClip"
|
|
||||||
},
|
|
||||||
"_id": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.CompPrefabInfo",
|
|
||||||
"fileId": "c2RDvksalG2acL3tyGCY0t"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"__type__": "57aabs7TE1J5obTAZczc+64",
|
"__type__": "57aabs7TE1J5obTAZczc+64",
|
||||||
"_name": "",
|
"_name": "",
|
||||||
@@ -453,7 +421,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 21
|
"__id__": 19
|
||||||
},
|
},
|
||||||
"atk_x": 0,
|
"atk_x": 0,
|
||||||
"atk_y": 0,
|
"atk_y": 0,
|
||||||
@@ -474,7 +442,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 23
|
"__id__": 21
|
||||||
},
|
},
|
||||||
"enabledContactListener": true,
|
"enabledContactListener": true,
|
||||||
"bullet": false,
|
"bullet": false,
|
||||||
@@ -508,7 +476,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 25
|
"__id__": 23
|
||||||
},
|
},
|
||||||
"tag": 0,
|
"tag": 0,
|
||||||
"_group": 1,
|
"_group": 1,
|
||||||
@@ -518,12 +486,12 @@
|
|||||||
"_restitution": 0,
|
"_restitution": 0,
|
||||||
"_offset": {
|
"_offset": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
"x": 50,
|
"x": 0,
|
||||||
"y": 0
|
"y": 0
|
||||||
},
|
},
|
||||||
"_size": {
|
"_size": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 150,
|
"width": 30,
|
||||||
"height": 100
|
"height": 100
|
||||||
},
|
},
|
||||||
"_id": ""
|
"_id": ""
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ export const SkillSet: Record<number, SkillConfig> = {
|
|||||||
6001: {
|
6001: {
|
||||||
uuid:6001,name:"空挥",sp_name:"atk_s1",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,
|
ap:100,hit_count:1,hitcd:0.2,speed:720,with:0,
|
||||||
ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.animationEnd,
|
ready:0,EAnm:0,DAnm:9001,RType:RType.linear,EType:EType.collision,
|
||||||
buffs:[],debuffs:[],info:"对前方目标造成100%攻击的伤害",
|
buffs:[],debuffs:[],info:"对前方目标造成100%攻击的伤害",
|
||||||
},
|
},
|
||||||
6002: {
|
6002: {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { HeroViewComp } from "./HeroViewComp";
|
|||||||
import { HeroAttrsComp } from "./HeroAttrsComp";
|
import { HeroAttrsComp } from "./HeroAttrsComp";
|
||||||
import { smc } from "../common/SingletonModuleComp";
|
import { smc } from "../common/SingletonModuleComp";
|
||||||
import { FacSet } from "../common/config/GameSet";
|
import { FacSet } from "../common/config/GameSet";
|
||||||
import { HType, resolveFormationTargetX } from "../common/config/heroSet";
|
import { HeroDisVal, HType, resolveFormationTargetX } from "../common/config/heroSet";
|
||||||
import { Node } from "cc";
|
import { Node } from "cc";
|
||||||
|
|
||||||
@ecs.register('MoveComp')
|
@ecs.register('MoveComp')
|
||||||
@@ -36,7 +36,8 @@ interface MoveFacConfig {
|
|||||||
|
|
||||||
@ecs.register('MoveSystem')
|
@ecs.register('MoveSystem')
|
||||||
export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
|
export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
|
||||||
private readonly meleeAttackRange = 52;
|
private readonly meleeAttackRange = HeroDisVal[HType.Melee];
|
||||||
|
private readonly meleeMinEnemyDistanceX = 80;
|
||||||
private readonly allySpacingX = 40;
|
private readonly allySpacingX = 40;
|
||||||
private readonly allyOverlapSpacingX = 14;
|
private readonly allyOverlapSpacingX = 14;
|
||||||
private readonly displacementReleaseX = 10;
|
private readonly displacementReleaseX = 10;
|
||||||
@@ -172,38 +173,39 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
|||||||
const enemyX = enemy.node.position.x;
|
const enemyX = enemy.node.position.x;
|
||||||
const dist = Math.abs(currentX - enemyX);
|
const dist = Math.abs(currentX - enemyX);
|
||||||
const maxRange = this.meleeAttackRange;
|
const maxRange = this.meleeAttackRange;
|
||||||
|
const minRange = Math.min(this.meleeMinEnemyDistanceX, maxRange);
|
||||||
|
|
||||||
move.direction = enemyX > currentX ? 1 : -1;
|
move.direction = enemyX > currentX ? 1 : -1;
|
||||||
move.targetX = enemyX - move.direction * maxRange;
|
move.targetX = enemyX - move.direction * minRange;
|
||||||
|
|
||||||
if (dist <= maxRange) {
|
if (dist <= minRange) {
|
||||||
view.status_change("idle");
|
view.status_change("idle");
|
||||||
model.is_atking = true;
|
model.is_atking = true;
|
||||||
|
} else if (dist <= maxRange) {
|
||||||
|
const speed = model.speed / 3;
|
||||||
|
this.moveEntity(view, move.direction, speed, move.targetX);
|
||||||
|
model.is_atking = true;
|
||||||
} else {
|
} else {
|
||||||
const speed = model.speed / 3;
|
const speed = model.speed / 3;
|
||||||
this.moveEntity(view, move.direction, speed, move.targetX);
|
this.moveEntity(view, move.direction, speed);
|
||||||
model.is_atking = true;
|
model.is_atking = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private processMidLogic(e: ecs.Entity, move: MoveComp, view: HeroViewComp, model: HeroAttrsComp, enemy: HeroViewComp) {
|
private processMidLogic(e: ecs.Entity, move: MoveComp, view: HeroViewComp, model: HeroAttrsComp, enemy: HeroViewComp) {
|
||||||
this.processRangedFormationCombat(move, view, model, enemy, 120, 360);
|
this.processRangedFormationCombat(move, view, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
private processLongLogic(e: ecs.Entity, move: MoveComp, view: HeroViewComp, model: HeroAttrsComp, enemy: HeroViewComp) {
|
private processLongLogic(e: ecs.Entity, move: MoveComp, view: HeroViewComp, model: HeroAttrsComp, enemy: HeroViewComp) {
|
||||||
this.processRangedFormationCombat(move, view, model, enemy, 360, 720);
|
this.processRangedFormationCombat(move, view, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
private processRangedFormationCombat(move: MoveComp, view: HeroViewComp, model: HeroAttrsComp, enemy: HeroViewComp, defaultMin: number, defaultMax: number) {
|
private processRangedFormationCombat(move: MoveComp, view: HeroViewComp, model: HeroAttrsComp) {
|
||||||
const currentX = view.node.position.x;
|
const currentX = view.node.position.x;
|
||||||
const enemyX = enemy.node.position.x;
|
|
||||||
const targetX = this.getFixedFormationX(model);
|
const targetX = this.getFixedFormationX(model);
|
||||||
move.targetX = targetX;
|
move.targetX = targetX;
|
||||||
const [minRange, maxRange] = this.resolveCombatRange(model, defaultMin, defaultMax);
|
|
||||||
const dist = Math.abs(currentX - enemyX);
|
|
||||||
const needMoveToFormation = Math.abs(currentX - targetX) > 5;
|
const needMoveToFormation = Math.abs(currentX - targetX) > 5;
|
||||||
const shouldKeepDistance = dist < minRange;
|
if (needMoveToFormation) {
|
||||||
if (needMoveToFormation || shouldKeepDistance) {
|
|
||||||
const dir = targetX > currentX ? 1 : -1;
|
const dir = targetX > currentX ? 1 : -1;
|
||||||
move.direction = dir;
|
move.direction = dir;
|
||||||
const speed = model.speed / 3;
|
const speed = model.speed / 3;
|
||||||
|
|||||||
Reference in New Issue
Block a user