1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-10 05:37:12 +08:00

feat(武器系统): 优化LGBT武器和召唤物行为

- 增加LGBT武器的冷却时间从0.1到1000
- 召唤物现在会继承召唤者位置
- 优化子弹追踪逻辑和生命周期
- 修复召唤物AI行为和玩家状态检测
- 调整召唤物属性和攻击冷却时间
This commit is contained in:
2025-11-06 22:42:01 +08:00
parent a273f644d2
commit 287f29695d
7 changed files with 26 additions and 17 deletions
+12 -6
View File
@@ -118,9 +118,10 @@ func _ready():
weapons.append(i)
weaponBag.append(i.displayName)
statebar.levelLabels.hide()
UIState.player = self
if !is_instance_valid(UIState.player): UIState.player = self
energyChanged.connect(
func(newEnergy, dontChangeDirection):
if !UIState.player == self: return
UIState.energyPercent.maxValue = fields.get(FieldStore.Entity.MAX_ENERGY)
if dontChangeDirection:
UIState.energyPercent.currentValue = newEnergy
@@ -129,8 +130,6 @@ func _ready():
)
rebuildWeaponIcons()
else:
if !currentFocusedBoss:
currentFocusedBoss = get_tree().get_nodes_in_group("players")[0]
applyLevel()
health = fields.get(FieldStore.Entity.MAX_HEALTH)
energy = fields.get(FieldStore.Entity.MAX_ENERGY)
@@ -158,6 +157,8 @@ func _process(_delta):
if is_instance_valid(statebar):
statebar.levelLabel.text = str(level)
func _physics_process(_delta: float) -> void:
if !isPlayer() && !currentFocusedBoss:
currentFocusedBoss = MathTool.randc_from(get_tree().get_nodes_in_group("players"))
animatree.set("parameters/blend_position", lerpf(animatree.get("parameters/blend_position"), lastDirection, 0.2))
if sprinting:
if sprintAi():
@@ -166,6 +167,8 @@ func _physics_process(_delta: float) -> void:
velocity = Vector2.ZERO
if (isPlayer() or is_instance_valid(currentFocusedBoss)) and not charginup and canRunAi:
ai()
elif isSummon():
ai()
move_and_slide()
storeEnergy(randf_range(0.01, 0.05 + fields.get(FieldStore.Entity.ENERGY_REGENERATION) - 1), true)
trailParticle.emitting = trailing
@@ -255,13 +258,13 @@ func useEnergy(value: float):
return state
func tryAttack(type: int, needChargeUp: bool = false):
var weapon: Weapon
if isPlayer():
if isPlayer() and !isSummon():
if len(weapons) > type:
weapon = weapons[type]
else:
return
var state
if isPlayer():
if isPlayer() and !isSummon():
state = true
else:
var cooldownTimer: CooldownTimer
@@ -275,7 +278,7 @@ func tryAttack(type: int, needChargeUp: bool = false):
charginup = true
await EffectController.create(ComponentManager.getEffect("AttackStar"), damageAnchor.global_position).shot()
charginup = false
if isPlayer():
if isPlayer() and !isSummon():
if await weapon.tryAttack(self):
weapon.playSound("attack")
else:
@@ -376,6 +379,7 @@ func getItem(items: Dictionary):
inventory[item] = clamp(inventory[item] + items[item], 0, inventoryMax[item])
func summon(who: PackedScene, syncFields: bool = true, lockValue: bool = true) -> SummonBase:
var instance: SummonBase = who.instantiate()
instance.position = position
instance.myMaster = self
if isPlayer(): instance.add_to_group("players")
if syncFields:
@@ -393,6 +397,8 @@ func getTrackingAnchor() -> Vector2:
# 关于分组
func isPlayer():
return is_in_group("players")
func isSummon():
return self is SummonBase
# 抽象方法,实际上是一些钩子,不需要全部实现
func ai():