mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-30 07:51:54 +08:00
refactor(MathTool): 重命名随机数生成方法并优化蘑菇矿挖爪属性
将 randomVector2In 重命名为 sampleInCircle,randomRingPoint 重命名为 sampleInRing,randChoiceWeightsFrom 重命名为 randomChoiceFromWeights,signBeforeStr 重命名为 toSigned 调整蘑菇矿挖爪的攻击力和掉落率,减少基础伤害至0.5,固定掉落率为0.1,优化物品掉落逻辑
This commit is contained in:
@@ -234,7 +234,7 @@ func takeDamage(baseDamage: float, crit: bool = false, perfectMiss: bool = false
|
||||
var resultDamage = baseDamage + baseDamage * int(crit) * fields.get(FieldStore.Entity.CRIT_DAMAGE)
|
||||
health -= resultDamage
|
||||
healthChanged.emit(health)
|
||||
DamageLabel.create(resultDamage, crit || perfectMiss, damageAnchor.global_position + MathTool.randomVector2In(GameRule.damageLabelSpawnOffset))
|
||||
DamageLabel.create(resultDamage, crit || perfectMiss, damageAnchor.global_position + MathTool.sampleInCircle(GameRule.damageLabelSpawnOffset))
|
||||
if health <= 0:
|
||||
tryDie(null)
|
||||
return resultDamage
|
||||
@@ -261,7 +261,7 @@ func bulletHit(bullet: BulletBase, crit: bool):
|
||||
hit.emit(damage, bullet, crit)
|
||||
health -= damage
|
||||
healthChanged.emit(health)
|
||||
DamageLabel.create(damage, crit || perfectMiss, damageAnchor.global_position + MathTool.randomVector2In(GameRule.damageLabelSpawnOffset))
|
||||
DamageLabel.create(damage, crit || perfectMiss, damageAnchor.global_position + MathTool.sampleInCircle(GameRule.damageLabelSpawnOffset))
|
||||
if isBoss and bullet.launcher.isPlayer():
|
||||
bullet.launcher.setBoss(self)
|
||||
if health <= 0:
|
||||
@@ -338,24 +338,24 @@ func tryDie(by: BulletBase = null):
|
||||
var item = drops[drop]
|
||||
var count = ceil(randf_range(dropCounts[drop].x, dropCounts[drop].y))
|
||||
for i in range(count):
|
||||
ItemDropped.generate(item, randi_range(1, round(2.5 * sqrt(GameRule.difficulty - GameRule.difficultyRange.x + 1))), position + MathTool.randomVector2In(GameRule.itemDroppedSpawnOffset))
|
||||
ItemDropped.generate(item, randi_range(1, round(2.5 * sqrt(GameRule.difficulty - GameRule.difficultyRange.x + 1))), position + MathTool.sampleInCircle(GameRule.itemDroppedSpawnOffset))
|
||||
if MathTool.rate(
|
||||
GameRule.appleDropRate +
|
||||
by.launcher.fields.get(FieldStore.Entity.DROP_APPLE_RATE) +
|
||||
GameRule.appleDropRateInfluenceByLuckValue * by.launcher.fields[FieldStore.Entity.LUCK_VALUE]
|
||||
) or isBoss:
|
||||
for i in randi_range(appleCount.x, appleCount.y):
|
||||
ItemDropped.generate(ItemStore.ItemType.APPLE, 1, position + MathTool.randomVector2In(GameRule.itemDroppedSpawnOffset))
|
||||
ItemDropped.generate(ItemStore.ItemType.APPLE, 1, position + MathTool.sampleInCircle(GameRule.itemDroppedSpawnOffset))
|
||||
ItemDropped.generate(
|
||||
ItemStore.ItemType.BEACHBALL,
|
||||
fields[FieldStore.Entity.MAX_HEALTH] * randf_range(1 - GameRule.beachballOffset, 1 + GameRule.beachballOffset),
|
||||
position + MathTool.randomVector2In(GameRule.itemDroppedSpawnOffset)
|
||||
position + MathTool.sampleInCircle(GameRule.itemDroppedSpawnOffset)
|
||||
)
|
||||
if isBoss:
|
||||
ItemDropped.generate(
|
||||
ItemStore.ItemType.SOUL,
|
||||
randi_range(1, 2),
|
||||
position + MathTool.randomVector2In(GameRule.itemDroppedSpawnOffset)
|
||||
position + MathTool.sampleInCircle(GameRule.itemDroppedSpawnOffset)
|
||||
)
|
||||
if isPlayer():
|
||||
if UIState.player == self:
|
||||
@@ -452,7 +452,7 @@ func sprint():
|
||||
pass
|
||||
func heal(count: float):
|
||||
health += count
|
||||
DamageLabel.create(-count, false, damageAnchor.global_position + MathTool.randomVector2In(GameRule.damageLabelSpawnOffset))
|
||||
DamageLabel.create(-count, false, damageAnchor.global_position + MathTool.sampleInCircle(GameRule.damageLabelSpawnOffset))
|
||||
return count
|
||||
func register():
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user