Ejemplo n.º 1
0
 def custom_init(self, nart):
     scene = self.elements.get("LOCALE")
     mygen = nart.get_map_generator(scene)
     room = mygen.DEFAULT_ROOM()
     myhabitat = scene.get_encounter_request()
     myhabitat[context.MTY_HUMANOID] = context.PRESENT
     myhabitat[context.MTY_FIGHTER] = context.MAYBE
     room.contents.append(
         teams.Team(default_reaction=-999,
                    rank=self.rank + 1,
                    strength=100,
                    habitat=myhabitat,
                    fac=self.elements.get("ANTAGONIST")))
     room.contents.append(maps.WALL_WEAPON_RACK)
     room.contents.append(maps.WALL_WEAPON_RACK)
     for t in range(random.randint(2, 4)):
         mychest = waypoints.MediumChest()
         mychest.stock(self.rank)
         weapon = None
         weapon = items.choose_item(random.choice(items.WEAPON_TYPES),
                                    self.rank)
         if weapon:
             items.make_item_magic(weapon, self.rank + 1)
             weapon.identified = False
             mychest.contents.append(weapon)
         room.contents.append(mychest)
     self.register_element("_ROOM", room, dident="LOCALE")
     return True
Ejemplo n.º 2
0
 def generate_item(self, itype, rank, magic_chance):
     it = None
     tries = 0
     while (tries < 10) and not it:
         it = items.choose_item(itype, rank)
         if it and it.min_rank() < rank and random.randint(1, 100) <= magic_chance:
             items.make_item_magic(it, rank)
         if any(str(i) == str(it) for i in self.wares):
             it = None
         tries += 1
     return it
Ejemplo n.º 3
0
 def generate_item( self, itype, rank, magic_chance ):
     ''' Generates items, where there is a small possibility of generating a magic item '''
     it = None
     tries = 0
     while ( tries < 10 ) and not it:
         it = items.choose_item( itype, rank )
         if it and it.min_rank() < rank and random.randint(1,100)<=magic_chance:
             items.make_item_magic( it, rank )
         if any( str( i ) == str( it ) for i in self.wares ):
             it = None
         tries += 1
     return it
Ejemplo n.º 4
0
 def generate_item(self, itype, rank, magic_chance):
     it = None
     tries = 0
     while (tries < 10) and not it:
         it = items.choose_item(itype, rank)
         if it and it.min_rank() < rank and random.randint(
                 1, 100) <= magic_chance:
             items.make_item_magic(it, rank)
         if any(str(i) == str(it) for i in self.wares):
             it = None
         tries += 1
     return it
Ejemplo n.º 5
0
 def custom_init( self, nart ):
     scene = self.elements.get("LOCALE")
     mygen = nart.get_map_generator( scene )
     room = mygen.DEFAULT_ROOM()
     room.contents.append( teams.Team(default_reaction=-999, rank=self.rank, 
       strength=150, habitat=scene.get_encounter_request() ) )
     room.contents.append( maps.WALL_WEAPON_RACK )
     room.contents.append( maps.WALL_WEAPON_RACK )
     for t in range( random.randint(2,4) ):
         mychest = waypoints.MediumChest()
         mychest.stock(self.rank)
         weapon = items.choose_item( random.choice( items.WEAPON_TYPES ), self.rank )
         items.make_item_magic( weapon, self.rank + 2 )
         weapon.identified = False
         mychest.contents.append( weapon )
         room.contents.append( mychest )
     self.register_element( "_ROOM", room, dident="LOCALE" )
     return True
Ejemplo n.º 6
0
    def custom_init(self, nart):
        scene = self.elements.get("LOCALE")
        mygen = nart.get_map_generator(scene)

        # Bridge room
        bridge_room = randmaps.rooms.FuzzyRoom()
        mygen.special_c["bridge"] = bridge_room
        self.register_element("_BRIDGE_ROOM", bridge_room, dident="LOCALE")

        myhabitat = scene.get_encounter_request()
        myhabitat[context.MTY_HUMANOID] = context.PRESENT
        myhabitat[context.MTY_FIGHTER] = context.MAYBE
        team = self.register_element(
            "TEAM",
            teams.Team(default_reaction=-999,
                       rank=self.rank,
                       strength=200,
                       habitat=myhabitat,
                       respawn=False))

        myhabitat[(context.MTY_HUMANOID, context.MTY_LEADER)] = True
        myhabitat[context.MTY_LEADER] = context.MAYBE
        btype = monsters.choose_monster_type(self.rank, self.rank + 2,
                                             myhabitat)
        if btype:
            boss = monsters.generate_boss(btype, self.rank + 2)
            boss.team = team
            team.boss = boss

        # Give the boss a magic weapon.
        weapon = items.choose_item(random.choice(items.WEAPON_TYPES),
                                   self.rank)
        if weapon:
            items.make_item_magic(weapon, self.rank)
            weapon.identified = True
            boss.contents.append(weapon)

        bridge_room.contents.append(team)
        bridge_room.contents.append(boss)

        self._ready = True

        return btype
Ejemplo n.º 7
0
 def custom_init( self, nart ):
     scene = self.elements.get("LOCALE")
     mygen = nart.get_map_generator( scene )
     room = mygen.DEFAULT_ROOM()
     myhabitat=scene.get_encounter_request()
     myhabitat[ context.MTY_HUMANOID ] = context.PRESENT
     myhabitat[ context.MTY_FIGHTER ] = context.MAYBE
     room.contents.append( teams.Team(default_reaction=-999, rank=self.rank+1, 
       strength=100, habitat=myhabitat, fac=self.elements.get("ANTAGONIST")))
     room.contents.append( maps.WALL_WEAPON_RACK )
     room.contents.append( maps.WALL_WEAPON_RACK )
     for t in range( random.randint(2,4) ):
         mychest = waypoints.MediumChest()
         mychest.stock(self.rank)
         weapon = None
         weapon = items.choose_item( random.choice( items.WEAPON_TYPES ), self.rank )
         if weapon:
             items.make_item_magic( weapon, self.rank + 1 )
             weapon.identified = False
             mychest.contents.append( weapon )
         room.contents.append( mychest )
     self.register_element( "_ROOM", room, dident="LOCALE" )
     return True
Ejemplo n.º 8
0
    def custom_init( self, nart ):
        scene = self.elements.get("LOCALE")
        mygen = nart.get_map_generator( scene )

        # Bridge room
        bridge_room = randmaps.rooms.FuzzyRoom()
        mygen.special_c[ "bridge" ] = bridge_room
        self.register_element( "_BRIDGE_ROOM", bridge_room, dident="LOCALE" )

        myhabitat=scene.get_encounter_request()
        myhabitat[ context.MTY_HUMANOID ] = context.PRESENT
        myhabitat[ context.MTY_FIGHTER ] = context.MAYBE
        team = self.register_element("TEAM",teams.Team(default_reaction=-999,
         rank=self.rank, strength=200, habitat=myhabitat, respawn=False ))

        myhabitat[(context.MTY_HUMANOID,context.MTY_LEADER)] = True
        myhabitat[context.MTY_LEADER] = context.MAYBE
        btype = monsters.choose_monster_type(self.rank,self.rank+2,myhabitat)
        if btype:
            boss = monsters.generate_boss( btype, self.rank+2 )
            boss.team = team
            team.boss = boss

        # Give the boss a magic weapon.
        weapon = items.choose_item( random.choice( items.WEAPON_TYPES ), self.rank )
        if weapon:
            items.make_item_magic( weapon, self.rank )
            weapon.identified = True
            boss.contents.append( weapon )

        bridge_room.contents.append( team )
        bridge_room.contents.append( boss )

        self._ready = True

        return btype