1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-07 12:17:12 +08:00

fix(MagicMissle): 修复魔法导弹加速逻辑和伤害传递问题

调整加速条件判断,确保只有存在子弹时才加速
修正子弹销毁条件为基于基础伤害值
修复子弹伤害传递问题,确保基础伤害正确传递给分裂子弹
优化场景结构,调整粒子效果和碰撞体位置
This commit is contained in:
2026-04-18 11:39:23 +08:00
parent b691618bed
commit 2d8761f110
2 changed files with 17 additions and 15 deletions
+10 -12
View File
@@ -3,7 +3,9 @@
[ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_4sjx4"]
[ext_resource type="Script" uid="uid://b1y8r5xrhhso" path="res://scripts/Contents/Bullets/MagicMissle.gd" id="2_lrw10"]
[ext_resource type="Texture2D" uid="uid://bl1i26ovfpxwc" path="res://resources/bullets/magic-missle/tr.webp" id="2_ross6"]
[ext_resource type="Texture2D" uid="uid://drikpnrvqisb0" path="res://resources/bullets/magic-missle/ninesols.png" id="2_rugh7"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_rugh7"]
height = 76.0
[sub_resource type="Curve" id="Curve_lrw10"]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.2, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
@@ -41,25 +43,21 @@ scale_max = 0.9
scale_curve = SubResource("CurveTexture_lrw10")
alpha_curve = SubResource("CurveTexture_3jny5")
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_rugh7"]
height = 76.0
[node name="MagicMissle" unique_id=5571707 instance=ExtResource("1_4sjx4")]
script = ExtResource("2_lrw10")
penerate = 1.0
penerateDamageReduction = 0.1
[node name="static" type="Sprite2D" parent="texture" parent_id_path=PackedInt32Array(162977358) index="2" unique_id=1008850333]
texture = ExtResource("2_rugh7")
[node name="trail" type="GPUParticles2D" parent="texture/static" index="0" unique_id=1403224943]
z_index = -1
position = Vector2(-35, 1)
amount = 50
texture = ExtResource("2_ross6")
visibility_rect = Rect2(-1000, -1000, 2000, 2000)
process_material = SubResource("ParticleProcessMaterial_mgg76")
[node name="hitbox" parent="." index="1" unique_id=175349408]
rotation = 1.5707964
shape = SubResource("CapsuleShape2D_rugh7")
[node name="trail" type="GPUParticles2D" parent="." index="2" unique_id=1403224943]
z_index = -1
amount = 50
texture = ExtResource("2_ross6")
visibility_rect = Rect2(-1000, -1000, 2000, 2000)
process_material = SubResource("ParticleProcessMaterial_mgg76")
+7 -3
View File
@@ -8,13 +8,16 @@ var roundBullets: Array[MagicMissleBullet]
func ai():
if accelerating:
if roundBullets.count(self ) < 1:
accelerating = false
rotation = lerp_angle(rotation, position.angle_to_point(get_global_mouse_position()), 0.1)
speedV2 += (get_global_mouse_position() - position).normalized() * 1
elif speed < 1:
tryDestroy()
elif baseDamage < 1:
tryDestroy()
speedV2 *= 0.995
speed = speedV2.length()
PresetBulletAI.forward(self , speedV2.angle())
texture.rotation += deg_to_rad(sqrt(speed))
func succeedToHit(_dmg: float, entity: EntityBase):
if powerScale > 0 && accelerating && roundBullets.count(self ) > 0:
@@ -27,8 +30,9 @@ func succeedToHit(_dmg: float, entity: EntityBase):
):
if bullet is MagicMissleBullet:
bullet.position += Vector2.from_angle(bullet.rotation) * 100
bullet.speedV2 += Vector2.from_angle(bullet.rotation) * 30
bullet.speedV2 += Vector2.from_angle(bullet.rotation) * 20
bullet.roundBullets = roundBullets
bullet.powerScale = powerScale - 1
bullet.baseDamage = baseDamage
roundBullets.append(bullet)
powerScale = 0