Esempio n. 1
0
 def breed_random_node(self):
     try:
         node = dungeonrooms.choice(self.unbred_nodes)
     except IndexError:
         pass
     else:
         self.unbred_nodes.remove(node)
         node.breed()
Esempio n. 2
0
 def create_inhabitants(self):
     # assert len(self.enemy_adjectives) >= self.enemy_number
     shuffle(self.enemy_adjectives)
     for i in range(self.enemy_number):
         while True:
             node = dungeonrooms.choice(self.node_list)
             if not isinstance(node.location, dungeonrooms.Entrance):
                 break
         loc = node.location
         # adjective = self.enemy_adjectives[i]
         inhabitant = self.make_enemy(loc)
         self.inhabitants.add(inhabitant)
Esempio n. 3
0
 def __next__(self):
     if self.lst:
         return dungeonrooms.choice(self.lst)
     else:
         raise StopIteration
Esempio n. 4
0
 def path_to_random(self, start):
     goal = dungeonrooms.choice(self.node_list)
     return self.path_to_goal(start, goal)
Esempio n. 5
0
 """
 plt.scatter(*zip(*coords),color="blue", s=750, marker="s")
 plt.scatter(*zip(*vert_cons),color="blue",marker="|",s=500)
 plt.scatter(*zip(*hori_cons),color="blue",marker="_",s=500)
 plt.gca().set_aspect('equal', adjustable='box')
 plt.show()
 """
 # debug([node.vector.coords for node in reg.node_list])
 # debug([con.direction.letter for con in reg.connection_list])
 vertices = reg.get_vertices()
 # debug([node.vector.coords for node in vertices])
 start_location = reg.node_with_type(dungeonrooms.CaveEntrance).location
 monsters = []
 for st in ["skinny", "tall", "hairy", "filthy", "pale", "short"]:
     while True:
         node = dungeonrooms.choice(reg.node_list)
         if not isinstance(node.location, dungeonrooms.CaveEntrance):
             break
     loc = node.location
     name = dungeonrooms.Name(st) + "kobold"
     zom = actor.SquadActor(
         loc,
         name=name,
         sched=my_schedule,
     )
     monsters.append(zom)
 debug(reg.get_text_map())
 john = actor.Hero(start_location, name="john", sched=my_schedule)
 john.change_location(start_location)
 john.view_location()
 # TODO: Can't add this assert (to pass type check) because of