Esempio n. 1
0
    def __init__(self, parent, religion, from_city, destination_city, has_boat):
        self.from_city = from_city
        self.destination_city = destination_city

        self.religion = religion

        self.resources_sent = {}

        # Find out what they need
        resource_diff = from_city.get_resource_differences(destination_city)

        for resource in resource_diff:
            if resource_diff[resource] > 0:
                self.resources_sent[resource] = random.randint(1, int(resource_diff[resource]))

        # This is to ensure that all caravans make at least some money
        self.resources_sent['trade_goods'] = random.randint(1, int(math.log(from_city.population)) ** 2 + 1)

        # Set up the rest of the information we need to be a proper group object
        Group.__init__(self, parent, 'caravan', (religion, self.resources_sent), from_city.position,
                       destination_city.position, from_city.nation.color, lambda _: False,
                       self.receive_caravan, has_boat)
Esempio n. 2
0
 def __init__(self, content=None, parent=None):
     Group.__init__(self, content, parent)
     self._viewport = Viewport(content)
Esempio n. 3
0
 def __init__(self, content=None, parent=None):
     Group.__init__(self, content, parent)
     self._viewport = Viewport(content)
Esempio n. 4
0
 def __init__(self):
     Group.__init__(self)