Move more code into separate classes

It might make logical sense.  Honestly, I'm just tired of the code for
World being so long.
This commit is contained in:
Nate Bowman
2026-07-30 19:33:05 -04:00
parent d7dcc0d873
commit e25abd87ab
4 changed files with 44 additions and 40 deletions

View File

@@ -1,6 +1,7 @@
import copy
from aoe.types import *
from aoe.exceptions import *
@@ -136,6 +137,23 @@ class Gather():
BIG_NUMBER = 1e6
def check_gather(self, world, task, count=1):
if task in [Tasks.IDLE, Tasks.BUILD]:
return
required = self.required_gather_buildings[task]
have = set(world.buildings)
match = any(map(have.issuperset, required))
if not match:
raise GatherBuildingNotAvailableException
if task == task.FARM:
if world.villager_tasks[task] + count > len(world.unused_farms):
raise GatherBuildingNotAvailableException
def __init__(self):
self.gather_rates = {
Tasks.BERRIES: 18.6/60,