mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
fix(EnergyBlock): 移除被注释的AI攻击逻辑
refactor(Parrier): 重构penerateEffect方法并优化位置计算 feat(MuyangDog): 添加Tree武器到武器库
This commit is contained in:
@@ -3,9 +3,13 @@
|
||||
[ext_resource type="PackedScene" uid="uid://bs863g2s8r770" path="res://components/Abstracts/PlayerBase.tscn" id="1_y3l4w"]
|
||||
[ext_resource type="Script" uid="uid://bbmb572iba42l" path="res://scripts/Contents/Characters/MuyangDog.gd" id="2_mr6nm"]
|
||||
[ext_resource type="PackedScene" uid="uid://u0djqwuuysp8" path="res://components/Weapons/Volcano.tscn" id="3_e236u"]
|
||||
[ext_resource type="PackedScene" uid="uid://cx7nogfnv7s8t" path="res://components/Weapons/Tree.tscn" id="4_im5m5"]
|
||||
|
||||
[node name="MuyangDog" unique_id=1711205167 instance=ExtResource("1_y3l4w")]
|
||||
script = ExtResource("2_mr6nm")
|
||||
displayName = "牧羊犬"
|
||||
|
||||
[node name="Volcano" parent="weaponStore" index="0" unique_id=204992396 instance=ExtResource("3_e236u")]
|
||||
|
||||
[node name="Tree" parent="weaponStore" index="1" unique_id=185228402 instance=ExtResource("4_im5m5")]
|
||||
debugRebuild = false
|
||||
|
||||
@@ -10,19 +10,18 @@ var atk: float = 1
|
||||
var reflectRate: float = 1
|
||||
|
||||
func parryEffect(bullet: BulletBase):
|
||||
# 生成格挡特效
|
||||
parryiedTimes += 1
|
||||
var eff = EffectController.create(ComponentManager.getEffect("Parry"), position + (bullet.position - position).normalized() * 200) # 从子弹位置,面向其他子弹的方向前进150
|
||||
eff.modulate = bullet.modulate.blend(bullet.texture.modulate)
|
||||
eff.rotation = position.angle_to_point(bullet.position)
|
||||
eff.shot()
|
||||
launcher.impluse((position - bullet.position).normalized() * sqrt(abs(bullet.speed)) * 250)
|
||||
func penerateEffect(entity: EntityBase):
|
||||
func penerateEffect(entity: EntityBase, effPos: Vector2):
|
||||
parryiedTimes += 1
|
||||
var eff = EffectController.create(ComponentManager.getEffect("ParryEntity"), position)
|
||||
eff.rotation = position.angle_to_point(position)
|
||||
var eff = EffectController.create(ComponentManager.getEffect("ParryEntity"), effPos)
|
||||
eff.rotation = entity.position.angle_to_point(effPos)
|
||||
eff.shot()
|
||||
entity.impluse((entity.position - position).normalized() * 450)
|
||||
entity.impluse((entity.position - effPos).normalized() * 450)
|
||||
func generateParryBall(bDamage: float):
|
||||
var cycler = launcher.getOrCreateCycleTimer("parry", 2000, 100)
|
||||
if len(cycler.bullets) < maxBallCount: # 玩家最多只能拥有多少气
|
||||
@@ -48,7 +47,7 @@ func spawn():
|
||||
eff.shot()
|
||||
func succeedToHit(_dmg: float, entity: EntityBase):
|
||||
if parryiedTimes < maxParryTimes && MathTool.rate(parryRate):
|
||||
penerateEffect(entity)
|
||||
penerateEffect(entity, entity.position * 1.01)
|
||||
func hitBullet(bullet: BulletBase): # 当前子弹与其他子弹相撞
|
||||
if !is_instance_valid(launcher): return
|
||||
if BulletTool.canDamage(bullet, launcher): # 其他子弹可以使当前子弹的发射者受伤吗?
|
||||
@@ -75,6 +74,7 @@ func hitBullet(bullet: BulletBase): # 当前子弹与其他子弹相撞
|
||||
generateParryBall(bullet.baseDamage)
|
||||
elif bullet.motionType == BulletBase.MotionType.STAB:
|
||||
parryEffect(bullet)
|
||||
penerateEffect(bullet.launcher, bullet.launcher.position * 1.01)
|
||||
bullet.hitbox.set_deferred("disabled", true)
|
||||
bullet.launcher.takeDamage(atk * reflectRate * bullet.getDamage())
|
||||
bullet.launcher.impluse(Vector2.from_angle(bullet.rotation) * -2000)
|
||||
@@ -85,10 +85,10 @@ func hitBullet(bullet: BulletBase): # 当前子弹与其他子弹相撞
|
||||
bullet.launcher.velocity *= -0.1
|
||||
generateParryBall(bullet.baseDamage)
|
||||
elif bullet.motionType == BulletBase.MotionType.BREATH:
|
||||
penerateEffect(bullet.launcher)
|
||||
penerateEffect(bullet.launcher, launcher.position)
|
||||
bullet.launcher.impluse(Vector2.from_angle(bullet.rotation) * -500)
|
||||
elif bullet.motionType == BulletBase.MotionType.SUMMON || bullet.motionType == BulletBase.MotionType.MAGIC:
|
||||
penerateEffect(bullet.launcher)
|
||||
penerateEffect(bullet.launcher, launcher.position)
|
||||
launcher.storeEnergy(sqrt(bullet.baseDamage))
|
||||
|
||||
func refract(_newBullet: BulletBase, _entity: EntityBase, _index: int, _total: int, _lastBullet: float):
|
||||
|
||||
@@ -17,11 +17,11 @@ func register():
|
||||
sprintMultiplier = 30
|
||||
func ai():
|
||||
PresetEntityAI.distanceAttack(self , currentFocusedBoss, 0, 300, 0)
|
||||
PresetEntityAI.distanceAttack(self , currentFocusedBoss, 500, 1000, 1)
|
||||
for i in 5:
|
||||
tryAttack(i + 2, [3, 4])
|
||||
if 1 not in attackingStates:
|
||||
PresetEntityAI.follow(self , currentFocusedBoss, 200)
|
||||
# PresetEntityAI.distanceAttack(self , currentFocusedBoss, 500, 1000, 1)
|
||||
# for i in 5:
|
||||
# tryAttack(i + 2, [3, 4])
|
||||
# if 1 not in attackingStates:
|
||||
# PresetEntityAI.follow(self , currentFocusedBoss, 200)
|
||||
func attack(type: int):
|
||||
if type == 0:
|
||||
for bullet in BulletBase.generate(ComponentManager.getBullet("SwingSword"), self , getTrackingAnchor(), getTrackingAnchor().angle_to_point(currentFocusedPosition)):
|
||||
|
||||
Reference in New Issue
Block a user