mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-22 19:42:30 +08:00
fix(Characters): 修复治疗逻辑并优化七魂武器计时
重构Rooster.gd中的治疗逻辑,现在会检查生命值和物品数量 调整SevenSoul武器的生成间隔从20000ms减少到19500ms 为SevenSoul子弹添加generationDuration变量统一计时逻辑 在子弹生成时添加治疗效果
This commit is contained in:
@@ -9,6 +9,7 @@ var colors = [
|
|||||||
"#FDEB0F"
|
"#FDEB0F"
|
||||||
]
|
]
|
||||||
var index = 0
|
var index = 0
|
||||||
|
var generationDuration: float = 19500
|
||||||
|
|
||||||
@onready var heart = $"%heart"
|
@onready var heart = $"%heart"
|
||||||
@onready var effect: GPUParticles2D = $"%effect"
|
@onready var effect: GPUParticles2D = $"%effect"
|
||||||
@@ -16,13 +17,14 @@ var index = 0
|
|||||||
func spawn():
|
func spawn():
|
||||||
modulate = Color(colors[index % colors.size()])
|
modulate = Color(colors[index % colors.size()])
|
||||||
effect.emitting = true
|
effect.emitting = true
|
||||||
|
launcher.tryHeal(5)
|
||||||
|
|
||||||
func ai():
|
func ai():
|
||||||
rotation_degrees = 360.0 / colors.size() * index + timeLived() / 20000.0 * 360 - index / 6.0 * 360.0
|
rotation_degrees = 360.0 / colors.size() * index + timeLived() / generationDuration * 360 - index / 6.0 * 360.0
|
||||||
heart.global_rotation_degrees = 0
|
heart.global_rotation_degrees = 0
|
||||||
PresetBulletAI.lockLauncher(self, launcher, true)
|
PresetBulletAI.lockLauncher(self, launcher, true)
|
||||||
func applyDot():
|
func applyDot():
|
||||||
if timeLived() > 20000 * ((6.0 - index) / 6.0):
|
if timeLived() > generationDuration * ((6.0 - index) / 6.0):
|
||||||
BulletBase.generate(ComponentManager.getBullet("SoulBall"), launcher, heart.global_position, heart.global_position.angle_to_point(get_global_mouse_position()))
|
BulletBase.generate(ComponentManager.getBullet("SoulBall"), launcher, heart.global_position, heart.global_position.angle_to_point(get_global_mouse_position()))
|
||||||
await TickTool.millseconds(100)
|
await TickTool.millseconds(100)
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -27,7 +27,11 @@ func ai():
|
|||||||
if Input.is_action_just_pressed("sprint"):
|
if Input.is_action_just_pressed("sprint"):
|
||||||
trySprint()
|
trySprint()
|
||||||
if Input.is_action_just_pressed("heal"):
|
if Input.is_action_just_pressed("heal"):
|
||||||
tryHeal(20)
|
if health < fields.get(FieldStore.Entity.MAX_HEALTH):
|
||||||
|
if useItem({
|
||||||
|
ItemStore.ItemType.APPLE: 1
|
||||||
|
}):
|
||||||
|
tryHeal(20)
|
||||||
func sprint():
|
func sprint():
|
||||||
move(Vector2(
|
move(Vector2(
|
||||||
Input.get_axis("m_left", "m_right"),
|
Input.get_axis("m_left", "m_right"),
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ func attack(entity: EntityBase):
|
|||||||
for i in 6:
|
for i in 6:
|
||||||
for j in BulletBase.generate(ComponentManager.getBullet("SevenSoul"), entity, entity.texture.global_position, 0):
|
for j in BulletBase.generate(ComponentManager.getBullet("SevenSoul"), entity, entity.texture.global_position, 0):
|
||||||
j.index = i
|
j.index = i
|
||||||
await TickTool.millseconds(20000 / 6.0)
|
await TickTool.millseconds(19500 / 6.0)
|
||||||
func update(to, origin, _entity):
|
func update(to, origin, _entity):
|
||||||
origin["atk"] += 1 * to * soulLevel
|
origin["atk"] += 1 * to * soulLevel
|
||||||
return origin
|
return origin
|
||||||
|
|||||||
@@ -329,11 +329,9 @@ func tryDie(by: BulletBase = null):
|
|||||||
died.emit()
|
died.emit()
|
||||||
queue_free()
|
queue_free()
|
||||||
func tryHeal(count: float):
|
func tryHeal(count: float):
|
||||||
if inventory[ItemStore.ItemType.APPLE] > 0 and health < fields.get(FieldStore.Entity.MAX_HEALTH):
|
playSound("heal")
|
||||||
inventory[ItemStore.ItemType.APPLE] -= 1
|
healed.emit(heal(count * fields.get(FieldStore.Entity.HEAL_ABILITY)))
|
||||||
playSound("heal")
|
healthChanged.emit(health)
|
||||||
healed.emit(heal(count * fields.get(FieldStore.Entity.HEAL_ABILITY)))
|
|
||||||
healthChanged.emit(health)
|
|
||||||
func findWeaponAnchor(weaponName: String) -> Vector2:
|
func findWeaponAnchor(weaponName: String) -> Vector2:
|
||||||
var anchor = $"%weapons".get_node_or_null(weaponName)
|
var anchor = $"%weapons".get_node_or_null(weaponName)
|
||||||
if anchor is Node2D:
|
if anchor is Node2D:
|
||||||
|
|||||||
Reference in New Issue
Block a user