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

fix: 修复实体伤害计算和物品掉落逻辑

调整实体伤害倍数的计算公式,使用平方根来平衡增长曲线
修正物品掉落数量计算,考虑难度范围的影响
修复boss掉落和玩家死亡面板的代码缩进问题
This commit is contained in:
2025-11-09 11:34:46 +08:00
parent a56196351c
commit 8ece2a60a5
2 changed files with 13 additions and 11 deletions
+2
View File
@@ -6,6 +6,8 @@ extends FullscreenPanelBase
@onready var levelShow: Label = $"%levelShow" @onready var levelShow: Label = $"%levelShow"
func _ready(): func _ready():
diffEdit.min_value = GameRule.difficultyRange.x
diffEdit.max_value = GameRule.difficultyRange.y
startBtn.pressed.connect( startBtn.pressed.connect(
func(): func():
Wave.next() Wave.next()
+11 -11
View File
@@ -204,7 +204,7 @@ func setStage(stage: int):
currentInvinsible = false currentInvinsible = false
func applyLevel(): func applyLevel():
fields[FieldStore.Entity.MAX_HEALTH] *= (1 + GameRule.entityHealthIncreasePerWave * (GameRule.difficulty - GameRule.difficultyRange.x + 1)) ** level fields[FieldStore.Entity.MAX_HEALTH] *= (1 + GameRule.entityHealthIncreasePerWave * (GameRule.difficulty - GameRule.difficultyRange.x + 1)) ** level
fields[FieldStore.Entity.DAMAGE_MULTIPILER] *= (1 + GameRule.entityDamageIncreasePerWave * (GameRule.difficulty - GameRule.difficultyRange.x)) ** level fields[FieldStore.Entity.DAMAGE_MULTIPILER] *= sqrt((1 + GameRule.entityDamageIncreasePerWave * (GameRule.difficulty - GameRule.difficultyRange.x))) ** level
func displace(direction: Vector2, isSprinting: bool = false): func displace(direction: Vector2, isSprinting: bool = false):
return (direction if isSprinting else direction.normalized()) * fields.get(FieldStore.Entity.MOVEMENT_SPEED) * 400 * abs(animatree.get("parameters/blend_position")) return (direction if isSprinting else direction.normalized()) * fields.get(FieldStore.Entity.MOVEMENT_SPEED) * 400 * abs(animatree.get("parameters/blend_position"))
func move(direction: Vector2, isSprinting: bool = false): func move(direction: Vector2, isSprinting: bool = false):
@@ -314,7 +314,7 @@ func tryDie(by: BulletBase = null):
var item = drops[drop] var item = drops[drop]
var count = ceil(randf_range(dropCounts[drop].x, dropCounts[drop].y)) var count = ceil(randf_range(dropCounts[drop].x, dropCounts[drop].y))
for i in range(count): for i in range(count):
ItemDropped.generate(item, randi_range(1, int(sqrt(count) + GameRule.difficulty)), position + MathTool.randv2_range(GameRule.itemDroppedSpawnOffset)) ItemDropped.generate(item, randi_range(1, int(sqrt(count) * (GameRule.difficulty - GameRule.difficultyRange.x + 1))), position + MathTool.randv2_range(GameRule.itemDroppedSpawnOffset))
if MathTool.rate( if MathTool.rate(
GameRule.appleDropRate + GameRule.appleDropRate +
by.launcher.fields.get(FieldStore.Entity.DROP_APPLE_RATE) + by.launcher.fields.get(FieldStore.Entity.DROP_APPLE_RATE) +
@@ -327,15 +327,15 @@ func tryDie(by: BulletBase = null):
fields[FieldStore.Entity.MAX_HEALTH] * randf_range(1 - GameRule.beachballOffset, 1 + GameRule.beachballOffset), fields[FieldStore.Entity.MAX_HEALTH] * randf_range(1 - GameRule.beachballOffset, 1 + GameRule.beachballOffset),
position + MathTool.randv2_range(GameRule.itemDroppedSpawnOffset) position + MathTool.randv2_range(GameRule.itemDroppedSpawnOffset)
) )
if isBoss: if isBoss:
ItemDropped.generate( ItemDropped.generate(
ItemStore.ItemType.SOUL, ItemStore.ItemType.SOUL,
randi_range(1, 2), randi_range(1, 2),
position + MathTool.randv2_range(GameRule.itemDroppedSpawnOffset) position + MathTool.randv2_range(GameRule.itemDroppedSpawnOffset)
) )
if isPlayer(): if isPlayer():
if UIState.player == self: if UIState.player == self:
UIState.setPanel("GameOver", [displayName, by.launcher.displayName, by.displayName]) UIState.setPanel("GameOver", [displayName, by.launcher.displayName, by.displayName])
EffectController.create(ComponentManager.getEffect("DeadBlood"), texture.global_position).shot() EffectController.create(ComponentManager.getEffect("DeadBlood"), texture.global_position).shot()
await die() await die()
died.emit() died.emit()