From 8aa2a00cd1821ef0de25d7954acd76b8f857846c Mon Sep 17 00:00:00 2001 From: wvellichor Date: Sat, 31 Jan 2026 00:13:47 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix(ASTS)=20=E4=BF=AE=E5=A4=8D=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/testScenes/AttackSkillTestScene.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/scenes/testScenes/AttackSkillTestScene.js b/scenes/testScenes/AttackSkillTestScene.js index 6be900c..9a51ce9 100644 --- a/scenes/testScenes/AttackSkillTestScene.js +++ b/scenes/testScenes/AttackSkillTestScene.js @@ -1128,17 +1128,14 @@ export default class AttackSkillTestScene extends Phaser.Scene { yuange.setSelected(true); // 更新UI提示 - this.controlInfoText.setText('当前控制: 元歌'); - - // 恢复本体的移动能力 - const yuange = this.currentlyControlled; - if (yuange) { - yuange.canMove = true; - yuange.setVelocity(0, 0); - } - - // 更新技能轮盘显示为元歌本体的技能 - this.updateSkillWheelDisplay(); + this.controlInfoText.setText('当前控制: 元歌'); + + // 恢复本体的移动能力 + yuange.canMove = true; + yuange.setVelocity(0, 0); + + // 更新技能轮盘显示为元歌本体的技能 + this.updateSkillWheelDisplay(); // 更新选择系统并锁定相机到本体 import('../../systems/ControlMode.js').then(mod => { From 8f4616bbe764050704374b626ba1da73c0de8b9d Mon Sep 17 00:00:00 2001 From: chicrobt Date: Sat, 31 Jan 2026 00:54:03 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix(ASTS)=20=E4=BF=AE=E5=A4=8D=E9=87=8A?= =?UTF-8?q?=E6=94=BE=E4=B8=80=E6=8A=80=E8=83=BD=E6=97=B6=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E4=BC=9A=E9=80=A0=E6=88=90=E6=9C=AC=E4=BD=93=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/testScenes/AttackSkillTestScene.js | 207 ++++++++++++---------- 1 file changed, 113 insertions(+), 94 deletions(-) diff --git a/scenes/testScenes/AttackSkillTestScene.js b/scenes/testScenes/AttackSkillTestScene.js index 9a51ce9..da27731 100644 --- a/scenes/testScenes/AttackSkillTestScene.js +++ b/scenes/testScenes/AttackSkillTestScene.js @@ -749,55 +749,65 @@ export default class AttackSkillTestScene extends Phaser.Scene { this.castPuppetSkill3Second(); } break; - case 4: // 技能4:傀儡快速移动并拉本体 + case 4: // 技能4:傀儡快速移动并拉本体 / 切换到本体控制(当处于技能3控制状态时) if (this.puppet && this.isControllingPuppet) { - // 使用轮盘相对方向计算目标位置 - const maxDistance = 200; - const distance = Math.sqrt(directionX * directionX + directionY * directionY); + // 检查是否处于3技能第二次按下后的控制期间 + const isInSkill3Control = this.puppetSkill3State && this.puppetSkill3State.hasSecondCast; - // 计算归一化方向向量 - let normalizedX = 0; - let normalizedY = 0; - if (distance > 0) { - normalizedX = directionX / distance; - normalizedY = directionY / distance; - } - - // 计算目标位置:傀儡当前位置 + 归一化方向向量 * 最大距离 - const targetX = this.puppet.x + normalizedX * maxDistance; - const targetY = this.puppet.y + normalizedY * maxDistance; - - // 记录傀儡的初始位置 - const initialPuppetX = this.puppet.x; - const initialPuppetY = this.puppet.y; - - // 傀儡移动到目标位置 - this.puppet.setPosition(targetX, targetY); - this.puppet.setVelocity(0, 0); - this.puppet.clearTarget(); - - // 计算傀儡位移的方向向量 - const puppetDisplacementX = targetX - initialPuppetX; - const puppetDisplacementY = targetY - initialPuppetY; - const puppetDisplacementDistance = Math.sqrt(puppetDisplacementX * puppetDisplacementX + puppetDisplacementY * puppetDisplacementY); - - // 计算本体应该移动的位置(在傀儡位移的直线上,距离傀儡一定距离) - if (puppetDisplacementDistance > 0) { - // 本体与傀儡之间的固定距离 - const bodyDistance = 150; - - // 计算本体移动的方向向量(与傀儡位移相同的方向) - const bodyMoveX = (puppetDisplacementX / puppetDisplacementDistance) * bodyDistance; - const bodyMoveY = (puppetDisplacementY / puppetDisplacementDistance) * bodyDistance; - - // 本体沿着傀儡位移的直线移动 - yuange.x = this.puppet.x - bodyMoveX; - yuange.y = this.puppet.y - bodyMoveY; + if (isInSkill3Control) { + // 处于3技能控制期间:只切换到本体控制,不执行移动和拉近逻辑 + // 切换到本体控制(保持傀儡存在) + this.switchToYuange(false); } else { - // 如果傀儡没有移动,保持本体位置不变 + // 正常情况:执行傀儡快速移动并拉本体的逻辑 + // 使用轮盘相对方向计算目标位置 + const maxDistance = 200; + const distance = Math.sqrt(directionX * directionX + directionY * directionY); + + // 计算归一化方向向量 + let normalizedX = 0; + let normalizedY = 0; + if (distance > 0) { + normalizedX = directionX / distance; + normalizedY = directionY / distance; + } + + // 计算目标位置:傀儡当前位置 + 归一化方向向量 * 最大距离 + const targetX = this.puppet.x + normalizedX * maxDistance; + const targetY = this.puppet.y + normalizedY * maxDistance; + + // 记录傀儡的初始位置 + const initialPuppetX = this.puppet.x; + const initialPuppetY = this.puppet.y; + + // 傀儡移动到目标位置 + this.puppet.setPosition(targetX, targetY); + this.puppet.setVelocity(0, 0); + this.puppet.clearTarget(); + + // 计算傀儡位移的方向向量 + const puppetDisplacementX = targetX - initialPuppetX; + const puppetDisplacementY = targetY - initialPuppetY; + const puppetDisplacementDistance = Math.sqrt(puppetDisplacementX * puppetDisplacementX + puppetDisplacementY * puppetDisplacementY); + + // 计算本体应该移动的位置(在傀儡位移的直线上,距离傀儡一定距离) + if (puppetDisplacementDistance > 0) { + // 本体与傀儡之间的固定距离 + const bodyDistance = 150; + + // 计算本体移动的方向向量(与傀儡位移相同的方向) + const bodyMoveX = (puppetDisplacementX / puppetDisplacementDistance) * bodyDistance; + const bodyMoveY = (puppetDisplacementY / puppetDisplacementDistance) * bodyDistance; + + // 本体沿着傀儡位移的直线移动 + yuange.x = this.puppet.x - bodyMoveX; + yuange.y = this.puppet.y - bodyMoveY; + } else { + // 如果傀儡没有移动,保持本体位置不变 + } + + yuange.setVelocity(0, 0); } - - yuange.setVelocity(0, 0); } break; } @@ -805,58 +815,67 @@ export default class AttackSkillTestScene extends Phaser.Scene { // 控制本体时的技能 switch (skillIndex) { case 1: // 技能1:扔出傀儡或收回傀儡 - if (this.puppet) { - // 有傀儡存在:立即收回并销毁傀儡 - this.switchToYuange(); - } else { - // 没有傀儡:创建新傀儡 - // 使用轮盘相对方向计算目标位置 - const maxDistance = 200; - const distance = Math.sqrt(directionX * directionX + directionY * directionY); - - // 计算归一化方向向量 - let normalizedX = 0; - let normalizedY = 0; - if (distance > 0) { - normalizedX = directionX / distance; - normalizedY = directionY / distance; + + // 禁用移动能力 + yuange.canMove = false; + // 停顿 + yuange.setVelocity(0, 0); + + // 延迟(0.2秒)后释放技能 + this.time.delayedCall(200, () => { + if (this.puppet) { + // 有傀儡存在:收回并销毁傀儡 + this.switchToYuange(); + } else { + // 没有傀儡:创建新傀儡 + // 使用轮盘相对方向计算目标位置 + const maxDistance = 200; + const distance = Math.sqrt(directionX * directionX + directionY * directionY); + + // 计算归一化方向向量 + let normalizedX = 0; + let normalizedY = 0; + if (distance > 0) { + normalizedX = directionX / distance; + normalizedY = directionY / distance; + } + + // 计算目标位置:元歌当前位置 + 归一化方向向量 * 最大距离 + const targetX = yuange.x + normalizedX * maxDistance; + const targetY = yuange.y + normalizedY * maxDistance; + + // 创建傀儡直接在指定位置生成,不需要从本体位置开始移动 + this.puppet = new Unit(this, targetX, targetY, 'player'); + this.puppet.name = 'yuange-puppet'; + this.puppet.type = 'yuange-puppet'; + this.puppet.setScale(0.8); + this.puppet.tint = 0x00ffff; // 用蓝色区分傀儡 + this.unitGroup.add(this.puppet); + + // 切换控制到傀儡 + this.isControllingPuppet = true; + yuange.setSelected(false); + this.currentlyControlled = this.puppet; + this.controlInfoText.setText('当前控制: 元歌傀儡'); + + // 更新技能轮盘显示为傀儡的技能 + this.updateSkillWheelDisplay(); + + // 更新ControlMode的选中列表,确保虚拟摇杆能控制傀儡 + import('../../systems/ControlMode.js').then(mod => { + mod.clearSelection(); + mod.addToSelection(this.puppet); + mod.setActiveUnit(this.puppet); + // 自动锁定相机到傀儡 + mod.setCameraLocked(true); + }); } - // 计算目标位置:元歌当前位置 + 归一化方向向量 * 最大距离 - const targetX = yuange.x + normalizedX * maxDistance; - const targetY = yuange.y + normalizedY * maxDistance; + // 立即恢复透明度 + yuange.alpha = 1; - // 创建傀儡直接在指定位置生成,不需要从本体位置开始移动 - this.puppet = new Unit(this, targetX, targetY, 'player'); - this.puppet.name = 'yuange-puppet'; - this.puppet.type = 'yuange-puppet'; - this.puppet.setScale(0.8); - this.puppet.tint = 0x00ffff; // 用蓝色区分傀儡 - this.unitGroup.add(this.puppet); - - // 切换控制到傀儡 - this.isControllingPuppet = true; - yuange.setSelected(false); - this.currentlyControlled = this.puppet; - this.controlInfoText.setText('当前控制: 元歌傀儡'); - - // 更新技能轮盘显示为傀儡的技能 - this.updateSkillWheelDisplay(); - - // 更新ControlMode的选中列表,确保虚拟摇杆能控制傀儡 - import('../../systems/ControlMode.js').then(mod => { - mod.clearSelection(); - mod.addToSelection(this.puppet); - mod.setActiveUnit(this.puppet); - // 自动锁定相机到傀儡 - mod.setCameraLocked(true); - }); - - // 技能释放完成后,恢复移动能力 - setTimeout(() => { - yuange.canMove = true; - }, 100); - } + + }, [], this); break; case 2: // 技能2:扇形飞镖攻击 this.castFanDartSkill(); From 0f6987da2abd41038a1775ef6dda5d1714dca883 Mon Sep 17 00:00:00 2001 From: chicrobt Date: Sat, 31 Jan 2026 00:58:47 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix(ASTS)=20=E4=BF=AE=E5=A4=8D=E6=8F=90?= =?UTF-8?q?=E5=89=8D=E6=94=B6=E5=9B=9E=E6=97=B6=E5=AE=9A=E6=97=B6=E6=B8=85?= =?UTF-8?q?=E6=A5=9A=E4=BB=8D=E5=9C=A8=E7=94=9F=E6=95=88=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/testScenes/AttackSkillTestScene.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scenes/testScenes/AttackSkillTestScene.js b/scenes/testScenes/AttackSkillTestScene.js index da27731..280dab4 100644 --- a/scenes/testScenes/AttackSkillTestScene.js +++ b/scenes/testScenes/AttackSkillTestScene.js @@ -1127,7 +1127,7 @@ export default class AttackSkillTestScene extends Phaser.Scene { this.puppet.clearTarget(); // 一段时间后自动销毁傀儡,切换到本体控制 - this.time.delayedCall(3000, () => { + this.puppetDestructionTimer = this.time.delayedCall(3000, () => { if (this.puppet) { // 销毁眩晕特效 if (this.stunEffect) { @@ -1173,6 +1173,9 @@ export default class AttackSkillTestScene extends Phaser.Scene { firstCastTime: 0, secondCastTime: 0 }; + + // 清除计时器引用 + this.puppetDestructionTimer = null; } }); @@ -1534,6 +1537,12 @@ export default class AttackSkillTestScene extends Phaser.Scene { */ switchToYuange(destroyPuppet = true) { if (destroyPuppet && this.puppet) { + // 清除定时销毁任务 + if (this.puppetDestructionTimer) { + this.puppetDestructionTimer.remove(); + this.puppetDestructionTimer = null; + } + // 删除傀儡 this.puppet.destroy(); this.puppet = null;