Ejemplo n.º 1
0
 def __init__(self):
     self.name = 'edge'
     self.locations = []
     self.house = None
     self.loc_max = 0
     self.slums_mode = False
     self.faction_mode = False
     self.resources = BarterSystem()
Ejemplo n.º 2
0
class EdgeEngine(object):
    """
    This is the main script of Edge of Mists core module for Mists of Eternal Rome.
    """


    gang_list = []

    def __init__(self):
        self.name = 'edge'
        self.locations = []
        self.house = None
        self.loc_max = 0
        self.slums_mode = False
        self.faction_mode = False
        self.resources = BarterSystem()

    def explore_all(self):
        for i in store.edge_locations.items():
            if i[0] not in unique:
                location = EdgeLocation(i[0], engine_ref=self)
                self.locations.append(location)
            if location.id in ownerable:
                location.gen_owner()
    
    def explore_location(self):
        """
        location = choice(renpy.store.edge_locations.items())
        while self.has_location(location[0]) or location[0] in unique:
            location = choice(renpy.store.edge_locations.items())
        location = EdgeLocation(location[0], engine_ref=self)
        if location.id in ownerable:
            location.gen_owner()
        self.locations.append(location)
        return location
        """
        pass
        
    def get_encounter(self, encounter=None):

        if encounter is None:
            encounter = random.choice(store.edge_encounters.values())
        else:
            encounter = store.edge_encounters[encounter]

        return encounter
    
    def has_location(self, location_id):
        for location in self.locations:
            if location.id == location_id:
                return True
        return False
    

    def get_locations(self, location_id):
        list_ = []
        for location in self.locations:
            if location.id == location_id:
                list_.append(location)
        return list_

    def go_to(self, location):
        location.go_to()

    def make_locations_menu(self):
        menu_list = []
        for location in self.locations:
            displayed = location.name
            menu_list.append((displayed, location))
        diff = self.loc_max - len(self.locations)
        for i in range(diff):
            menu_list.append(('???', 'pass'))
        menu_list.append(('Do not go anywhere', 'done'))
        choice = renpy.display_menu(menu_list)
        if choice == 'done':
            return renpy.call('lbl_edge_manage')
        if choice == 'pass':
            return renpy.call('lbl_edge_missed_location')
        return self.go_to(choice)

    def remove_location(self, location):
        self.locations.remove(location)

    def is_maximum_scouted(self):
        if len(self.locations) < self.loc_max:
            return False
        return True

    def locations_tick(self):
        for location in self.locations:
            location.increase_stash_difficulty()

    def player_has_cache(self):
        for location in self.locations:
            if location.player_cache:
                return True

    def go_to_mist(self):
        self.locations = []
        self.house = choice(store.house_names.values())
        trade_loc = EdgeLocation('outpost', True, engine_ref=self)
        trade_loc.gen_owner(choice(store.great_houses))
        mist_loc = EdgeLocation('shifting_mist', True, engine_ref=self)
        self.locations.append(trade_loc)
        self.locations.append(mist_loc)
        self.explore_all()
    
    def in_any_gang(self, person):
        return any([gang for gang in self.gang_list if person in gang.members])

    def new_turn(self):
        self.locations_tick()
        self.resources.tick_time()
        self.core.new_turn()