Exemplo n.º 1
0
 def __init__(self, site_type, population_type, save_manager=None):
     super().__init__(site_type, save_manager)
     self.town = agent.Town(
         name=name_object.Name("test town"),
         location=self.overworld,
         coordinates=(5, 6),
     )
     self.population = population_type(
         name=name_object.Name("test population"),
         location=self.overworld,
         coordinates=(5, 5),
         target=self.town,
     )
     # give time for the population to occupy the site
     # (and reveal bugs if they don't)
     self.schedule.run_game(2 * day)
Exemplo n.º 2
0
def make_player(location,
                coordinates,
                landmarks=(),
                use_web_output=False,
                postures=()):
    john = actor.Hero(location=location, name="john", coordinates=coordinates)
    for p in postures:
        john.learn_posture(p)
    my_parser = john.ai
    assert (isinstance(my_parser, parsing.Parser))
    my_parser.web_output = use_web_output
    john.view_location()
    john.known_landmarks = set(landmarks)
    # john.spells_known = {spells.Shock, spells.Fireball}
    john.spells_known = set()
    john.body.max_mana = 50
    john.body.mana = 50
    john.money = 20
    sword = game_object.Item(
        location=john,
        name=name_object.Name("iron sword"),
    )
    sword.damage_type = "sharp"
    sword.damage_mult = 6
    phrase.QuitPhrase(my_parser, ["quit"])
    phrase.InventoryPhrase(my_parser, ["i", "inventory"])
    return john
Exemplo n.º 3
0
    def __init__(self,
                 use_web_output=False,
                 save_manager=None,
                 site_type=sites.Cave):
        super().__init__(save_manager=save_manager)
        self.directions = [north, south, east, west, up, down]

        plains = Overworld(
            description="You stand in a grassy field",
            sched=self.schedule,
        )

        caves_portal = game_object.PortalEdge.free_portal(
            location=plains,
            direction=down,
            coordinates=(15, 14),
            name="slope",
        )
        cave_site = site_type(sched=self.schedule,
                              entrance_portal=caves_portal.target)
        cave_site.add_morph(sites.KoboldHabitation())
        cave_site.add_population(population.Kobold())
        # cave_site.add_morph(sites.GhoulHabitation())
        cave_site.update_region()
        caves_name = name_object.Name("kobold caves")
        caves_landmark = caves_portal.source.create_landmark(name=caves_name)

        town = location.Location(
            name="town", description="You are in a very placeholder-like town")
        town_portal = game_object.PortalEdge.free_portal(location=plains,
                                                         direction=north,
                                                         coordinates=(25, 10),
                                                         name="gate")
        town_portal.set_target_location(town)
        town_name = name_object.Name("big town")
        building.WeaponShop(town, sched=self.schedule)
        town_landmark = town_portal.source.create_landmark(name=town_name)
        landmarks = {caves_landmark, town_landmark}
        john = make_player(plains, (15, 15), landmarks, use_web_output)
        if self.save_manager:
            phrase.SpecialPhrase(callback=self.save,
                                 parser=john.ai,
                                 synonyms=["<<save>>"])
Exemplo n.º 4
0
    def __init__(self, source_location, *args, replaced_door=None, **kwargs):
        if "name" not in kwargs:
            kwargs["name"] = name_object.Name(self.default_name)
        super().__init__(*args, **kwargs)
        if replaced_door:
            replaced_door.end.name += "(whoops)"
            replaced_door.source.vanish()
            replaced_door.target.vanish()

        self.door = game_object.Door(source_location, self)
Exemplo n.º 5
0
 def __init__(self, site_type, save_manager=None):
     super().__init__(save_manager)
     self.overworld = Overworld(
         sched=self.schedule,
         width=10,
         height=10,
     )
     self.site = site_type.at_point(
         location=self.overworld,
         coordinates=(5, 5),
         direction=down,
         landmark_name=name_object.Name("test site"),
     )
Exemplo n.º 6
0
def make_string(syllables=None, name_maker=NameMaker(), raw_output=True):
    string = name_maker.create_word(syllables)
    if raw_output:
        return string
    else:
        return name_object.Name(string, proper=True)