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

feat(武器): 实现酸蚀风暴武器及其相关子弹效果

添加酸蚀风暴武器,它会发射一个吸引五种不同类型酸液子弹的风暴中心
修改酸液子弹基类以支持风暴效果
调整酸风武器的属性值和描述
移除旧版随机发射酸液子弹的逻辑
This commit is contained in:
2026-03-06 23:19:22 +08:00
parent e44458e816
commit 561be7c734
12 changed files with 241 additions and 72 deletions
+12 -4
View File
@@ -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()
+4 -6
View File
@@ -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
+1 -1
View File
@@ -2,4 +2,4 @@ extends AcidBulletBase
class_name AcidN
func succeedToHit(_dmg: float, entity: EntityBase):
entity.takeDamage(arg1)
entity.takeDamage(baseDamage * arg1)
-4
View File
@@ -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)
+45
View File
@@ -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
@@ -0,0 +1 @@
uid://dl7d0v7f2uute
+27 -35
View File
@@ -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