优化层级计算逻辑

This commit is contained in:
liuwei
2025-11-19 09:03:37 +08:00
parent 740e4fecd0
commit 3fbca21e1a
2 changed files with 22 additions and 5 deletions

View File

@@ -111,11 +111,14 @@ thresholds = [
[Xiuxian.breakthrough_stages]
# 瓶颈突破定义当前境界10层:路径:修为消耗:成功率:目标境界
# 注意突破修为要求应该与达到10层所需修为一致或略高
# 炼气10层需要9000修为9×1000所以突破要求应该≥9000
# 筑基10层需要45000修为9×5000所以突破要求应该≥45000
paths = [
"炼气10层:pill:5000:0.4:筑基1层",
"炼气10层:hard:20000:0.1:筑基2层",
"筑基10层:pill:50000:0.2:金丹1层",
"筑基10层:hard:200000:0.05:金丹2层"
"炼气10层:pill:9000:0.4:筑基1层", # 修复从5000改为9000与达到10层所需修为一致
"炼气10层:hard:18000:0.1:筑基2层", # 修复从20000改为180002倍
"筑基10层:pill:45000:0.2:金丹1层", # 修复从50000改为45000与达到10层所需修为一致
"筑基10层:hard:90000:0.05:金丹2层" # 修复从200000改为900002倍
]
[Xiuxian.points_exchange]
point_to_stone_rate = 10

View File

@@ -777,6 +777,16 @@ class XiuxianPlugin(MessagePluginInterface):
self.redis_db.leaderboard_realm_add(user_id, float(self._realm_score(new_realm)))
def _auto_layer_up(self, user_id: str, player: Dict[str, Any]):
"""自动层级提升:根据修为自动提升层数(不跨瓶颈)
逻辑:
- 炼气1层0-999修为
- 炼气2层1000-1999修为
- ...
- 炼气10层9000-9999修为
计算公式new_layer = min(10, (pts // threshold) + 1)
"""
prefix, layer = self._parse_realm(player.get("realm", "凡人"))
if layer is None or layer >= 10:
return
@@ -784,7 +794,11 @@ class XiuxianPlugin(MessagePluginInterface):
if not threshold:
return
pts = int(player.get("cultivation_points", 0))
new_layer = max(layer, min(10, pts // threshold))
# 修复:计算应该达到的层数 = (修为 // 每层阈值) + 1
# 例如1000修为 → 1000 // 1000 = 1 → 1 + 1 = 2层
calculated_layer = min(10, (pts // threshold) + 1)
# 只允许提升,不允许降低
new_layer = max(layer, calculated_layer)
if new_layer != layer:
self._set_realm(user_id, player, f"{prefix}{new_layer}")