Ejemplo n.º 1
0
def place_repair_shop_items(dm, room, level):
    _if = ItemFactory()
    for j in range(1,randrange(5)):
        _roll = randrange(10)
        if _roll < 8:
            _item = _if.get_stack('battery',5, True)
        elif _roll == 8:
            _item = _if.gen_item('infra-red goggles', True)
        else:
            _item = _if.gen_item('targeting wizard', True)
            
        _floor = choice(room)
        level.add_item_to_sqr(_floor[0], _floor[1], _item)
Ejemplo n.º 2
0
    def get_item(self, level):
        _chart = self.__pick_chart()            
        _pick = _chart[choice(_chart.keys())]
    
        _if = ItemFactory()
        if _pick[1] > 0:
            _item = _if.get_stack(_pick[0], _pick[1], True)
        else:
            _item = _if.gen_item(_pick[0], True)

        return _item
Ejemplo n.º 3
0
 def make_repair_shop(self, building):
     _doc = MonsterFactory.get_monster_by_name(self.dm, "repair bot", 0, 0)
     place_monster(building, self, _doc)
     
     for j in range(randrange(2)):
         _ed = MonsterFactory.get_monster_by_name(self.dm, "ed-209", 0, 0)
         place_monster(building, self, _ed)
     for j in range(randrange(1,4)):
         _sb = MonsterFactory.get_monster_by_name(self.dm, "security bot", 0, 0)
         place_monster(building, self, _sb)
     
     _if = ItemFactory()
     for j in range(randrange(1,4)):
         _roll = randrange(10)
         if _roll < 7:
             _item = _if.get_stack('battery', 3, True)
         elif _roll < 9:
             _item = _if.gen_item('targeting wizard')
         else:
             _item = _if.gen_item('icannon')
         place_item(building, self, _item)
Ejemplo n.º 4
0
def get_moreau_box():
    _if  = ItemFactory()
    _box = Items.Box('box')
    
    for j in range(randrange(1,4)):
        _roll = randrange(7)
        if _roll < 3:
            _box.add_item(_if.get_stack('stimpak', 4, True))
        elif _roll < 6:
            _box.add_item(_if.get_stack('shotgun shell', 10, True))
        else:
            _box.add_item(_if.gen_item('shotgun', True))
        
    return _box
Ejemplo n.º 5
0
def get_locker_for_minor_armoury():
    _if = ItemFactory()
    _box = Items.Box('footlocker')
    
    for j in range(randrange(4)):
        _roll = random()
        if _roll < 0.333:
            _box.add_item(_if.get_stack('shotgun shell', 8, True))
        elif _roll < 0.666:
            _box.add_item(_if.get_stack('grenade', 4, True))
        elif _roll < 0.9:
            _box.add_item(_if.get_stack('stimpak', 5, True))
        else:
            _box.add_item(_if.gen_item('shotgun', True))

    return _box
Ejemplo n.º 6
0
def place_science_lab_items(dm, room, level):
    _floor = choice(room)
    _if = ItemFactory()
    for j in range(1,randrange(5)):
        _roll = randrange(10)
        if _roll < 3:
            _item = _if.get_stack('stimpak',3, True)
        elif _roll < 6:
            _item = _if.get_stack('amphetamine',7, True)
        elif _roll < 9:
            _item = _if.get_stack('shotgun shell',10, True)
        else:
            _item = _if.gen_item('infra-red goggles', True)
            
        _floor = choice(room)
        level.add_item_to_sqr(_floor[0], _floor[1], _item)
Ejemplo n.º 7
0
 def __fighting_is_hard_lets_go_shopping(self):
     _if = ItemFactory()
     _cash = 150
     
     # This stuff the player gets for free
     self.__player.inventory.add_item(_if.gen_item('stylish leather jacket', 1), 1)
     self.__player.inventory.add_item(_if.gen_item('stylish sunglasses', 1), 1)
     self.__player.inventory.add_item(_if.gen_item('wristwatch', 1), 1)
     for j in range(randrange(12, 25)):
         self.__player.inventory.add_item(_if.gen_item('amphetamine', 1), 0)
         
     _menu = []
     _menu.append(('a', 'Shotgun - $50', ('shotgun', 50)))
     _menu.append(('b', 'P90 Assault Rifle - $80', ('p90 assault rifle', 80)))
     _menu.append(('c', 'M1911A1 - $75', ('m1911a1', 75)))
     _menu.append(('d', 'Shotgun Shells - $10/dozen', ('shell', 10)))
     _menu.append(('e', 'Machine Gun Clip - $15', ('machine gun clip', 15)))
     _menu.append(('f', '9mm Clip - $15', ('9mm clip', 15)))
     _menu.append(('g', 'Grenade - $17', ('grenade', 17)))
     _menu.append(('h', 'Truncheon - $15', ('truncheon', 15)))
     _menu.append(('i', 'Combat Knife - $10', ('combat knife', 10)))
     _menu.append(('j', 'Army Helmet - $25', ('army helmet', 25)))
     _menu.append(('k', 'Combat Boots - $25', ('combat boots', 25)))
     _menu.append(('l', 'High-Tech Sandals - $15', ('high-tech sandals', 15)))
     _menu.append(('m', 'C4 Charge - $10', ('C4 Charge', 10)))
     _menu.append(('n', 'Medkit - $10', ('medkit', 10)))
     _menu.append(('o', 'Lockpick - $10', ('lockpick', 10)))
     _menu.append(('p', 'Flare - $5', ('flare', 5)))
     _menu.append(('r', 'Flashlight - $10', ('flashlight', 10)))
     _menu.append(('s', 'Spare Battery - $5', ('battery', 5)))
     _menu.append(('q', 'Quit and begin your mission', 'quit'))
     
     while True:
         _header = ['You have $%d remaining.' % (_cash)]
         _choice = self.dui.ask_menued_question(_header, _menu)
         
         if _choice == '':
             continue 
             
         if _choice == 'quit':
             break
         
         if _cash < _choice[1]:
             self.dui.display_message(" You can't afford that!", True)
         else:
             _cash -= _choice[1]
             self.dui.clear_msg_line()
             
             if _choice[0] == 'shell':
                 for j in range(12):
                     self.__player.inventory.add_item(_if.gen_item('shotgun shell', 1), 0)
                 self.dui.display_message(" You buy some shotgun shells.", True)
             elif _choice[0] == 'flashlight':
                 _fl = _if.gen_item('flashlight', 1)
                 _fl.charge = _fl.maximum_charge # seemed mean not to
                 self.dui.display_message(" You buy a flashlight.", True)
                 self.__player.inventory.add_item(_fl, 0)
             elif _choice[0] in ('m1911a1', 'p90 assault rifle'):
                 _gun = _if.gen_item(_choice[0], 1)
                 _gun.current_ammo = 0
                 self.__player.inventory.add_item(_gun, 0)
                 _name = _gun.get_name(2)
                 self.dui.display_message(" You buy " + _name + ".", True)
             else:
                 _item = _if.gen_item(_choice[0], 1)
                 self.__player.inventory.add_item(_item, 0)
                 _name = _item.get_name(2)
                 self.dui.display_message(" You buy " + _name + ".", True) 
Ejemplo n.º 8
0
    def __set_standard_kit(self):
        _if = ItemFactory()

        self.__player.inventory.add_item(_if.gen_item('shotgun', 1), 0)

        for j in range(randrange(24, 37)):
            self.__player.inventory.add_item(_if.gen_item('shotgun shell',1), 1)

        self.__player.inventory.add_item(_if.gen_item('stylish leather jacket', 1), 1)
        self.__player.inventory.add_item(_if.gen_item('stylish sunglasses', 1), 1)
        self.__player.inventory.add_item(_if.gen_item('wristwatch', 1), 1)
        self.__player.inventory.add_item(_if.gen_item('high-tech sandals', 1), 1)
        self.__player.inventory.add_item(_if.gen_item('C4 Charge', 1), 0)
        self.__player.inventory.add_item(_if.gen_item('C4 Charge', 1), 0)
        self.__player.inventory.add_item(_if.gen_item('C4 Charge', 1), 0)

        self.__player.inventory.add_item(_if.gen_item('truncheon', 1), 1)

        for j in range(randrange(12, 25)):
            self.__player.inventory.add_item(_if.gen_item('amphetamine', 1), 0)

        self.__player.inventory.add_item(_if.gen_item('lockpick', 1), 0)
Ejemplo n.º 9
0
    def __generate_map(self):
        _map = []
        
        _if = ItemFactory()
        _tf = TerrainFactory()
        
        # make all border squares walls
        # This could be moved to a superclass
        row = []
        for j in range(0, self.lvl_width):
            row.append(_tf.get_terrain_tile(PERM_WALL))
        _map.append(row)

        for r in range(1, self.lvl_length-1):
            row = []
            row.append(_tf.get_terrain_tile(PERM_WALL))

            for c in range(1, self.lvl_width-1):
                rnd = random()
                
                if rnd < 0.50:
                    row.append(_tf.get_terrain_tile(ROAD))
                elif rnd < 0.90:
                    row.append(_tf.get_terrain_tile(GRASS))
                else:
                    row.append(_tf.get_terrain_tile(TREE))
            row.append(_tf.get_terrain_tile(PERM_WALL))
            _map.append(row)
        row = []
        for j in range(0, self.lvl_width):
            row.append(_tf.get_terrain_tile(PERM_WALL))
        _map.append(row)
        
        # generate the tower section
        _tower = TowerFactory(length = 20, width = 30, top = True, bottom = False)
        _tower.gen_map()
        self.upStairs = None
        self.downStairs = _tower.downStairs
        
        for r in range(0, 20):
            for c in range(0, 30):
                _row = 10 + r
                _col = self.lvl_width- 31 + c
                _map[_row][_col] = _tower.get_cell(r,c)
                if _map[_row][_col].get_type() == DOOR and random() > 0.6:
                    _map[_row][_col].broken = True
                    _map[_row][_col].open()
                
        # beat up the tower a bit
        for x in range(randrange(100, 200)):
            r = 10 + randrange(0,20)
            c = self.lvl_width - 31 + randrange(0, 30)
            if _map[r][c].get_type() != DOWN_STAIRS:
                if random() < 0.75:
                    _map[r][c] = _tf.get_terrain_tile(ROAD)
                else:
                    _map[r][c] = _tf.get_terrain_tile(GRASS)

        # Add double door main entrance
        for r in range(15,25):
            if _map[r][self.lvl_width-30].get_type() == FLOOR and _map[r+1][self.lvl_width-30].get_type() == FLOOR:
                break
        _map[r][self.lvl_width-31] = _tf.get_terrain_tile(DOOR)
        _map[r+1][self.lvl_width-31] = _tf.get_terrain_tile(DOOR)

        for c in range(0, 30):
            _map[29][self.lvl_width-31+c] = _tf.get_terrain_tile(WALL)

        _box = Items.Box()
        _box_placed = False
        while not _box_placed:
            _col = randrange(self.lvl_width-30, self.lvl_width)
            _row = randrange(self.lvl_length-20, self.lvl_length)
            if _map[_row][_col].get_type() not in (DOOR, WALL, PERM_WALL, DOWN_STAIRS):
                self.add_item_to_sqr(_row, _col, _box)
                _box_placed = True

        for x in range(randrange(7)):
            _box.add_item(_if.gen_item('ritalin', 1))
        for x in range(randrange(19)):
            _box.add_item(_if.gen_item('shotgun shell', 1))
        for x in range(randrange(4)):
            _box.add_item(_if.gen_item('flare', 1))
        if randrange(4) > 2:
            _box.add_item(_if.gen_item('medkit', 1))
            
        return _map