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

feat(武器系统): 新增可蓄力钢管武器及相关功能

实现钢管武器的蓄力攻击机制,包括:
- 添加 Pipe 武器和 PipeBullet 子弹脚本及场景
- 在 Weapon 类中增加蓄力相关属性和方法
- 修改 Rooster 角色以支持武器蓄力功能
- 添加武器蓄力时间计算和伤害加成逻辑
This commit is contained in:
2026-02-05 20:04:39 +08:00
parent d83abc7078
commit 53412c0968
9 changed files with 121 additions and 21 deletions
+10 -3
View File
@@ -8,6 +8,7 @@ class_name Weapon
@export var typeTopic: WeaponName.TypeTopic = WeaponName.TypeTopic.IMPACT
@export var soulLevel: int = 1
@export var costBeachball: int = 500
@export var chargable: bool = false
@export var store: Dictionary = {
"atk": 10
}
@@ -35,6 +36,7 @@ class_name Weapon
var cooldownTimer: CooldownTimer = null
var originalStore: Dictionary = {}
var chargedTime: float = 0
func _ready():
cooldownTimer = CooldownTimer.new()
@@ -166,9 +168,14 @@ func playSound(sound: String):
cloned.queue_free()
func tryAttack(entity: EntityBase):
cooldownTimer.speedScale = entity.fields.get(FieldStore.Entity.ATTACK_SPEED)
if cooldownTimer.start():
if entity.useEnergy(needEnergy):
return await attack(entity)
if cooldownTimer.isCooldowned():
var result = await attack(entity)
if result:
cooldownTimer.start()
entity.useEnergy(needEnergy)
return result
func charged(base: float, percent: float):
return base * (1 + chargedTime / 50 * percent)
# 抽象
func update(_to: int, origin: Dictionary, _entity: EntityBase):