mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
feat(武器): 添加咸亨记账簿武器及茴香豆子弹
实现新的HXD武器系统,包括: - 咸亨记账簿武器,可发射反弹的茴香豆子弹 - 茴香豆子弹能在敌人间反弹并造成伤害 - 添加相关资源文件及场景配置 - 将新武器添加到公鸡角色的武器库中
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
extends BulletBase
|
||||
class_name HXDBullet
|
||||
|
||||
var bouncedTime: int = 0
|
||||
var maxBouncedTime: int = 0
|
||||
|
||||
func spawn():
|
||||
texture.play(str(randi_range(0, 2)))
|
||||
func ai():
|
||||
PresetBulletAI.forward(self, rotation)
|
||||
func succeedToHit(_dmg: float, entity: EntityBase):
|
||||
if bouncedTime < maxBouncedTime:
|
||||
var newEntity = EntityTool.findClosetEntity(position, get_tree(), !launcher.isPlayer(), launcher.isPlayer(), [entity])
|
||||
if is_instance_valid(newEntity):
|
||||
look_at(newEntity.position)
|
||||
bouncedTime += 1
|
||||
func split(newBullet: BulletBase, _index: int, _total: int, _lastBullet: float):
|
||||
if newBullet is HXDBullet:
|
||||
newBullet.bouncedTime = 0
|
||||
return newBullet
|
||||
func refract(newBullet: BulletBase, _entity: EntityBase, _index: int, _total: int, _lastBullet: float):
|
||||
if newBullet is HXDBullet:
|
||||
newBullet.bouncedTime = 0
|
||||
return newBullet
|
||||
@@ -0,0 +1 @@
|
||||
uid://4mb47jqtc8f7
|
||||
@@ -0,0 +1,17 @@
|
||||
@tool
|
||||
extends Weapon
|
||||
|
||||
func update(to: int, origin: Dictionary, _entity: EntityBase):
|
||||
origin["atk"] += 1 * to * soulLevel
|
||||
return origin
|
||||
func attack(entity: EntityBase):
|
||||
for i in readStore("atk"):
|
||||
for bullet in BulletBase.generate(
|
||||
ComponentManager.getBullet("HXD"),
|
||||
entity,
|
||||
entity.findWeaponAnchor("normal"),
|
||||
entity.findWeaponAnchor("normal").angle_to_point(get_global_mouse_position()) + deg_to_rad(randf_range(-1, 1) * 40)
|
||||
):
|
||||
if bullet is HXDBullet:
|
||||
bullet.maxBouncedTime = readStore("atk")
|
||||
bullet.baseDamage = readStore("atk")
|
||||
@@ -0,0 +1 @@
|
||||
uid://0xfj35jvi7ym
|
||||
Reference in New Issue
Block a user