mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
refactor(Bullet): 移除ChickSprint的atk变量并简化伤害计算
调整Cat角色的攻击冷却时间和冲刺倍数 为BulletBase添加speedScale属性和setupCuttable方法 将Volcano的animator速度设置移至ai方法并应用speedScale
This commit is contained in:
@@ -1,13 +1,11 @@
|
|||||||
extends BulletBase
|
extends BulletBase
|
||||||
class_name ChickSprint
|
class_name ChickSprint
|
||||||
|
|
||||||
var atk: float = 1
|
|
||||||
|
|
||||||
func register():
|
func register():
|
||||||
speed = 0
|
speed = 0
|
||||||
penerate = 1
|
penerate = 1
|
||||||
func ai():
|
func ai():
|
||||||
baseDamage = launcher.velocity.length() / 500.0 * atk
|
baseDamage = launcher.velocity.length() / 500.0
|
||||||
PresetBulletAI.lockLauncher(self, launcher, true)
|
PresetBulletAI.lockLauncher(self, launcher, true)
|
||||||
if !launcher.sprinting:
|
if !launcher.sprinting:
|
||||||
tryDestroy()
|
tryDestroy()
|
||||||
|
|||||||
@@ -10,8 +10,9 @@ var dmg5: float = 0
|
|||||||
var splitAngle: float = 10
|
var splitAngle: float = 10
|
||||||
|
|
||||||
func register():
|
func register():
|
||||||
animator.speed_scale = launcher.fields.get(FieldStore.Entity.ATTACK_SPEED)
|
setupCuttable(0.1)
|
||||||
func ai():
|
func ai():
|
||||||
|
animator.speed_scale = launcher.fields.get(FieldStore.Entity.ATTACK_SPEED) * speedScale
|
||||||
PresetBulletAI.lockLauncher(self, launcher, true)
|
PresetBulletAI.lockLauncher(self, launcher, true)
|
||||||
rotation = lerp_angle(
|
rotation = lerp_angle(
|
||||||
rotation,
|
rotation,
|
||||||
|
|||||||
@@ -4,16 +4,14 @@ class_name Maodie
|
|||||||
func register():
|
func register():
|
||||||
fields[FieldStore.Entity.MAX_HEALTH] = 75
|
fields[FieldStore.Entity.MAX_HEALTH] = 75
|
||||||
fields[FieldStore.Entity.MOVEMENT_SPEED] = randf_range(0.5, 0.8)
|
fields[FieldStore.Entity.MOVEMENT_SPEED] = randf_range(0.5, 0.8)
|
||||||
attackCooldownMap[0] = randi_range(2500, 6000)
|
attackCooldownMap[0] = randi_range(5000, 8000)
|
||||||
sprintMultiplier = randf_range(10, 35)
|
sprintMultiplier = randf_range(5, 15)
|
||||||
func ai():
|
func ai():
|
||||||
PresetEntityAI.follow(self, currentFocusedBoss)
|
PresetEntityAI.follow(self, currentFocusedBoss)
|
||||||
tryAttack(0, true)
|
tryAttack(0, true)
|
||||||
func attack(type: int):
|
func attack(type: int):
|
||||||
if type == 0:
|
if type == 0:
|
||||||
for bullet in BulletBase.generate(ComponentManager.getBullet("ChickSprint"), self, position, 0):
|
BulletBase.generate(ComponentManager.getBullet("ChickSprint"), self, position, 0)
|
||||||
if bullet is ChickSprint:
|
|
||||||
bullet.atk = 0.01
|
|
||||||
trySprint()
|
trySprint()
|
||||||
return true
|
return true
|
||||||
func sprint():
|
func sprint():
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ var isChildSplit: bool = false
|
|||||||
var isChildRefract: bool = false
|
var isChildRefract: bool = false
|
||||||
var initialSpeed: float = 0
|
var initialSpeed: float = 0
|
||||||
var initialDamage: float = 0
|
var initialDamage: float = 0
|
||||||
|
var speedScale: float = 1
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
initialSpeed = speed
|
initialSpeed = speed
|
||||||
@@ -86,6 +87,19 @@ func _physics_process(_delta: float) -> void:
|
|||||||
else:
|
else:
|
||||||
tryDestroy()
|
tryDestroy()
|
||||||
|
|
||||||
|
func setupCuttable(cutSpeed: float):
|
||||||
|
body_entered.connect(
|
||||||
|
func(body):
|
||||||
|
var entity = EntityTool.fromHurtbox(body)
|
||||||
|
if entity:
|
||||||
|
speedScale = cutSpeed
|
||||||
|
)
|
||||||
|
body_exited.connect(
|
||||||
|
func(body):
|
||||||
|
var entity = EntityTool.fromHurtbox(body)
|
||||||
|
if entity:
|
||||||
|
speedScale = 1
|
||||||
|
)
|
||||||
func getDamage():
|
func getDamage():
|
||||||
return initialDamage * damageMultipliers[usingDamageMultiplier]
|
return initialDamage * damageMultipliers[usingDamageMultiplier]
|
||||||
func hit(target: Node):
|
func hit(target: Node):
|
||||||
|
|||||||
Reference in New Issue
Block a user