-
Notifications
You must be signed in to change notification settings - Fork 0
/
room_apartment.py
191 lines (180 loc) · 6.69 KB
/
room_apartment.py
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
import Game
import random
from untitled_const import NAV_LIT_MIDDLE_A
from untitled_const import NAV_MIDDLE_RADIUS
def Start(game:Game.Game):
#Resetting the NAV data module.
navdata:Game.Navdata = game.Navdata
#Getting quick-translate
T = Game.Gettexter(game)
#Arrow inputs are not used here
navdata.closed = True
#Setting name, dot-radius and dot-radianrotation
navdata.AreaName = T("AREANAME_APARTMENT")
navdata.MapRadius = NAV_MIDDLE_RADIUS
navdata.MapRadians = 3.8 #where Tau (6.28) is a full rotation.
def newgame():
navdata.AreaName = T("AREANAME_UNKNOWN")
#region NEW GAME
game.place = "apartment"
game.setInventory("HEADACHE", True)
game.rolltext("{APT_DREAM}")
nameExcuses = T("APT_NAME_EXCUSES").split("\n")
inp = game.PlayerName
while True:
#ask for text input, name, wait for response, get the data. We assume type is textin.
indata = game.textin((("Name", inp),), T("APT_NAME_SUBMIT"), True)[1]
#from indata get first element, then get the text inputted
inp = indata[0][1]
if len(inp) < 1:
#if no input, re-request input
continue
game.setdata("name", inp)
if game.yesno("{APT_NAME_CONFIRM}"):
break
game.showtext(random.choice(nameExcuses))
navdata.AreaName = T("AREANAME_APARTMENT")
game.rolltext("{APT_NAME_CONFIRMED}")
#endregion NEW GAME
def sink():
#region Sink()
if(game.getdata("apartment:sink")):
game.showtext("{APT_SINK_2}")
else:
game.setdata("apartment:sink", True)
game.rolltext("{APT_SINK_1}")
#endregion Sink
def window():
#region window()
if game.getdata("apartment:window"):
game.rolltext("{APT_WINDOW_2}")
else:
game.setdata("apartment:window", True)
game.rolltext("{APT_WINDOW_1}")
#endregion window()
def table():
frags = {}
#region table()
def glassText():
g = game.getdata("apartment:glass")
if g == None or g == 2:
return "{APT_GLASS_FRAG_1}"
elif g == 1:
return "{APT_GLASS_FRAG_2}"
else:
return "{APT_GLASS_FRAG_3}"
#end of glass description
def pillsText():
if(game.getdata("apartment:pills")):
return ""
else:
return "{APT_PILLS_FRAG}"
#end of pills description
frags["_GLASS"] = glassText()
frags["_PILLS"] = pillsText()
game.rolltext("{APT_TABLE}", frags = frags)
choices = (("GLASS", T("APT_TABLE_OPTION_GLASS")),("CYAN", T("APT_TABLE_OPTION_CYAN")),("GOLD", T("APT_TABLE_OPTION_GOLD")),("BACK", T("APT_TABLE_OPTION_BACK")),)
data:Game.ActDataInput = game.choose(choices, T("APT_TABLE_QUEST"), True)
if data.tag == "GLASS":
g = game.getdata("apartment:glass")
if g == None or g == 2:
game.setdata("apartment:glass", 2)
game.showtext ("{APT_GLASS_EX_1}")
if(game.yesno("{APT_GLASS_QUEST_1}")):
game.showtext("{APT_GLASS_TAKE_1}")
game.setdata("apartment:pills", True)
game.setdata("apartment:glass", 1)
game.setInventory("HEADACHE", False)
else:
game.showtext("{APT_GLASS_NOTAKE_1}")
elif g == 1:
game.showtext ("{APT_GLASS_EX_2}")
if(game.yesno("{APT_GLASS_QUEST_2}")):
game.showtext("{APT_GLASS_TAKE_2}")
game.setdata("apartment:glass", 0)
else:
game.showtext("{APT_GLASS_NOTAKE_2}")
else:
game.showtext("{APT_GLASS_EX_3}")
elif data.tag == "CYAN":
m = game.getdata("malefam", None)
f = game.getdata("femalefam", None)
if m == None:
game.rolltext("{APT_CYAN_1}")
indata = game.textin((("name:", "Jeff"),), "{APT_CYAN_SUBMIT}", True)[1]
mName = indata[0][1]
if f:
mRole = "sibling"
else:
mRole = "spouse"
game.setMaleFam(mRole, mName)
game.showtext("{APT_CYAN_2}")
else:
game.showtext("{APT_CYAN_3}")
elif data.tag == "GOLD":
m = game.getdata("malefam", None)
f = game.getdata("femalefam", None)
if f == None:
game.rolltext("{APT_GOLD_1}")
indata = game.textin((("name:", "Klara"),), "{APT_GOLD_SUBMIT}", True)[1]
fName = indata[0][1]
if m:
fRole = "sibling"
else:
fRole = "spouse"
game.setFemaleFam(fRole, fName)
game.showtext("{APT_GOLD_2}")
else:
game.showtext("{APT_GOLD_3}")
else:
return
table() #repeat
#endregion table()
def door():
ache = game.getInventory("HEADACHE")
left = game.getdata("apartment:left", False)
#region door()
if left:
return True
elif ache:
game.rolltext("{APT_DOOR_1}")
return False
else:
game.rolltext("{APT_DOOR_2}")
return True
#endregion door()
if(game.getdata("name") == None):
newgame()
choices = (
("WINDOW", T("APT_OPTION_WINDOW")),
("TABLE", T("APT_OPTION_TABLE")),
("SINK", T("APT_OPTION_SINK")),
("DOOR", T("APT_OPTION_DOOR")),
)
end = False
while not end:
game.showtext("{APT_BED}")
game.choose(choices, "{APT_BED_QUEST}")
data = game.wait()
if data.Type != "action":
continue
choice = data.tag
if choice == "WINDOW":
window()
elif choice == "TABLE":
table()
elif choice == "SINK":
sink()
elif choice == "DOOR":
if(door()):
game.place = "middle"
return
#if room is revisited after the reactor counter has been enabled,
#you will be wasting time here.
status = game.updateCounter("reactorC", -1)
if status == "death":
end = True
if __name__ == "__main__":
#testers, feel free to enter your testcode here.
#if your only change is in this code-block, feel free to commit.
print("Testcode is not written yet.\nPlease run from main.py instead.")