feat: 口粮消耗与饥饿减半([food] 配置驱动)
This commit is contained in:
@@ -12,14 +12,32 @@ func _ready() -> void:
|
||||
# 每日推进时结算全体已入宗弟子的修为与境界
|
||||
TimeSystem.day_passed.connect(_on_day_passed)
|
||||
|
||||
## 每日结算:仅结算已入宗名录(候选池不修炼)。
|
||||
## 每日结算:先扣口粮,再结算已入宗弟子的修为与境界(候选池不修炼)。
|
||||
func _on_day_passed(_year: int, _month: int, _day: int) -> void:
|
||||
_settle_food()
|
||||
for d in DiscipleManager.disciples:
|
||||
_gain_exp(d)
|
||||
_check_breakthrough(d)
|
||||
|
||||
## 每日口粮结算:练气弟子人均消耗灵米(筑基+辟谷豁免)。
|
||||
## 食物充足 → 扣减并饥饿清零;食物不足 → 归零并全员饥饿天数 +1。
|
||||
func _settle_food() -> void:
|
||||
var eaters: Array[Disciple] = []
|
||||
for d in DiscipleManager.disciples:
|
||||
if d.realm_index == 0:
|
||||
eaters.append(d)
|
||||
var need := eaters.size() * GameConfig.food_consumption_per_disciple
|
||||
if SectManager.food >= need:
|
||||
SectManager.remove_food(need)
|
||||
for d in eaters:
|
||||
d.hunger_days = 0
|
||||
return
|
||||
SectManager.remove_food(SectManager.food)
|
||||
for d in eaters:
|
||||
d.hunger_days += 1
|
||||
|
||||
## 按公式累计一日修为。
|
||||
## 速度 = 基础速度 × 资质倍率 × 灵根容量 × 天灵根加成 × 灵气浓度
|
||||
## 速度 = 基础速度 × 资质倍率 × 灵根容量 × 天灵根加成 × 灵气浓度 × 饥饿倍率
|
||||
## 练气圆满(13 层)后修为封顶,不再增长。
|
||||
## @param d: 已入宗弟子
|
||||
func _gain_exp(d: Disciple) -> void:
|
||||
@@ -32,6 +50,8 @@ func _gain_exp(d: Disciple) -> void:
|
||||
if d.is_heavenly:
|
||||
speed *= GameConfig.heavenly_bonus
|
||||
speed *= GameConfig.qi_concentration
|
||||
if d.hunger_days > 0:
|
||||
speed *= GameConfig.hunger_speed_multiplier
|
||||
d.cultivation_exp += speed
|
||||
|
||||
## 突破判定:修为满当前层门槛时推进境界。
|
||||
|
||||
Reference in New Issue
Block a user