2026-01-28 20:20:55 +08:00
|
|
|
extends SummonBase
|
|
|
|
|
class_name GoboSummon
|
|
|
|
|
|
|
|
|
|
var percent: float = 0.0
|
|
|
|
|
var healthSinceLastLaunch: float = 0
|
2026-01-28 22:50:46 +08:00
|
|
|
var targetDamage: float = 0.0
|
|
|
|
|
var count: int = 0
|
2026-01-28 20:20:55 +08:00
|
|
|
|
|
|
|
|
func initHealth(maxHealth: float):
|
|
|
|
|
super.initHealth(maxHealth)
|
|
|
|
|
healthSinceLastLaunch = maxHealth
|
|
|
|
|
|
|
|
|
|
func register():
|
|
|
|
|
fields[FieldStore.Entity.MOVEMENT_SPEED] = 1.5
|
|
|
|
|
healthChanged.connect(
|
|
|
|
|
func(newHealth):
|
2026-01-28 22:50:46 +08:00
|
|
|
if healthSinceLastLaunch - newHealth >= targetDamage:
|
2026-01-28 20:20:55 +08:00
|
|
|
launch()
|
|
|
|
|
healthSinceLastLaunch = newHealth
|
|
|
|
|
)
|
|
|
|
|
func ai():
|
|
|
|
|
var target = BulletTool.findClosetBulletCanDamage(position, get_tree(), self)
|
|
|
|
|
if is_instance_valid(target):
|
|
|
|
|
move(target.position - position)
|
|
|
|
|
|
|
|
|
|
func launch():
|
2026-01-28 22:50:46 +08:00
|
|
|
ItemDropped.generate(ItemStore.ItemType.APPLE, count, position)
|