From 2d41a1f86bfcc4b4b685bfa39c15c9bf1c31b084 Mon Sep 17 00:00:00 2001 From: hldh214 Date: Mon, 3 Jul 2023 14:06:36 +0900 Subject: [PATCH] fix(farmer): `_total_troops_capacity_according_to_resources` logic issues Signed-off-by: hldh214 --- lokbot/farmer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lokbot/farmer.py b/lokbot/farmer.py index dafa7703..3bcd81c0 100644 --- a/lokbot/farmer.py +++ b/lokbot/farmer.py @@ -1025,15 +1025,15 @@ def _total_troops_capacity_according_to_resources(self, troop_code): """ req_resources = TRAIN_TROOP_RESOURCE_REQUIREMENT[troop_code] - amount = 0 + amount = None for req_resource, resource in zip(req_resources, self.resources): if req_resource == 0: continue - if amount == 0 or resource // req_resource <= amount: + if amount is None or resource // req_resource <= amount: amount = resource // req_resource - return amount + return amount if amount is not None else 0 def _random_choice_building(self, building_code): """