From 561be7c734e83cfdb68963f0ae0f28068ee5fd52 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: Fri, 6 Mar 2026 23:19:22 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=AD=A6=E5=99=A8):=20=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E9=85=B8=E8=9A=80=E9=A3=8E=E6=9A=B4=E6=AD=A6=E5=99=A8=E5=8F=8A?= =?UTF-8?q?=E5=85=B6=E7=9B=B8=E5=85=B3=E5=AD=90=E5=BC=B9=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加酸蚀风暴武器,它会发射一个吸引五种不同类型酸液子弹的风暴中心 修改酸液子弹基类以支持风暴效果 调整酸风武器的属性值和描述 移除旧版随机发射酸液子弹的逻辑 --- components/Bullets/AcidBulletBase.tscn | 5 +- components/Bullets/AcidC.tscn | 1 - components/Bullets/AcidStorm.tscn | 125 +++++++++++++++++++++ components/Characters/Rooster.tscn | 6 +- components/Weapons/AcidWind.tscn | 36 +++--- scripts/Contents/Bullets/AcidBulletBase.gd | 16 ++- scripts/Contents/Bullets/AcidC.gd | 10 +- scripts/Contents/Bullets/AcidN.gd | 2 +- scripts/Contents/Bullets/AcidP.gd | 4 - scripts/Contents/Bullets/AcidStorm.gd | 45 ++++++++ scripts/Contents/Bullets/AcidStorm.gd.uid | 1 + scripts/Contents/Weapons/AcidWind.gd | 62 +++++----- 12 files changed, 241 insertions(+), 72 deletions(-) create mode 100644 components/Bullets/AcidStorm.tscn create mode 100644 scripts/Contents/Bullets/AcidStorm.gd create mode 100644 scripts/Contents/Bullets/AcidStorm.gd.uid diff --git a/components/Bullets/AcidBulletBase.tscn b/components/Bullets/AcidBulletBase.tscn index 2ac7d10..08b5215 100644 --- a/components/Bullets/AcidBulletBase.tscn +++ b/components/Bullets/AcidBulletBase.tscn @@ -19,10 +19,7 @@ animations = [{ script = ExtResource("2_y4hkm") acidType = 0 displayName = "酸液" -lifeTime = 2000.0 +lifeTime = 1000.0 [node name="texture" parent="." index="0"] sprite_frames = SubResource("SpriteFrames_3gf7s") - -[node name="hitbox" parent="." index="1"] -visible = false diff --git a/components/Bullets/AcidC.tscn b/components/Bullets/AcidC.tscn index 2035409..e60c451 100644 --- a/components/Bullets/AcidC.tscn +++ b/components/Bullets/AcidC.tscn @@ -7,7 +7,6 @@ script = ExtResource("2_nxpf5") speed = 5.0 penerate = 1.0 -lifeTime = 4000.0 canDoDuplicate = false [node name="texture" parent="." index="0"] diff --git a/components/Bullets/AcidStorm.tscn b/components/Bullets/AcidStorm.tscn new file mode 100644 index 0000000..c3eab9f --- /dev/null +++ b/components/Bullets/AcidStorm.tscn @@ -0,0 +1,125 @@ +[gd_scene load_steps=9 format=3 uid="uid://clr5pbkifgear"] + +[ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_qpsi6"] +[ext_resource type="Script" uid="uid://dl7d0v7f2uute" path="res://scripts/Contents/Bullets/AcidStorm.gd" id="2_daxsl"] +[ext_resource type="Texture2D" uid="uid://ckr8tw7fsa7qx" path="res://resources/weapons/AcidWind.png" id="2_ivaud"] + +[sub_resource type="SpriteFrames" id="SpriteFrames_daxsl"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": ExtResource("2_ivaud") +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] + +[sub_resource type="Animation" id="Animation_hfcmp"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:rotation") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [0.0] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath(".:scale") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(0.2, 0.2)] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath(".:modulate") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 1, 1, 1)] +} + +[sub_resource type="Animation" id="Animation_daxsl"] +resource_name = "spawn" +length = 5.0 +step = 0.1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:scale") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 5), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Vector2(0.2, 0.2), Vector2(1, 1)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath(".:modulate") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 5), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath(".:rotation") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0, 5), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [0.0, 12.566370614359172] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_5atmc"] +_data = { +&"RESET": SubResource("Animation_hfcmp"), +&"spawn": SubResource("Animation_daxsl") +} + +[sub_resource type="CircleShape2D" id="CircleShape2D_daxsl"] +radius = 59.008472 + +[node name="AcidStorm" instance=ExtResource("1_qpsi6")] +script = ExtResource("2_daxsl") +speed = 2.5 +penerate = 1.0 +autoSpawnAnimation = true +freeAfterSpawn = true + +[node name="texture" parent="." index="0"] +scale = Vector2(0.2, 0.2) +sprite_frames = SubResource("SpriteFrames_daxsl") + +[node name="animator" parent="texture" index="0"] +libraries = { +&"": SubResource("AnimationLibrary_5atmc") +} + +[node name="hitbox" parent="." index="1"] +shape = SubResource("CircleShape2D_daxsl") +disabled = true diff --git a/components/Characters/Rooster.tscn b/components/Characters/Rooster.tscn index f6ff70e..43f72d9 100644 --- a/components/Characters/Rooster.tscn +++ b/components/Characters/Rooster.tscn @@ -2,7 +2,7 @@ [ext_resource type="PackedScene" uid="uid://cvogxi7mktumf" path="res://components/Abstracts/EntityBase.tscn" id="1_e5pl8"] [ext_resource type="Script" uid="uid://cthtupc6dtbav" path="res://scripts/Contents/Characters/Rooster.gd" id="2_oqdqd"] -[ext_resource type="PackedScene" uid="uid://dqywctcj4y2xi" path="res://components/Weapons/Cogwheel.tscn" id="3_da2ca"] +[ext_resource type="PackedScene" uid="uid://yq7vmijwvgx1" path="res://components/Weapons/AcidWind.tscn" id="3_0omr3"] [ext_resource type="PackedScene" uid="uid://c0n3igy4hucrg" path="res://components/Weapons/PurpleCrystal.tscn" id="4_0omr3"] [ext_resource type="AudioStream" uid="uid://cdrevrq7n6yqa" path="res://resources/sounds/effect/Boing.mp3" id="4_66s6c"] [ext_resource type="AudioStream" uid="uid://benyec5bqni0b" path="res://resources/sounds/effect/Chomp.wav" id="4_k0yme"] @@ -112,9 +112,11 @@ process_material = SubResource("ParticleProcessMaterial_joj4g") [node name="weaponStore" parent="." index="2"] process_mode = 4 -[node name="Cogwheel" parent="weaponStore" index="0" instance=ExtResource("3_da2ca")] +[node name="AcidWind" parent="weaponStore" index="0" instance=ExtResource("3_0omr3")] +offset_bottom = 566.0 [node name="PurpleCrystal" parent="weaponStore" index="1" instance=ExtResource("4_0omr3")] +debugRebuild = false [node name="sprint" parent="sounds" index="0"] stream = ExtResource("4_66s6c") diff --git a/components/Weapons/AcidWind.tscn b/components/Weapons/AcidWind.tscn index eaaba1a..620e13a 100644 --- a/components/Weapons/AcidWind.tscn +++ b/components/Weapons/AcidWind.tscn @@ -12,37 +12,43 @@ quality = 4 typeTopic = 3 costBeachball = 200 store = { -"atk": 0.5, -"c-atk": 1.0, +"atk": 1.0, +"c-atk": 0.01, "cl-atkspeed": 0.001, "cl-speed": 0.001, -"n-atk": 1.0, +"f": 30.0, +"n-atk": 5.0, "p-offset": 0.1, "s-count-max": 4.0, -"weakatk": 0.25 +"weakatk": 0.5 } storeType = { "atk": 0, -"c-atk": 1, +"c-atk": 2, "cl-atkspeed": 2, "cl-speed": 2, -"n-atk": 1, +"f": 4, +"n-atk": 2, "p-offset": 3, "s-count-max": 1, "weakatk": 0 } -descriptionTemplate = "高速随机喷射以下五种[b]酸[/b]之一,强酸可造成$atk点伤害,弱酸造成$weakatk点伤害。 +descriptionTemplate = "发射一个[b]酸蚀风暴[/b],以$f的频率吸引一下五种[b]酸[/b]到风暴中心,强酸可造成$atk点伤害,弱酸造成$weakatk点伤害。 [color=green][b]硫酸[/b][/color]:命中时溅射1~$s-count-max滴[b]硫酸[/b]。 -[color=lightblue][b]硝酸[/b][/color]:额外造成$n-atk点伤害。 +[color=lightblue][b]硝酸[/b][/color]:额外造成$n-atk伤害。 [color=lightyellow][b]盐酸[/b][/color]:使敌人 [i]移动速度[/i] 降低$cl-speed,[i]攻击速度[/i] 降低$cl-atkspeed。 -[color=pink][b]碳酸[/b][/color]:不会发生散射,可无限穿透,碰撞体积会越来越大,但飞行速度稍慢。 -[color=orange][b]磷酸[/b][/color]:使敌人 [i]散射角[/i] 增加$p-offset,可无限追踪。" -cooldown = 0.0 +[color=pink][b]碳酸[/b][/color]:降低敌人$c-atk伤害。 +[color=orange][b]磷酸[/b][/color]:使敌人 [i]散射角[/i] 增加$p-offset。" +needEnergy = 10.0 +cooldown = 2000.0 debugRebuild = true [node name="avatar" parent="container/info" index="0"] texture = ExtResource("2_pnd3r") +[node name="energy" parent="container/info/infos/energyInfo" index="1"] +text = "10.0" + [node name="beachball" parent="container/info/infos" index="1"] count = 200 @@ -52,9 +58,9 @@ quality = 4 typeTopic = 3 [node name="description" parent="container" index="2"] -text = "[center]高速随机喷射以下五种[b]酸[/b]之一,强酸可造成[color=cyan]0.50[/color]点伤害,弱酸造成[color=cyan]0.25[/color]点伤害。 +text = "[center]发射一个[b]酸蚀风暴[/b],以[color=cyan]30.0Hz[/color]的频率吸引一下五种[b]酸[/b]到风暴中心,强酸可造成[color=cyan]1.00[/color]点伤害,弱酸造成[color=cyan]0.50[/color]点伤害。 [color=green][b]硫酸[/b][/color]:命中时溅射1~[color=cyan]4[/color]滴[b]硫酸[/b]。 -[color=lightblue][b]硝酸[/b][/color]:额外造成[color=cyan]1[/color]点伤害。 +[color=lightblue][b]硝酸[/b][/color]:额外造成[color=cyan]500.0%[/color]伤害。 [color=lightyellow][b]盐酸[/b][/color]:使敌人 [i]移动速度[/i] 降低[color=cyan]0.1%[/color],[i]攻击速度[/i] 降低[color=cyan]0.1%[/color]。 -[color=pink][b]碳酸[/b][/color]:不会发生散射,可无限穿透,碰撞体积会越来越大,但飞行速度稍慢。 -[color=orange][b]磷酸[/b][/color]:使敌人 [i]散射角[/i] 增加[color=cyan]0.1°[/color],可无限追踪。[/center]" +[color=pink][b]碳酸[/b][/color]:降低敌人[color=cyan]1.0%[/color]伤害。 +[color=orange][b]磷酸[/b][/color]:使敌人 [i]散射角[/i] 增加[color=cyan]0.1°[/color]。[/center]" diff --git a/scripts/Contents/Bullets/AcidBulletBase.gd b/scripts/Contents/Bullets/AcidBulletBase.gd index b9dd8f2..10a0b8b 100644 --- a/scripts/Contents/Bullets/AcidBulletBase.gd +++ b/scripts/Contents/Bullets/AcidBulletBase.gd @@ -2,8 +2,8 @@ extends BulletBase class_name AcidBulletBase enum AcidType { - STRONG, - WEAK, + STRONG, + WEAK, } @export var acidType: AcidType = AcidType.STRONG @@ -11,7 +11,15 @@ var arg1 = 0 var arg2 = 0 var arg3 = 0 +var randomPercent: float = 0 +var storm: AcidStormBullet = null + func register(): - scale.y *= MathTool.randomChoiceFrom([-1, 1]) + scale.y *= MathTool.randomChoiceFrom([-1, 1]) + randomPercent = randf_range(0, 1) func ai(): - PresetBulletAI.forward(self, rotation) + if is_instance_valid(storm): + position = storm.position + Vector2.from_angle(deg_to_rad((lifeTimePercent() + randomPercent) * 360)) * 150 * (1 - lifeTimePercent()) + rotation = storm.position.angle_to_point(position) + deg_to_rad(90) + else: + tryDestroy() diff --git a/scripts/Contents/Bullets/AcidC.gd b/scripts/Contents/Bullets/AcidC.gd index 14de7d6..06edfce 100644 --- a/scripts/Contents/Bullets/AcidC.gd +++ b/scripts/Contents/Bullets/AcidC.gd @@ -1,10 +1,8 @@ extends AcidBulletBase class_name AcidC -func ai(): - super.ai() - scale *= 1.01 - modulate.a = 1 - timeLived() / lifeTime +func succeedToHit(_dmg: float, entity: EntityBase): + entity.fields[FieldStore.Entity.DAMAGE_MULTIPILER] = clamp(entity.fields[FieldStore.Entity.DAMAGE_MULTIPILER] - arg1, 0.2, INF) func split(newBullet: BulletBase, _index: int, _total: int, _lastBullet: float): - newBullet.scale = scale.sign() - return newBullet + newBullet.scale = scale.sign() + return newBullet diff --git a/scripts/Contents/Bullets/AcidN.gd b/scripts/Contents/Bullets/AcidN.gd index 80ccb25..9f7ff27 100644 --- a/scripts/Contents/Bullets/AcidN.gd +++ b/scripts/Contents/Bullets/AcidN.gd @@ -2,4 +2,4 @@ extends AcidBulletBase class_name AcidN func succeedToHit(_dmg: float, entity: EntityBase): - entity.takeDamage(arg1) + entity.takeDamage(baseDamage * arg1) diff --git a/scripts/Contents/Bullets/AcidP.gd b/scripts/Contents/Bullets/AcidP.gd index 398c0bc..49e73c2 100644 --- a/scripts/Contents/Bullets/AcidP.gd +++ b/scripts/Contents/Bullets/AcidP.gd @@ -3,7 +3,3 @@ class_name AcidP func succeedToHit(_dmg: float, entity: EntityBase): entity.fields[FieldStore.Entity.OFFSET_SHOOT] = clamp(entity.fields[FieldStore.Entity.OFFSET_SHOOT] + arg1, 0, INF) -func ai(): - super.ai() - if is_instance_valid(arg2): - PresetBulletAI.trace(self, arg2.position, 0.01) diff --git a/scripts/Contents/Bullets/AcidStorm.gd b/scripts/Contents/Bullets/AcidStorm.gd new file mode 100644 index 0000000..b4efce1 --- /dev/null +++ b/scripts/Contents/Bullets/AcidStorm.gd @@ -0,0 +1,45 @@ +extends BulletBase +class_name AcidStormBullet + +var acids: Array[String] = ["AcidS", "AcidN", "AcidCl", "AcidP", "AcidC"] + +var strongAtk: float = 0 +var weakAtk: float = 0 +var sCountMax: int = 0 +var nAtk: float = 0 +var clSpeed: float = 0 +var clAtkSpeed: float = 0 +var cAtk: float = 0 +var pOffset: float = 0 +var f: float = 0 + +func ai(): + PresetBulletAI.forward(self , rotation) +func applyDot(): + var acid = MathTool.randomChoiceFrom(acids) + for bullet in BulletBase.generate( + ComponentManager.getBullet(acid), + launcher, + position, + 0, + ): + if bullet is AcidBulletBase: + bullet.storm = self + if bullet.acidType == AcidBulletBase.AcidType.STRONG: + bullet.baseDamage = strongAtk + else: + bullet.baseDamage = weakAtk + if bullet is AcidS: + bullet.arg1 = sCountMax + if bullet is AcidN: + bullet.arg1 = nAtk + if bullet is AcidCl: + bullet.arg1 = clSpeed + bullet.arg2 = clAtkSpeed + if bullet is AcidP: + bullet.arg1 = pOffset + bullet.arg2 = EntityTool.findClosetEntity(get_global_mouse_position(), get_tree(), !launcher.isPlayer(), launcher.isPlayer()) + if bullet is AcidC: + bullet.arg1 = cAtk + await TickTool.millseconds(1000.0 / f) + return true diff --git a/scripts/Contents/Bullets/AcidStorm.gd.uid b/scripts/Contents/Bullets/AcidStorm.gd.uid new file mode 100644 index 0000000..c131493 --- /dev/null +++ b/scripts/Contents/Bullets/AcidStorm.gd.uid @@ -0,0 +1 @@ +uid://dl7d0v7f2uute diff --git a/scripts/Contents/Weapons/AcidWind.gd b/scripts/Contents/Weapons/AcidWind.gd index 509529d..899fbcb 100644 --- a/scripts/Contents/Weapons/AcidWind.gd +++ b/scripts/Contents/Weapons/AcidWind.gd @@ -4,39 +4,31 @@ extends Weapon var acids: Array[String] = ["AcidS", "AcidN", "AcidCl", "AcidP", "AcidC"] func update(to: int, origin: Dictionary, _entity: EntityBase): - origin["atk"] += 0.075 * to * soulLevel - origin["c-atk"] *= soulLevel - origin["cl-atkspeed"] *= soulLevel - origin["cl-speed"] *= soulLevel - origin["n-atk"] *= soulLevel - origin["p-offset"] *= soulLevel - origin["s-count-max"] *= soulLevel - origin["weakatk"] = 0.05 * soulLevel - return origin + origin["atk"] += 0.15 * to * soulLevel + origin["c-atk"] *= soulLevel + origin["cl-atkspeed"] *= soulLevel + origin["cl-speed"] *= soulLevel + origin["n-atk"] *= soulLevel + origin["p-offset"] *= soulLevel + origin["s-count-max"] *= soulLevel + origin["weakatk"] += 0.075 * to * soulLevel + origin["f"] += 25 * (soulLevel - 1) + return origin func attack(entity: EntityBase): - var acid = MathTool.randomChoiceFrom(acids) - for bullet in BulletBase.generate( - ComponentManager.getBullet(acid), - entity, - entity.findWeaponAnchor("normal"), - (get_global_mouse_position() - entity.findWeaponAnchor("normal")).angle(), - true, - acid == "AcidC" - ): - if bullet is AcidBulletBase: - if bullet.acidType == AcidBulletBase.AcidType.STRONG: - bullet.baseDamage = readStore("atk") - else: - bullet.baseDamage = readStore("weakatk") - if bullet is AcidS: - bullet.arg1 = readStore("s-count-max") - if bullet is AcidN: - bullet.arg1 = readStore("n-atk") - if bullet is AcidCl: - bullet.arg1 = readStore("cl-speed") - bullet.arg2 = readStore("cl-atkspeed") - if bullet is AcidP: - bullet.arg1 = readStore("p-offset") - bullet.arg2 = EntityTool.findClosetEntity(get_global_mouse_position(), get_tree(), !entity.isPlayer(), entity.isPlayer()) - if bullet is AcidC: - pass + for bullet in BulletBase.generate( + ComponentManager.getBullet("AcidStorm"), + entity, + entity.findWeaponAnchor("normal"), + (get_global_mouse_position() - entity.findWeaponAnchor("normal")).angle(), + ): + if bullet is AcidStormBullet: + bullet.strongAtk = readStore("atk") + bullet.weakAtk = readStore("weakatk") + bullet.sCountMax = readStore("s-count-max") + bullet.nAtk = readStore("n-atk") + bullet.clSpeed = readStore("cl-speed") + bullet.clAtkSpeed = readStore("cl-atkspeed") + bullet.cAtk = readStore("c-atk") + bullet.pOffset = readStore("p-offset") + bullet.f = readStore("f") + return true