mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-30 16:01:53 +08:00
feat(武器): 添加鸡毛弓武器及相关箭矢功能
实现鸡毛弓武器系统,包括武器脚本、箭矢脚本和场景配置 修改实体伤害处理逻辑,分离普通伤害和子弹伤害方法 更新公鸡角色配置,添加鸡毛弓作为默认武器
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
extends BulletBase
|
||||
class_name Arrow
|
||||
|
||||
var atk: float = 0
|
||||
|
||||
func ai():
|
||||
speed = (1 - lifeDistancePercent()) * initialSpeed
|
||||
damage = speed * atk
|
||||
PresetBulletAI.forward(self, rotation)
|
||||
if speed < 1:
|
||||
tryDestroy()
|
||||
@@ -0,0 +1 @@
|
||||
uid://u5x40y0cvqq2
|
||||
@@ -0,0 +1,22 @@
|
||||
extends BulletBase
|
||||
class_name Bow
|
||||
|
||||
var count: int = 0
|
||||
var atk: float = 0
|
||||
|
||||
func spawn():
|
||||
await TickTool.millseconds(250)
|
||||
var startAngle = rotation - deg_to_rad(count * 10.0 / 2)
|
||||
for c in count:
|
||||
for i in BulletBase.generate(
|
||||
ComponentManager.getBullet("Arrow"),
|
||||
launcher,
|
||||
position,
|
||||
startAngle + deg_to_rad(c * 10)
|
||||
):
|
||||
var bullet: Arrow = i
|
||||
bullet.atk = atk
|
||||
tryDestroy()
|
||||
func ai():
|
||||
PresetBulletAI.lockLauncher(self, launcher, true)
|
||||
rotation = position.angle_to_point(get_global_mouse_position())
|
||||
@@ -0,0 +1 @@
|
||||
uid://dnnxxqpbpwohf
|
||||
@@ -11,4 +11,4 @@ func ai():
|
||||
tryDestroy()
|
||||
func destroy(beacuseMap: bool):
|
||||
if beacuseMap:
|
||||
launcher.takeDamage(self, MathTool.rate(0.5))
|
||||
launcher.bulletHit(self, MathTool.rate(0.5))
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
@tool
|
||||
extends Weapon
|
||||
|
||||
func update(to: int, origin: Dictionary, _entity: EntityBase):
|
||||
origin["atk"] += 0.05 * to * soulLevel
|
||||
origin["count"] = 1 * soulLevel
|
||||
origin["self"] += 0.1 * to
|
||||
return origin
|
||||
func attack(entity: EntityBase):
|
||||
entity.takeDamage(readStore("self"))
|
||||
var weaponPos = entity.findWeaponAnchor("normal")
|
||||
for i in BulletBase.generate(
|
||||
ComponentManager.getBullet("Bow"),
|
||||
entity,
|
||||
weaponPos,
|
||||
weaponPos.angle_to_point(get_global_mouse_position())
|
||||
):
|
||||
var bullet: Bow = i
|
||||
bullet.count = readStore("count")
|
||||
bullet.atk = readStore("atk")
|
||||
@@ -0,0 +1 @@
|
||||
uid://1u8t36atj041
|
||||
Reference in New Issue
Block a user