mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-24 20:42:30 +08:00
feat(战斗系统): 调整熊Boss的攻击行为和冲刺机制
- 修改ChickSprint子弹伤害计算公式的分母参数 - 在EntityBase中新增targetableSprinting状态变量 - 优化熊Boss的攻击模式,包括增加攻击次数随机性、调整移动速度和冲刺倍率 - 改进冲刺逻辑,增加目标位置随机性和冲刺后返回机制
This commit is contained in:
@@ -5,7 +5,7 @@ func register():
|
|||||||
speed = 0
|
speed = 0
|
||||||
penerate = 1
|
penerate = 1
|
||||||
func ai():
|
func ai():
|
||||||
damage = launcher.velocity.length() / 300
|
damage = launcher.velocity.length() / 250
|
||||||
PresetBulletAI.lockLauncher(self, launcher, true)
|
PresetBulletAI.lockLauncher(self, launcher, true)
|
||||||
if !launcher.sprinting:
|
if !launcher.sprinting:
|
||||||
tryDestroy()
|
tryDestroy()
|
||||||
|
|||||||
@@ -5,41 +5,49 @@ class_name Bear # 攻击方式模仿泰拉瑞亚光之女皇
|
|||||||
|
|
||||||
func register():
|
func register():
|
||||||
fields[FieldStore.Entity.MAX_HEALTH] = 2000
|
fields[FieldStore.Entity.MAX_HEALTH] = 2000
|
||||||
fields[FieldStore.Entity.MOVEMENT_SPEED] = 0.25
|
fields[FieldStore.Entity.MOVEMENT_SPEED] = 0.5
|
||||||
attackCooldownMap[0] = 3000
|
attackCooldownMap[0] = 3000
|
||||||
attackCooldownMap[1] = 10000
|
attackCooldownMap[1] = 10000
|
||||||
attackCooldownMap[2] = 8000
|
attackCooldownMap[2] = 8000
|
||||||
attackCooldownMap[3] = 13000
|
attackCooldownMap[3] = 13000
|
||||||
sprintMultiplier = 120
|
sprintMultiplier = 100
|
||||||
func spawn():
|
func spawn():
|
||||||
texture.play("walk")
|
texture.play("walk")
|
||||||
func ai():
|
func ai():
|
||||||
PresetEntityAI.follow(self, currentFocusedBoss, 0)
|
PresetEntityAI.follow(self, currentFocusedBoss, 200)
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
tryAttack(i)
|
tryAttack(i)
|
||||||
func attack(type):
|
func attack(type):
|
||||||
var weaponPos = findWeaponAnchor("normal")
|
var weaponPos = findWeaponAnchor("normal")
|
||||||
if type == 0:
|
if type == 0:
|
||||||
for i in range(20):
|
playSound("attack0")
|
||||||
for bullet in BulletBase.generate(preload("res://components/Bullets/BossAttack/Bear/ArrowSeven.tscn"), self, weaponPos, deg_to_rad(randf_range(0, 360))):
|
for i in randi_range(20, 30):
|
||||||
|
for bullet in BulletBase.generate(preload("res://components/Bullets/BossAttack/Bear/ArrowSeven.tscn"), self, findWeaponAnchor("normal"), deg_to_rad(randf_range(0, 360))):
|
||||||
bullet.tracer = currentFocusedBoss
|
bullet.tracer = currentFocusedBoss
|
||||||
|
bullet.position += MathTool.randv2_range(50)
|
||||||
|
await TickTool.millseconds(50)
|
||||||
|
return false
|
||||||
elif type == 1:
|
elif type == 1:
|
||||||
await sprintTo(currentFocusedBoss.position - Vector2(200, 200), 0.25)
|
await sprintTo(currentFocusedBoss.position - Vector2(MathTool.randc_from([-300, 300]), 300), 0.25)
|
||||||
for i in range(6):
|
var count = randi_range(6, 8)
|
||||||
BulletBase.generate(preload("res://components/Bullets/BossAttack/Bear/SunDance.tscn"), self, weaponPos, deg_to_rad(randf_range(0, 360)))
|
for i in range(count):
|
||||||
|
BulletBase.generate(preload("res://components/Bullets/BossAttack/Bear/SunDance.tscn"), self, weaponPos, deg_to_rad(360.0 / count * i))
|
||||||
elif type == 2:
|
elif type == 2:
|
||||||
for i in range(13):
|
for i in range(13):
|
||||||
for bullet in BulletBase.generate(preload("res://components/Bullets/BossAttack/Bear/ForeverRainbow.tscn"), self, weaponPos, 0):
|
for bullet in BulletBase.generate(preload("res://components/Bullets/BossAttack/Bear/ForeverRainbow.tscn"), self, weaponPos, 0):
|
||||||
bullet.rotation = 360 / 13.0 * i
|
bullet.rotation = 360 / 13.0 * i
|
||||||
elif type == 3:
|
elif type == 3:
|
||||||
await sprintTo(currentFocusedBoss.position - Vector2(500, 0), 0.25)
|
await sprintTo(currentFocusedBoss.position - Vector2(MathTool.randc_from([500, -500]), 0), 0.25)
|
||||||
|
playSound("attack3")
|
||||||
sprintParticle.emitting = true
|
sprintParticle.emitting = true
|
||||||
canRunAi = false
|
canRunAi = false
|
||||||
await TickTool.millseconds(1500)
|
await TickTool.millseconds(900)
|
||||||
BulletBase.generate(preload("res://components/Bullets/BearSprint.tscn"), self, weaponPos, 0)
|
BulletBase.generate(preload("res://components/Bullets/BearSprint.tscn"), self, weaponPos, 0)
|
||||||
await trySprint()
|
await trySprint()
|
||||||
sprintParticle.emitting = false
|
sprintParticle.emitting = false
|
||||||
canRunAi = true
|
canRunAi = true
|
||||||
|
await sprintTo(currentFocusedBoss.position + MathTool.randv2_range(400), 0.25)
|
||||||
|
return false
|
||||||
return true
|
return true
|
||||||
func sprint():
|
func sprint():
|
||||||
move((currentFocusedBoss.position - position).normalized() * sprintMultiplier * Vector2(1, 0), true)
|
move((currentFocusedBoss.position - position).normalized() * sprintMultiplier * Vector2(1, 0), true)
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ var statebar: EntityStateBar
|
|||||||
var health: float = 0
|
var health: float = 0
|
||||||
var energy: float = 0
|
var energy: float = 0
|
||||||
var sprinting: bool = false
|
var sprinting: bool = false
|
||||||
|
var targetableSprinting: bool = false
|
||||||
var trailing: bool = false
|
var trailing: bool = false
|
||||||
|
|
||||||
var lastDirection: int = 1
|
var lastDirection: int = 1
|
||||||
@@ -246,23 +247,28 @@ func tryAttack(type: int, needChargeUp: bool = false):
|
|||||||
if await weapon.tryAttack(self):
|
if await weapon.tryAttack(self):
|
||||||
weapon.playSound("attack")
|
weapon.playSound("attack")
|
||||||
else:
|
else:
|
||||||
attack(type)
|
if await attack(type):
|
||||||
playSound("attack" + str(type))
|
playSound("attack" + str(type))
|
||||||
return state
|
return state
|
||||||
func trySprint():
|
func trySprint():
|
||||||
trailing = true
|
trailing = true
|
||||||
playSound("sprint")
|
playSound("sprint")
|
||||||
sprint()
|
|
||||||
sprinting = true
|
sprinting = true
|
||||||
|
sprint()
|
||||||
await TickTool.until(func(): return !sprinting)
|
await TickTool.until(func(): return !sprinting)
|
||||||
trailing = false
|
trailing = false
|
||||||
func sprintTo(target: Vector2, speed: float):
|
func sprintTo(target: Vector2, speed: float):
|
||||||
|
await TickTool.until(func(): return !targetableSprinting)
|
||||||
|
targetableSprinting = true
|
||||||
|
trailing = true
|
||||||
await TickTool.until(
|
await TickTool.until(
|
||||||
func():
|
func():
|
||||||
position += (target - position) * speed
|
position += (target - position) * speed
|
||||||
return position.distance_to(target) < 10
|
return position.distance_to(target) < 10
|
||||||
)
|
)
|
||||||
position = target
|
position = target
|
||||||
|
trailing = false
|
||||||
|
targetableSprinting = false
|
||||||
func tryDie(by: BulletBase):
|
func tryDie(by: BulletBase):
|
||||||
if is_queued_for_deletion(): return
|
if is_queued_for_deletion(): return
|
||||||
for drop in range(min(len(drops), len(dropCounts))):
|
for drop in range(min(len(drops), len(dropCounts))):
|
||||||
|
|||||||
Reference in New Issue
Block a user