1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 06:51:54 +08:00
Files
Dog-Lynx-And-HCN/scripts/Contents/Weapons/MagicMissle.gd
T

37 lines
1.2 KiB
GDScript
Raw Normal View History

@tool
extends Weapon
var roundBullets: Array[MagicMissleBullet] = []
func update(to: int, origin: Dictionary, _entity: EntityBase):
origin["atk"] += 1 * to * soulLevel
origin["cursor-m"] += 0.2 * to * soulLevel
origin["missle-m"] += 0.02 * to * soulLevel
origin["track"] += 1 * to * soulLevel
origin["G"] *= 1.25 ** (soulLevel - 1)
origin["count"] += 1 * (soulLevel - 1)
return origin
func loopStart(entity: EntityBase):
for i in randi_range(1, readStore("count")):
for bullet in BulletBase.generate(
ComponentManager.getBullet("MagicMissle"),
entity,
get_global_mouse_position() + Vector2.from_angle(randf_range(0, 2 * PI)) * readStore("track"),
0
):
if bullet is MagicMissleBullet:
bullet.look_at(get_global_mouse_position())
bullet.rotation += PI / 2
bullet.speedV2 += Vector2.from_angle(bullet.rotation) * sqrt((readStore("G") * readStore("cursor-m") / readStore("track") ** 2) * readStore("track")) / 120
bullet.roundBullets = roundBullets
bullet.baseDamage = readStore("atk")
bullet.powerScale = readStore("count")
roundBullets.append(bullet)
return true
func loopExit(_entity: EntityBase):
for bullet in roundBullets:
if is_instance_valid(bullet):
bullet.accelerating = false
roundBullets.clear()