1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-26 21:42:29 +08:00

fix(Weapon): 修复灵魂等级提升逻辑并优化商店更新

修复灵魂等级提升条件判断错误,将INFINITY-1改为INFINITY
添加updateStore方法集中处理商店更新逻辑
在升级和镶嵌操作后统一调用商店更新方法
This commit is contained in:
2025-09-20 07:08:18 +08:00
parent 5a94a5905b
commit ba865bc2a2
+6 -2
View File
@@ -49,15 +49,17 @@ func _ready():
ItemStore.ItemType.SOUL: soulLevel ItemStore.ItemType.SOUL: soulLevel
}) })
soulLevel -= 1 soulLevel -= 1
updateStore(level, UIState.player)
rebuildInfo() rebuildInfo()
) )
inlayBtn.pressed.connect( inlayBtn.pressed.connect(
func(): func():
if soulLevel < WeaponName.SoulLevel.INFINITY - 1: if soulLevel < WeaponName.SoulLevel.INFINITY:
if UIState.player.useItem({ if UIState.player.useItem({
ItemStore.ItemType.SOUL: soulLevel ItemStore.ItemType.SOUL: soulLevel
}): }):
soulLevel += 1 soulLevel += 1
updateStore(level, UIState.player)
rebuildInfo() rebuildInfo()
) )
for i in sounds.get_children(): for i in sounds.get_children():
@@ -75,11 +77,13 @@ func apply(entity: EntityBase):
if allHave: if allHave:
level += 1 level += 1
entity.inventory[ItemStore.ItemType.BEACHBALL] -= costBeachball entity.inventory[ItemStore.ItemType.BEACHBALL] -= costBeachball
store = update(level, originalStore.duplicate(), entity) updateStore(level, entity)
costBeachball = floor(GameRule.weaponUpdateCost * costBeachball) costBeachball = floor(GameRule.weaponUpdateCost * costBeachball)
needEnergy = GameRule.weaponUpdateEnergy * needEnergy needEnergy = GameRule.weaponUpdateEnergy * needEnergy
rebuildInfo() rebuildInfo()
return allHave return allHave
func updateStore(to: int, entity: EntityBase):
store = update(to, originalStore.duplicate(), entity)
func multipiler() -> float: func multipiler() -> float:
if is_instance_valid(UIState.player): if is_instance_valid(UIState.player):
return 1 - UIState.player.fields.get(FieldStore.Entity.PRICE_REDUCTION) return 1 - UIState.player.fields.get(FieldStore.Entity.PRICE_REDUCTION)