From dd586e89c7655ec4cb55de067f8bde37af91cffe 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: Sun, 10 May 2026 15:47:31 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=AD=A6=E5=99=A8=E7=B3=BB=E7=BB=9F):=20?= =?UTF-8?q?=E4=B8=BA=E9=93=BE=E5=BC=8F=E6=9E=AA=E5=92=8C=E7=B4=AB=E6=B0=B4?= =?UTF-8?q?=E6=99=B6=E5=AD=90=E5=BC=B9=E6=B7=BB=E5=8A=A0=E8=83=BD=E9=87=8F?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在紫水晶子弹类中添加能量循环相关变量和方法 - 修改链式枪子弹生成逻辑以传递能量循环属性 - 为链式枪武器添加5个新的升华选项,包括能量回收功能 - 更新攻击方法以处理新增的穿透和能量循环属性 --- scripts/Contents/Bullets/ChainGun.gd | 20 +++++--- scripts/Contents/Bullets/PurpleCrystal.gd | 11 ++++- scripts/Contents/Weapons/ChainGun.gd | 58 +++++++++++++++++++++-- 3 files changed, 76 insertions(+), 13 deletions(-) diff --git a/scripts/Contents/Bullets/ChainGun.gd b/scripts/Contents/Bullets/ChainGun.gd index 75ae276..96f1922 100644 --- a/scripts/Contents/Bullets/ChainGun.gd +++ b/scripts/Contents/Bullets/ChainGun.gd @@ -1,21 +1,27 @@ extends BulletBase +class_name ChainGunBullet var count: int = 0 var splits: float = 0 +var cycleRate: float = 0 +var cycleCount: float = 0 @onready var anchor: Node2D = $"%anchor" func spawn(): - for j in count: - for i in BulletBase.generate( + for i in count: + for bullet in BulletBase.generate( ComponentManager.getBullet("PurpleCrystalSmall"), launcher, anchor.global_position, rotation + deg_to_rad(splits * randf_range(-1, 1)) ): - if i is BulletBase: - var dir = Vector2.from_angle(i.rotation).rotated(deg_to_rad(-90)) - i.baseDamage = baseDamage - i.position += dir * (count - j * 2) * 10 / 2 + if bullet is PurpleCrystalBullet: + var dir = Vector2.from_angle(bullet.rotation).rotated(deg_to_rad(-90)) + bullet.baseDamage = baseDamage + bullet.position += dir * (count - i * 2) * 10 / 2 + bullet.penerate += penerate + bullet.cycleRate = cycleRate + bullet.cycleCount = cycleCount func ai(): - PresetBulletAI.lockLauncher(self, launcher, true) + PresetBulletAI.lockLauncher(self , launcher, true) diff --git a/scripts/Contents/Bullets/PurpleCrystal.gd b/scripts/Contents/Bullets/PurpleCrystal.gd index ff21359..27a1acf 100644 --- a/scripts/Contents/Bullets/PurpleCrystal.gd +++ b/scripts/Contents/Bullets/PurpleCrystal.gd @@ -1,8 +1,17 @@ extends BulletBase +class_name PurpleCrystalBullet + +var cycleRate: float = 0 +var cycleCount: float = 0 +var cycled: bool = false func ai(): - PresetBulletAI.forward(self, rotation) + PresetBulletAI.forward(self , rotation) func destroy(_beacuseMap: bool): var eff = EffectController.create(ComponentManager.getEffect("PurpleCrystalExplosion"), global_position) eff.rotation = rotation eff.shot() +func succeedToHit(_dmg: float, entity: EntityBase): + if MathTool.rate(cycleRate): + entity.storeEnergy(cycleCount) + cycled = true diff --git a/scripts/Contents/Weapons/ChainGun.gd b/scripts/Contents/Weapons/ChainGun.gd index f552ff4..77a4783 100644 --- a/scripts/Contents/Weapons/ChainGun.gd +++ b/scripts/Contents/Weapons/ChainGun.gd @@ -1,15 +1,63 @@ @tool extends Weapon +func sublimateOptions() -> Array[SublimateOption]: + return [ + SublimateOption.new( + "聚焦校准", + "散射-2°", + func(w: Weapon, _e): + w.addStoreExtra("split", -2), + 1, + CategoryStore.Quality.RARE + ), + SublimateOption.new( + "晶核过载", + "伤害+5,但散射+4°", + func(w: Weapon, _e): + w.addStoreExtra("atk", 5) + w.addStoreExtra("split", 4), + 1, + CategoryStore.Quality.LEGENDARY + ), + SublimateOption.new( + "弹头塑形", + "穿透+5%", + func(w: Weapon, _e): + w.addStoreExtra("penerate", 0.1), + 1, + CategoryStore.Quality.EPIC + ), + SublimateOption.new( + "晶能循环", + "能量消耗-0.05", + func(_w, _e): + needEnergy -= 0.05, + 1, + CategoryStore.Quality.COMMON + ), + SublimateOption.new( + "动能压制", + "命中敌人时有5%概率回收0.25点能量", + func(w: Weapon, _e): + w.addStoreExtra("cycleRate", 0.05) + w.addStoreExtra("cycleCount", 0.25), + 1, + CategoryStore.Quality.COMMON + ), + ] func update(to, origin, _entity): origin["atk"] += 1 * to * soulLevel origin["count"] = 1 * soulLevel origin["split"] /= 1 + 0.005 * to * soulLevel return origin func attack(entity: EntityBase): - for i in BulletBase.generate(ComponentManager.getBullet("ChainGun"), entity, entity.texture.global_position, (get_global_mouse_position() - entity.texture.global_position).angle()): - if i is BulletBase: - i.baseDamage = readStore("atk") - i.count = floor(readStore("count")) - i.splits = readStore("split") + for bullet in BulletBase.generate(ComponentManager.getBullet("ChainGun"), entity, entity.texture.global_position, (get_global_mouse_position() - entity.texture.global_position).angle()): + if bullet is ChainGunBullet: + bullet.baseDamage = readStore("atk") + bullet.count = floor(readStore("count")) + bullet.splits = readStore("split") + bullet.penerate += readStoreExtra("penerate") + bullet.cycleRate = readStoreExtra("cycleRate") + bullet.cycleCount = readStoreExtra("cycleCount") return true