Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Commit

Permalink
fix(farmer): _total_troops_capacity_according_to_resources logic is…
Browse files Browse the repository at this point in the history
…sues

Signed-off-by: hldh214 <[email protected]>
  • Loading branch information
hldh214 committed Jul 3, 2023
1 parent 947cd02 commit 2d41a1f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lokbot/farmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down

0 comments on commit 2d41a1f

Please sign in to comment.