mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-29 15:02:29 +08:00
feat(ChainGun): 为链式机枪添加子弹数量属性并调整子弹生成逻辑
修改链式机枪的武器脚本、场景配置和子弹脚本,新增count属性控制子弹数量 子弹生成时根据count值调整位置分布,同时更新UI描述文本
This commit is contained in:
@@ -10,8 +10,14 @@ avatarTexture = ExtResource("2_ghn43")
|
|||||||
displayName = "链式机枪"
|
displayName = "链式机枪"
|
||||||
costBeachball = 400
|
costBeachball = 400
|
||||||
store = {
|
store = {
|
||||||
"atk": 5
|
"atk": 5,
|
||||||
|
"count": 1
|
||||||
}
|
}
|
||||||
|
storeType = {
|
||||||
|
"atk": 1,
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
descriptionTemplate = "发射$count个[b]微型水晶[/b],可造成$atk点伤害。"
|
||||||
needEnergy = 1.0
|
needEnergy = 1.0
|
||||||
cooldown = 66.0
|
cooldown = 66.0
|
||||||
|
|
||||||
@@ -28,4 +34,4 @@ text = "400"
|
|||||||
displayName = "链式机枪"
|
displayName = "链式机枪"
|
||||||
|
|
||||||
[node name="description" parent="container" index="2"]
|
[node name="description" parent="container" index="2"]
|
||||||
text = "[center]造成[color=cyan]4[/color]→[color=yellow]6[/color]点伤害。[/center]"
|
text = "[center]发射[color=cyan]2[/color]→[color=yellow]2[/color]个[b]微型水晶[/b],可造成[color=cyan]5[/color]→[color=yellow]7[/color]点伤害。[/center]"
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
extends BulletBase
|
extends BulletBase
|
||||||
|
|
||||||
|
var count: int = 1
|
||||||
|
|
||||||
@onready var anchor: Node2D = $"%anchor"
|
@onready var anchor: Node2D = $"%anchor"
|
||||||
|
|
||||||
func spawn():
|
func spawn():
|
||||||
for i in BulletBase.generate(ComponentManager.getBullet("PurpleCrystalSmall"), launcher, anchor.global_position, rotation):
|
for j in count:
|
||||||
i.damage = damage
|
for i in BulletBase.generate(ComponentManager.getBullet("PurpleCrystalSmall"), launcher, anchor.global_position, rotation):
|
||||||
|
i.damage = damage
|
||||||
|
var dir = Vector2.from_angle(i.rotation).rotated(deg_to_rad(-90))
|
||||||
|
i.global_position += dir * (count - j * 2) * 20 / 2
|
||||||
func ai():
|
func ai():
|
||||||
PresetBulletAI.lockLauncher(self, launcher, true)
|
PresetBulletAI.lockLauncher(self, launcher, true)
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ extends Weapon
|
|||||||
|
|
||||||
func update(to, origin, _entity):
|
func update(to, origin, _entity):
|
||||||
origin["atk"] += 2 * to * soulLevel
|
origin["atk"] += 2 * to * soulLevel
|
||||||
|
origin["count"] += 0.25 * to * soulLevel
|
||||||
return origin
|
return origin
|
||||||
func attack(entity: EntityBase):
|
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()):
|
for i in BulletBase.generate(ComponentManager.getBullet("ChainGun"), entity, entity.texture.global_position, (get_global_mouse_position() - entity.texture.global_position).angle()):
|
||||||
i.damage = readStore("atk")
|
i.damage = readStore("atk")
|
||||||
|
i.count = floor(readStore("count"))
|
||||||
|
|||||||
Reference in New Issue
Block a user