-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenvironment.py
More file actions
40 lines (32 loc) · 1.28 KB
/
environment.py
File metadata and controls
40 lines (32 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import location
import schedule
import actor
import game_object
import direction as direc
import spells
import phrase
class Test:
def __init__(self):
self.schedule = schedule.Schedule()
self.street = location.Location(name="street",
description="You are outside.")
self.hero = actor.Hero(self.street, name="john", sched=self.schedule)
self.parser = self.hero.ai
self.hero.spells_known = {spells.Shock, spells.Fireball}
phrase.QuitPhrase(self.parser, ["quit", "exit"])
phrase.InventoryPhrase(self.parser, ["i", "inventory"])
def run(self):
self.schedule.run_game()
class Building(Test):
def __init__(self):
super().__init__()
self.house = location.Location(name="shop", description="You are inside.")
self.portal = game_object.Door(self.street, self.house)
# self.portal = thing.PortalEdge(locations=(self.street, self.house),
# directions=(direc.s, direc.n), )
class Town(Test):
def __init__(self):
super().__init__()
desc = "You are inside the guardhouse."
self.guardhouse = location.Location(description=desc)
self.portal = game_object.Door(self.street, self.guardhouse)