Ejemplo n.º 1
0
    def __init__(self,
                 enable_no_resp_die=True,
                 map=None):
        self.enable_no_resp_die = enable_no_resp_die

        if not map:
            m = Map.loadfile(DEFAULT_MAP)
        else:
            m = Map.loadfile(map)
            
        self.set_map(m)            
        
        self.start()
Ejemplo n.º 2
0
    def __init__(self,
                 enable_no_resp_die=True,
                 map=None):
        self.enable_no_resp_die = enable_no_resp_die

        if not map:
            m = Map.loadfile(DEFAULT_MAP)
        else:
            m = Map.loadfile(map)
            
        self.set_map(m)            
        
        self.map_max_units = m.max_sum
        self.maintain_fee = m.meta.get('maintain_fee', False)
        self.start()
Ejemplo n.º 3
0
    def __init__(self,
                 enable_bean=True,
                 enable_wall=True,
                 enable_no_resp_die=True,
                 map=None):
        self.enable_bean = enable_bean
        self.enable_wall = enable_wall
        self.enable_no_resp_die = enable_no_resp_die

        if not map:
            map = Map.loadfile(DEFAULT_MAP)
        self.set_map(map)
        self.start()
Ejemplo n.º 4
0
    def __init__(self,
                 enable_bean=True,
                 enable_wall=True,
                 enable_no_resp_die=True,
                 map=None):
        self.enable_bean = enable_bean
        self.enable_wall = enable_wall
        self.enable_no_resp_die = enable_no_resp_die

        if not map:
            map = Map.loadfile(DEFAULT_MAP)
        self.set_map(map)
        self.start()
Ejemplo n.º 5
0
    def user_set_map(self, data):
        if self.status != WAITFORPLAYER:
            return "only can set map when the game state is waitforplayer"

        try:
            m = Map.loaddata(data)
            self.set_map(m)
            self.start()
            return 'ok'
        except Exception as e:
            # if error, fall back to default map
            self.set_map(Map.loadfile(DEFAULT_MAP))
            self.start()
            return 'setmap error: ', str(e)
Ejemplo n.º 6
0
    def user_set_map(self, data):
        if self.status != WAITFORPLAYER:
            return "only can set map when the game state is waitforplayer"

        try:
            m = Map.loaddata(data)
            self.set_map(m)
            self.start()
            return 'ok'
        except Exception as e:
            # if error, fall back to default map
            self.set_map(Map.loadfile(DEFAULT_MAP))
            self.start()
            return 'setmap error: ', str(e)