mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
fix(Feed): 修复countOf函数中乘数应用的逻辑错误
当基础值为正数时使用乘法,为负数时使用除法,确保计算结果的正确性
This commit is contained in:
@@ -72,7 +72,8 @@ func apply(entity: EntityBase):
|
|||||||
selected.emit(allHave)
|
selected.emit(allHave)
|
||||||
return allHave
|
return allHave
|
||||||
func countOf(index: int) -> int:
|
func countOf(index: int) -> int:
|
||||||
return ceil(costCounts[index] * multipiler())
|
var base = costCounts[index]
|
||||||
|
return ceil(base * multipiler()) if base > 0 else floor(base / multipiler())
|
||||||
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user