From 7f52f4b805b4790efccc8e764c70895b012deb79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=A8=E8=90=BD=E5=9F=BA=E5=9B=B4=E8=99=BE?= <3161880837@qq.com> Date: Sat, 22 Nov 2025 08:25:26 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=AD=A6=E5=99=A8=E7=B3=BB=E7=BB=9F):?= =?UTF-8?q?=20=E9=87=8D=E6=9E=84=E7=81=AB=E5=B1=B1=E6=AD=A6=E5=99=A8?= =?UTF-8?q?=E5=92=8C=E7=81=AB=E6=89=AB=E5=BC=B9=E6=94=BB=E5=87=BB=E6=9C=BA?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除火扫弹的独立脚本和火罐效果,改为直接在子弹中实现 火山武器改为三段伤害机制并调整基础伤害值 添加子弹基础伤害乘数数组支持多段伤害 更新相关场景和资源配置以匹配新机制 --- components/Bullets/FireScan.tscn | 96 ++++++++++++++++++++++-- components/Characters/Chick.tscn | 6 +- components/Effects/FirePot.tscn | 12 +-- components/Weapons/Volcano.tscn | 15 +++- scripts/Contents/Bullets/FireScan.gd | 6 -- scripts/Contents/Bullets/FireScan.gd.uid | 1 - scripts/Contents/Bullets/FoxZhua.gd | 2 +- scripts/Contents/Characters/Chick.gd | 7 +- scripts/Contents/Weapons/Volcano.gd | 1 - scripts/Statemachine/BulletBase.gd | 4 + 10 files changed, 112 insertions(+), 38 deletions(-) delete mode 100644 scripts/Contents/Bullets/FireScan.gd delete mode 100644 scripts/Contents/Bullets/FireScan.gd.uid diff --git a/components/Bullets/FireScan.tscn b/components/Bullets/FireScan.tscn index 6677fee..64dc266 100644 --- a/components/Bullets/FireScan.tscn +++ b/components/Bullets/FireScan.tscn @@ -1,17 +1,97 @@ -[gd_scene load_steps=4 format=3 uid="uid://db2cbgyyjpydp"] +[gd_scene load_steps=7 format=3 uid="uid://db2cbgyyjpydp"] [ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_cqre5"] -[ext_resource type="Script" uid="uid://dlg4g03ppdd2x" path="res://scripts/Contents/Bullets/FireScan.gd" id="2_qprdp"] +[ext_resource type="PackedScene" uid="uid://dny25qkcvtaa2" path="res://components/Effects/FirePot.tscn" id="3_ybjor"] + +[sub_resource type="Animation" id="Animation_ybjor"] +resource_name = "spawn" +step = 0.05 +tracks/0/type = "method" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("%texture/../firePot") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"values": [{ +"args": [], +"method": &"shot" +}] +} +tracks/1/type = "bezier" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("%hitbox:position:x") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"handle_modes": PackedInt32Array(0, 1), +"points": PackedFloat32Array(0, -0.25, 0, 0, 250, 500, 0, 0, 0, 0), +"times": PackedFloat32Array(0, 1) +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("%texture/..:damage") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0, 1), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [15.0, 0.0] +} + +[sub_resource type="Animation" id="Animation_ikuic"] +length = 0.001 +tracks/0/type = "bezier" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("%hitbox:position:x") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("%texture/..:damage") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [10.0] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_ikuic"] +_data = { +&"RESET": SubResource("Animation_ikuic"), +&"spawn": SubResource("Animation_ybjor") +} [sub_resource type="RectangleShape2D" id="RectangleShape2D_4qcsn"] -size = Vector2(10, 200) +size = Vector2(10, 100) [node name="FireScan" instance=ExtResource("1_cqre5")] -script = ExtResource("2_qprdp") -displayName = "狱炎" -speed = 15.0 -damage = 15.0 -lifeDistance = 500.0 +displayName = "雪葬" +penerate = 1.0 +autoSpawnAnimation = true +freeAfterSpawn = true +metadata/_edit_vertical_guides_ = [488.0] + +[node name="animator" parent="texture" index="0"] +libraries = { +&"": SubResource("AnimationLibrary_ikuic") +} [node name="hitbox" parent="." index="1"] shape = SubResource("RectangleShape2D_4qcsn") + +[node name="firePot" parent="." index="2" instance=ExtResource("3_ybjor")] diff --git a/components/Characters/Chick.tscn b/components/Characters/Chick.tscn index fa8a19d..21401fa 100644 --- a/components/Characters/Chick.tscn +++ b/components/Characters/Chick.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=15 format=3 uid="uid://b0ncrvm8u4pox"] +[gd_scene load_steps=14 format=3 uid="uid://b0ncrvm8u4pox"] [ext_resource type="PackedScene" uid="uid://cvogxi7mktumf" path="res://components/Abstracts/EntityBase.tscn" id="1_goqmy"] [ext_resource type="Script" uid="uid://b2gg1fh0bflu7" path="res://scripts/Contents/Characters/Chick.gd" id="2_r6bub"] @@ -7,7 +7,6 @@ [ext_resource type="AudioStream" uid="uid://b10u6iir6uvqn" path="res://resources/sounds/effect/BigLaser.wav" id="4_mrsne"] [ext_resource type="AudioStream" uid="uid://bf34p3xnsosgj" path="res://resources/sounds/effect/Dun Dun Dunnn.wav" id="4_w0sit"] [ext_resource type="AudioStream" uid="uid://cee6rxv2uqynh" path="res://resources/sounds/effect/Flame.ogg" id="5_vcsbb"] -[ext_resource type="PackedScene" uid="uid://dny25qkcvtaa2" path="res://components/Effects/FirePot.tscn" id="6_kvx3n"] [ext_resource type="AudioStream" uid="uid://dn6bijr513wyp" path="res://resources/sounds/effect/Drum Boing.wav" id="7_qjhwc"] [ext_resource type="Texture2D" uid="uid://k0hcr5u2xlk6" path="res://resources/characters/chick/fox.png" id="8_k8ox8"] @@ -100,9 +99,6 @@ shape = SubResource("CircleShape2D_w0sit") [node name="normal" type="Node2D" parent="texture/weapons" index="0"] position = Vector2(134, -130) -[node name="firepot" parent="texture/weapons/normal" index="0" instance=ExtResource("6_kvx3n")] -unique_name_in_owner = true - [node name="foot" type="Node2D" parent="texture/weapons" index="1"] position = Vector2(56, 28) diff --git a/components/Effects/FirePot.tscn b/components/Effects/FirePot.tscn index bf710b0..7188f8b 100644 --- a/components/Effects/FirePot.tscn +++ b/components/Effects/FirePot.tscn @@ -3,7 +3,7 @@ [ext_resource type="PackedScene" uid="uid://bcvuuy2m0pke0" path="res://components/Abstracts/EffectBase.tscn" id="1_k7ukc"] [sub_resource type="Curve" id="Curve_ohc88"] -_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.2, 1), 0.0, 0.0, 0, 0, Vector2(0.5, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.2, 1), 0.0, 0.0, 0, 0, Vector2(0.6, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] point_count = 4 [sub_resource type="CurveTexture" id="CurveTexture_6awim"] @@ -37,10 +37,10 @@ emission_shape = 1 emission_sphere_radius = 50.0 angle_min = 1.07288e-05 angle_max = 360.0 -spread = 5.0 -initial_velocity_min = 10.0 -initial_velocity_max = 500.0 -gravity = Vector3(980, 0, 0) +spread = 0.0 +initial_velocity_min = 100.0 +initial_velocity_max = 750.0 +gravity = Vector3(0, 0, 0) linear_accel_min = -2.23517e-06 linear_accel_max = -2.23517e-06 linear_accel_curve = SubResource("CurveTexture_1flsn") @@ -54,6 +54,6 @@ alpha_curve = SubResource("CurveTexture_6awim") metadata/_edit_vertical_guides_ = [808.0] [node name="particles" parent="." index="1"] -amount = 100 +amount = 150 local_coords = true process_material = SubResource("ParticleProcessMaterial_pah3d") diff --git a/components/Weapons/Volcano.tscn b/components/Weapons/Volcano.tscn index 8447bfb..6feef0f 100644 --- a/components/Weapons/Volcano.tscn +++ b/components/Weapons/Volcano.tscn @@ -5,6 +5,7 @@ [ext_resource type="Script" uid="uid://cbihum34xs8ev" path="res://scripts/Contents/Weapons/Volcano.gd" id="2_ihngx"] [node name="Volcano" instance=ExtResource("1_3uhfa")] +clip_contents = true script = ExtResource("2_ihngx") avatarTexture = ExtResource("2_hh01t") displayName = "火山" @@ -12,15 +13,21 @@ quality = 4 typeTopic = 2 costBeachball = 300 store = { -"atk": 20, +"atk": 15.0, +"dmg1": 1.0, +"dmg2": 0.5, +"dmg3": 2.0, "rotate": 0.1 } storeType = { "atk": 1, +"dmg1": 2, +"dmg2": 2, +"dmg3": 2, "rotate": 2 } -descriptionTemplate = "召唤1支[b]火山[/b],以$rotate的效率跟随鼠标指向,接触时造成$atk点伤害。" -cooldown = 2000.0 +descriptionTemplate = "召唤1支[b]火山[/b],以$rotate的效率跟随鼠标指向,进行3段攻击。基础接触伤害为$atk,三段造成的伤害分别为$dmg1,$dmg2,$dmg3。" +cooldown = 1750.0 debugRebuild = true [node name="avatar" parent="container/info" index="0"] @@ -38,4 +45,4 @@ quality = 4 typeTopic = 2 [node name="description" parent="container" index="2"] -text = "[center]召唤1支[b]火山[/b],以[color=cyan]10%[/color]的效率跟随鼠标指向,接触时造成[color=cyan]20[/color]点伤害。[/center]" +text = "[center]召唤1支[b]火山[/b],以[color=cyan]10%[/color]的效率跟随鼠标指向,进行3段攻击。基础接触伤害为[color=cyan]15[/color],三段造成的伤害分别为[color=cyan]100%[/color],[color=cyan]50%[/color],[color=cyan]200%[/color]。[/center]" diff --git a/scripts/Contents/Bullets/FireScan.gd b/scripts/Contents/Bullets/FireScan.gd deleted file mode 100644 index 79feb1d..0000000 --- a/scripts/Contents/Bullets/FireScan.gd +++ /dev/null @@ -1,6 +0,0 @@ -extends BulletBase -class_name FireScan - -func ai(): - PresetBulletAI.forward(self, rotation) - damage = (1 - lifeDistancePercent()) * originalDamage diff --git a/scripts/Contents/Bullets/FireScan.gd.uid b/scripts/Contents/Bullets/FireScan.gd.uid deleted file mode 100644 index 629a3be..0000000 --- a/scripts/Contents/Bullets/FireScan.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://dlg4g03ppdd2x diff --git a/scripts/Contents/Bullets/FoxZhua.gd b/scripts/Contents/Bullets/FoxZhua.gd index 5b436cb..0a6304a 100644 --- a/scripts/Contents/Bullets/FoxZhua.gd +++ b/scripts/Contents/Bullets/FoxZhua.gd @@ -5,4 +5,4 @@ class_name FoxZhua func ai(): if canTrace: - PresetBulletAI.lerpPosition(self, launcher.currentFocusedBoss.getTrackingAnchor() - Vector2(0, 200), speed) \ No newline at end of file + PresetBulletAI.lerpPosition(self, launcher.currentFocusedBoss.getTrackingAnchor() - Vector2(0, 200), speed) diff --git a/scripts/Contents/Characters/Chick.gd b/scripts/Contents/Characters/Chick.gd index 060cf0d..edee2df 100644 --- a/scripts/Contents/Characters/Chick.gd +++ b/scripts/Contents/Characters/Chick.gd @@ -1,8 +1,6 @@ extends EntityBase class_name Chick -@onready var firepot = $"%firepot" - var played: bool = false func register(): @@ -43,10 +41,7 @@ func attack(type): BulletBase.generate(ComponentManager.getBullet("ChickLaser"), self, texture.global_position, deg_to_rad(360.0 / laserCount * i)) elif type == 2: var weaponPos = findWeaponAnchor("normal") - var target = weaponPos.angle_to_point(currentFocusedBoss.getTrackingAnchor()) - firepot.global_rotation = target - firepot.shot() - BulletBase.generate(ComponentManager.getBullet("FireScan"), self, weaponPos, target) + BulletBase.generate(ComponentManager.getBullet("FireScan"), self, weaponPos, weaponPos.angle_to_point(currentFocusedBoss.getTrackingAnchor())) elif type == 3: BulletBase.generate(ComponentManager.getBullet("ChickSprint"), self, position, 0) trySprint() diff --git a/scripts/Contents/Weapons/Volcano.gd b/scripts/Contents/Weapons/Volcano.gd index 49ee374..43932b7 100644 --- a/scripts/Contents/Weapons/Volcano.gd +++ b/scripts/Contents/Weapons/Volcano.gd @@ -2,7 +2,6 @@ extends Weapon func update(to: int, origin: Dictionary, _entity: EntityBase): - origin["atk"] += 3 * to * soulLevel origin["rotate"] += 0.015 * to * soulLevel return origin func attack(entity: EntityBase): diff --git a/scripts/Statemachine/BulletBase.gd b/scripts/Statemachine/BulletBase.gd index 4d2ab52..908f15a 100644 --- a/scripts/Statemachine/BulletBase.gd +++ b/scripts/Statemachine/BulletBase.gd @@ -31,6 +31,8 @@ var isChildSplit: bool = false var isChildRefract: bool = false var initialSpeed: float = 0 var originalDamage: float = 0 +var damageMultiplier: Array[float] = [1.0] +var usingDamageMultiplier: int = 0 func _ready(): initialSpeed = speed @@ -84,6 +86,8 @@ func _physics_process(_delta: float) -> void: else: tryDestroy() +func getDamage(): + return originalDamage * damageMultiplier[usingDamageMultiplier] func hit(target: Node): var entity: EntityBase = EntityTool.fromHurtbox(target) if !entity || !launcher: return