1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-31 00:11:54 +08:00

fix(BulletTool): 修复召唤物友军伤害判断逻辑

调整友军伤害判断逻辑,正确处理召唤物与其主人的玩家身份关系,避免误伤友军
This commit is contained in:
2026-01-28 20:34:32 +08:00
parent 4990a3e300
commit 34dde2b281
+7 -2
View File
@@ -8,8 +8,13 @@ static func fromArea(area: Area2D) -> BulletBase:
static func canDamage(bullet: BulletBase, target: EntityBase) -> bool:
if !bullet or !target or !bullet.launcher: return false
if target.currentInvinsible: return false
if !GameRule.allowFriendlyFire:
if target.isPlayer() == bullet.launcher.isPlayer() and bullet.launcher.currentFocusedBoss != target and !bullet.allowFriendlyDamage:
var launcherIsPlayer = bullet.launcher.isPlayer()
if bullet.launcher is SummonBase:
var summon = bullet.launcher as SummonBase
if is_instance_valid(summon.myMaster):
launcherIsPlayer = summon.myMaster.isPlayer()
if !GameRule.allowFriendlyFire and !bullet.allowFriendlyDamage:
if target.isPlayer() == launcherIsPlayer and bullet.launcher.currentFocusedBoss != target:
return false
if !bullet.canDamageSelf:
if target == bullet.launcher: