1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 06:51:54 +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
})
soulLevel -= 1
updateStore(level, UIState.player)
rebuildInfo()
)
inlayBtn.pressed.connect(
func():
if soulLevel < WeaponName.SoulLevel.INFINITY - 1:
if soulLevel < WeaponName.SoulLevel.INFINITY:
if UIState.player.useItem({
ItemStore.ItemType.SOUL: soulLevel
}):
soulLevel += 1
updateStore(level, UIState.player)
rebuildInfo()
)
for i in sounds.get_children():
@@ -75,11 +77,13 @@ func apply(entity: EntityBase):
if allHave:
level += 1
entity.inventory[ItemStore.ItemType.BEACHBALL] -= costBeachball
store = update(level, originalStore.duplicate(), entity)
updateStore(level, entity)
costBeachball = floor(GameRule.weaponUpdateCost * costBeachball)
needEnergy = GameRule.weaponUpdateEnergy * needEnergy
rebuildInfo()
return allHave
func updateStore(to: int, entity: EntityBase):
store = update(to, originalStore.duplicate(), entity)
func multipiler() -> float:
if is_instance_valid(UIState.player):
return 1 - UIState.player.fields.get(FieldStore.Entity.PRICE_REDUCTION)