mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-31 00:11:54 +08:00
feat(武器系统): 添加魔法导弹武器及配套子弹逻辑
实现魔法导弹武器系统,包括: 1. 新增HOLD_LOOP发射类型武器 2. 添加魔法导弹子弹类实现追踪和分裂逻辑 3. 修改武器基类支持循环攻击模式 4. 更新角色控制器支持新武器类型 5. 添加相关资源文件和配置
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
@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()
|
||||
@@ -0,0 +1 @@
|
||||
uid://clec7nrtesipu
|
||||
Reference in New Issue
Block a user