From f8efdc639d537853adfa61b743cba0298a208ea7 Mon Sep 17 00:00:00 2001 From: Joywayer Date: Thu, 23 Jul 2026 10:54:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(boss):=20=E9=98=B2=E7=8E=A9=E5=AE=B6?= =?UTF-8?q?=E6=AD=BB=E4=BA=A1=E8=87=B4=E5=91=BD=E4=B8=80=E5=87=BB=E9=87=8D?= =?UTF-8?q?=E5=85=A5=20=E2=80=94=E2=80=94=20EnemyBulletManager.=5Fswap=5Fa?= =?UTF-8?q?nd=5Fpop=20=E8=B4=9F=E6=95=B0=E5=AE=88=E5=8D=AB=20+=20BossManag?= =?UTF-8?q?er=20=E5=BE=AA=E7=8E=AF=E5=86=85=E5=A4=B1=E6=95=88=E9=94=AE?= =?UTF-8?q?=E8=B7=B3=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/autoloads/boss_manager.gd | 2 ++ scripts/autoloads/enemy_bullet_manager.gd | 2 ++ 2 files changed, 4 insertions(+) diff --git a/scripts/autoloads/boss_manager.gd b/scripts/autoloads/boss_manager.gd index df7b6f3..7f0d586 100644 --- a/scripts/autoloads/boss_manager.gd +++ b/scripts/autoloads/boss_manager.gd @@ -50,6 +50,8 @@ func _physics_process(delta: float) -> void: if _active.is_empty(): return for boss_id in _active.keys(): + if not _active.has(boss_id): + continue # 防重入:本帧内被 reset()/erase(如玩家死亡致命一击)→ 跳过已失效键 if not EnemyManager.has_entity(boss_id): continue var st: Dictionary = _active[boss_id] diff --git a/scripts/autoloads/enemy_bullet_manager.gd b/scripts/autoloads/enemy_bullet_manager.gd index 7dc90f6..5ba8da5 100644 --- a/scripts/autoloads/enemy_bullet_manager.gd +++ b/scripts/autoloads/enemy_bullet_manager.gd @@ -37,6 +37,8 @@ func _physics_process(delta: float) -> void: i += 1 func _swap_and_pop(idx: int) -> void: + if _active_count <= 0: + return # 防重入:玩家死亡致命一击触发 reset() 已清空池,勿再 -1 var last: int = _active_count - 1 if idx != last: var b_i: int = idx * ENEMY_BULLET_STRIDE