修复冒险模式使用食物的相关错误
This commit is contained in:
@@ -533,9 +533,9 @@ class CombatService:
|
||||
recommended_food = math.ceil(stage_time / food_support_time)
|
||||
|
||||
# 如果没有提供食物,给出提示但允许继续
|
||||
if len(food_items) == 0:
|
||||
msg = f"ℹ️ 未使用食物。推荐使用 {recommended_food} 个果酒以获得buff加成"
|
||||
return True, msg, recommended_food
|
||||
#if len(food_items) == 0:
|
||||
# msg = f"ℹ️ 未使用食物。推荐使用 {recommended_food} 个果酒以获得buff加成"
|
||||
# return True, msg, recommended_food
|
||||
|
||||
return True, "", recommended_food
|
||||
|
||||
@@ -696,9 +696,9 @@ class CombatService:
|
||||
# 验证拥有
|
||||
user_items = backpack.get_user_items(user_id)
|
||||
for food_id, count in food_count.items():
|
||||
owned = sum(1 for item in user_items if item.item_id == food_id)
|
||||
owned = sum(item.quantity for item in user_items if item.item_id == food_id)
|
||||
if owned < count:
|
||||
return False, f"❌ {food_id} 数量不足,需要 {count} 个", None
|
||||
return False, f"❌ {food_id} 数量不足,还需要 {count - owned} 个, 当前只有{owned}个", None
|
||||
|
||||
# 消耗食物
|
||||
for food_id, count in food_count.items():
|
||||
|
||||
Reference in New Issue
Block a user