It might make logical sense. Honestly, I'm just tired of the code for World being so long.
27 lines
635 B
Python
27 lines
635 B
Python
from collections import defaultdict
|
|
|
|
from aoe.types import *
|
|
from aoe.exceptions import *
|
|
|
|
|
|
|
|
class Housing():
|
|
|
|
|
|
def check_housing(self, world, thing):
|
|
required = self.required[thing]
|
|
|
|
if required > 0:
|
|
pop_space = world.get_population_space()
|
|
if world.get_effective_population() > pop_space + required:
|
|
raise YallGotHousedException
|
|
|
|
|
|
def __init__(self):
|
|
self.space = defaultdict(int, {
|
|
Buildings.HOUSE: 5,
|
|
Buildings.TOWNCENTER: 5,
|
|
})
|
|
|
|
self.required = defaultdict(int, {u: 1 for u in Units})
|