-
Notifications
You must be signed in to change notification settings - Fork 18
/
script-poemgame.rpy
513 lines (460 loc) · 15 KB
/
script-poemgame.rpy
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
image m_sticker smile:
"gui/poemgame/m_sticker_2.png"
xoffset monikaOffset xzoom monikaZoom
#sticker_hop
pause 0.5
xoffset 0 xzoom 1
"m_sticker"
image s_sticker smile:
"gui/poemgame/s_sticker_2.png"
xoffset sayoriOffset xzoom sayoriZoom
pause 0.5
#sticker_hop
xoffset 0 xzoom 1
"s_sticker"
image y_sticker smile:
"gui/poemgame/y_sticker_2.png"
xoffset yuriOffset xzoom yuriZoom
#sticker_hop
pause 0.5
xoffset 0 xzoom 1
"y_sticker"
image n_sticker smile:
"gui/poemgame/n_sticker_2.png"
xoffset natsukiOffset xzoom natsukiZoom
pause 0.5
xoffset 0 xzoom 1
"n_sticker"
init python:
import random
display_words = [] #This is new, make sure to add this!
# This class holds a word, and point values for each of the four heroines
class PoemWord:
def __init__(self, word, sPoint, nPoint, yPoint, mPoint, glitch=False):
self.word = word
self.sPoint = sPoint
self.nPoint = nPoint
self.yPoint = yPoint
self.mPoint = mPoint
self.glitch = glitch
# Static variables for characters' poem appeal: Disklike, Neutral, Like
POEM_DISLIKE_THRESHOLD = 29
POEM_LIKE_THRESHOLD = 45
# Building the word list
DDLCVN_DDLCVN_full_wordlist = []
with renpy.file('mod_assets/poem-game_words.txt') as wordfile:
for line in wordfile:
# Ignore lines beginning with '#' and empty lines
line = line.strip()
if line == '' or line[0] == '#': continue
# File format: word,sPoint,nPoint,yPoint,mPoint
x = line.split(',')
DDLCVN_DDLCVN_full_wordlist.append(PoemWord(x[0], float(x[1]), float(x[2]), float(x[3]), float(x[4])))
def draw_words(new=True):
ystart = 160
pstring = str(progress)
ui.text(pstring + "/" + str(numWords), style="poemgame_text", xpos=810, ypos=80, color='#000')
z = 0
if new:
store.display_words = []
for j in range(2):
if j == 0: x = 440
else: x = 680
ui.vbox()
for i in range(5):
if new:
word = random.choice(wordlist)
wordlist.remove(word)
store.display_words.append(word)
else:
word = store.display_words[z]
ui.textbutton(word.word, clicked=ui.returns([word,True]), hovered=ui.returns([word,False]), text_style="poemgame_text", xpos=x, ypos=i * 56 + ystart)
z += 1
ui.close()
#This function shows the dokis
def show_doki(t,action = "hop"):
if t.sPoint >= 3:
renpy.show("s_sticker " + action)
if t.nPoint >= 3:
renpy.show("n_sticker " + action)
if t.yPoint >= 3:
renpy.show("y_sticker " + action)
if t.mPoint >= 3:
renpy.show("m_sticker " + action)
#This function does the poem loop
def poem_loop():
draw_words()
while True:
selected = ui.interact()
word = selected[0]
clicked = selected[1]
if clicked:
action = "hop"
select_doki(word)
else:
action = "smile"
show_doki(word, action)
if progress > numWords:
break
else:
draw_words(clicked)
#This function selects the doki and the correct word and saves the score change
def select_doki(t):
renpy.play(gui.activate_sound)
store.sPointTotal += t.sPoint
store.nPointTotal += t.nPoint
store.yPointTotal += t.yPoint
store.mPointTotal += t.mPoint
store.progress += 1
sayoriTime = renpy.random.random() * 4 + 4
natsukiTime = renpy.random.random() * 4 + 4
yuriTime = renpy.random.random() * 4 + 4
monikaTime = renpy.random.random() * 4 + 4
sayoriPos = 0
natsukiPos = 0
yuriPos = 0
monikaPos = 0
sayoriOffset = 0
natsukiOffset = 0
yuriOffset = 0
monikaOffset = 0
sayoriZoom = 1
natsukiZoom = 1
yuriZoom = 1
monikaZoom = 1
def randomPauseSayori(trans, st, at):
if st > sayoriTime:
global sayoriTime
sayoriTime = renpy.random.random() * 4 + 4
return None
return 0
def randomPauseNatsuki(trans, st, at):
if st > natsukiTime:
global natsukiTime
natsukiTime = renpy.random.random() * 4 + 4
return None
return 0
def randomPauseYuri(trans, st, at):
if st > yuriTime:
global yuriTime
yuriTime = renpy.random.random() * 4 + 4
return None
return 0
def randomPauseMonika(trans, st, at):
if st > monikaTime:
global monikaTime
monikaTime = renpy.random.random() * 4 + 4
return None
return 0
def randomMoveSayori(trans, st, at):
global sayoriPos
global sayoriOffset
global sayoriZoom
if st > .16:
if sayoriPos > 0:
sayoriPos = renpy.random.randint(-1,0)
elif sayoriPos < 0:
sayoriPos = renpy.random.randint(0,1)
else:
sayoriPos = renpy.random.randint(-1,1)
if trans.xoffset * sayoriPos > 5: sayoriPos *= -1
return None
if sayoriPos > 0:
trans.xzoom = -1
elif sayoriPos < 0:
trans.xzoom = 1
trans.xoffset += .16 * 10 * sayoriPos
sayoriOffset = trans.xoffset
sayoriZoom = trans.xzoom
return 0
def randomMoveNatsuki(trans, st, at):
global natsukiPos
global natsukiOffset
global natsukiZoom
if st > .16:
if natsukiPos > 0:
natsukiPos = renpy.random.randint(-1,0)
elif natsukiPos < 0:
natsukiPos = renpy.random.randint(0,1)
else:
natsukiPos = renpy.random.randint(-1,1)
if trans.xoffset * natsukiPos > 5: natsukiPos *= -1
return None
if natsukiPos > 0:
trans.xzoom = -1
elif natsukiPos < 0:
trans.xzoom = 1
trans.xoffset += .16 * 10 * natsukiPos
natsukiOffset = trans.xoffset
natsukiZoom = trans.xzoom
return 0
def randomMoveYuri(trans, st, at):
global yuriPos
global yuriOffset
global yuriZoom
if st > .16:
if yuriPos > 0:
yuriPos = renpy.random.randint(-1,0)
elif yuriPos < 0:
yuriPos = renpy.random.randint(0,1)
else:
yuriPos = renpy.random.randint(-1,1)
if trans.xoffset * yuriPos > 5: yuriPos *= -1
return None
if yuriPos > 0:
trans.xzoom = -1
elif yuriPos < 0:
trans.xzoom = 1
trans.xoffset += .16 * 10 * yuriPos
yuriOffset = trans.xoffset
yuriZoom = trans.xzoom
return 0
def randomMoveMonika(trans, st, at):
global monikaPos
global monikaOffset
global monikaZoom
if st > .16:
if monikaPos > 0:
monikaPos = renpy.random.randint(-1,0)
elif monikaPos < 0:
monikaPos = renpy.random.randint(0,1)
else:
monikaPos = renpy.random.randint(-1,1)
if trans.xoffset * monikaPos > 5: monikaPos *= -1
return None
if monikaPos > 0:
trans.xzoom = -1
elif monikaPos < 0:
trans.xzoom = 1
trans.xoffset += .16 * 10 * monikaPos
monikaOffset = trans.xoffset
monikaZoom = trans.xzoom
return 0
label poem(transition=True):
stop music fadeout 2.0
scene bg notebook
show screen quick_menu
show s_sticker at sticker_left
show n_sticker at sticker_mid
show y_sticker at sticker_right
show m_sticker at sticker_m_glitch
if transition:
with dissolve_scene_full
if persistent.playthrough == 3:
play music ghostmenu
else:
play music t4
$ config.skipping = False
$ config.allow_skipping = False
$ allow_skipping = False
if persistent.playthrough == 0 and chapter == 0:
call screen dialog("It's time to write a poem!\n\nPick words you think your favorite club member\nwill like. Something good might happen with\nwhoever likes your poem the most!", ok_action=Return())
python:
poemgame_glitch = False
played_baa = False
progress = 1
numWords = 20
sPointTotal = 0
nPointTotal = 0
yPointTotal = 0
mPointTotal = 0
wordlist = list(DDLCVN_DDLCVN_full_wordlist)
sayoriTime = renpy.random.random() * 4 + 4
natsukiTime = renpy.random.random() * 4 + 4
yuriTime = renpy.random.random() * 4 + 4
monikaTime = renpy.random.random() * 4 + 4
sayoriPos = renpy.random.randint(-1,1)
natsukiPos = renpy.random.randint(-1,1)
yuriPos = renpy.random.randint(-1,1)
monikaPos = renpy.random.randint(-1,1)
sayoriOffset = 0
natsukiOffset = 0
yuriOffset = 0
monikaOffset = 0
sayoriZoom = 1
natsukiZoom = 1
yuriZoom = 1
monikaOffset = 1
poem_loop()
if persistent.playthrough == 0:
# For chapter 1, add 5 points to whomever we sided with
if chapter == 1:
exec(ch1_choice[0] + "PointTotal += 5")
# Logic for taking point totals and assigning poem appeal, scene order, etc.
unsorted_pointlist = {"sayori": sPointTotal, "natsuki": nPointTotal, "yuri": yPointTotal, "monika": mPointTotal}
pointlist = sorted(unsorted_pointlist, key=unsorted_pointlist.get)
# Set poemwinner to the highest scorer
poemwinner[chapter] = pointlist[3]
else:
if nPointTotal > yPointTotal: poemwinner[chapter] = "natsuki"
else: poemwinner[chapter] = "yuri"
# Add appeal point based on poem winner
exec(poemwinner[chapter][0] + "_appeal += 1")
# Set poemappeal
if sPointTotal < POEM_DISLIKE_THRESHOLD: s_poemappeal[chapter] = -1
elif sPointTotal > POEM_LIKE_THRESHOLD: s_poemappeal[chapter] = 1
if nPointTotal < POEM_DISLIKE_THRESHOLD: n_poemappeal[chapter] = -1
elif nPointTotal > POEM_LIKE_THRESHOLD: n_poemappeal[chapter] = 1
if yPointTotal < POEM_DISLIKE_THRESHOLD: y_poemappeal[chapter] = -1
elif yPointTotal > POEM_LIKE_THRESHOLD: y_poemappeal[chapter] = 1
if mPointTotal < POEM_DISLIKE_THRESHOLD: m_poemappeal[chapter] = -1
elif mPointTotal > POEM_LIKE_THRESHOLD: m_poemappeal[chapter] = 1
# Poem winner always has appeal 1 (loves poem)
exec(poemwinner[chapter][0] + "_poemappeal[chapter] = 1")
if persistent.playthrough == 2 and persistent.seen_eyes == None and renpy.random.randint(0,5) == 0:
$ seen_eyes_this_chapter = True
$ quick_menu = False
play sound "sfx/eyes.ogg"
$ persistent.seen_eyes = True
stop music
scene black with None
show bg eyes_move
pause 1.2
hide bg eyes_move
show bg eyes
pause 0.5
hide bg eyes
show bg eyes_move
pause 1.25
hide bg eyes with None
$ quick_menu = True
$ config.allow_skipping = True
$ allow_skipping = True
stop music fadeout 2.0
hide screen quick_menu
show black as fadeout:
alpha 0
linear 1.0 alpha 1.0
pause 1.0
return
image bg eyes_move:
"images/bg/eyes.png"
parallel:
yoffset 720 ytile 2
linear 0.5 yoffset 0
repeat
parallel:
0.1
choice:
xoffset 20
0.05
xoffset 0
choice:
xoffset 0
repeat
image bg eyes:
"images/bg/eyes.png"
image s_sticker:
"gui/poemgame/s_sticker_1.png"
xoffset sayoriOffset xzoom sayoriZoom
block:
function randomPauseSayori
parallel:
sticker_move_n
parallel:
function randomMoveSayori
repeat
image n_sticker:
"gui/poemgame/n_sticker_1.png"
xoffset natsukiOffset xzoom natsukiZoom
block:
function randomPauseNatsuki
parallel:
sticker_move_n
parallel:
function randomMoveNatsuki
repeat
image y_sticker:
"gui/poemgame/y_sticker_1.png"
xoffset yuriOffset xzoom yuriZoom
block:
function randomPauseYuri
parallel:
sticker_move_n
parallel:
function randomMoveYuri
repeat
image y_sticker_cut:
"gui/poemgame/y_sticker_cut_1.png"
xoffset yuriOffset xzoom yuriZoom
block:
function randomPauseYuri
parallel:
sticker_move_n
parallel:
function randomMoveYuri
repeat
image m_sticker:
"gui/poemgame/m_sticker_1.png"
xoffset monikaOffset xzoom monikaZoom
block:
function randomPauseMonika
parallel:
sticker_move_n
parallel:
function randomMoveMonika
repeat
image s_sticker hop:
"gui/poemgame/s_sticker_2.png"
xoffset sayoriOffset xzoom sayoriZoom
sticker_hop
xoffset 0 xzoom 1
"s_sticker"
image n_sticker hop:
"gui/poemgame/n_sticker_2.png"
xoffset natsukiOffset xzoom natsukiZoom
sticker_hop
xoffset 0 xzoom 1
"n_sticker"
image y_sticker hop:
"gui/poemgame/y_sticker_2.png"
xoffset yuriOffset xzoom yuriZoom
sticker_hop
xoffset 0 xzoom 1
"y_sticker"
image y_sticker_cut hop:
"gui/poemgame/y_sticker_cut_2.png"
xoffset yuriOffset xzoom yuriZoom
sticker_hop
xoffset 0 xzoom 1
"y_sticker_cut"
image y_sticker hopg:
"gui/poemgame/y_sticker_2g.png"
xoffset yuriOffset xzoom yuriZoom
sticker_hop
xoffset 0 xzoom 1
"y_sticker"
image m_sticker hop:
"gui/poemgame/m_sticker_2.png"
xoffset monikaOffset xzoom monikaZoom
sticker_hop
xoffset 0 xzoom 1
"m_sticker"
image y_sticker glitch:
"gui/poemgame/y_sticker_1_broken.png"
xoffset yuriOffset xzoom yuriZoom zoom 3.0
block:
function randomPauseYuri
parallel:
sticker_move_n
parallel:
function randomMoveYuri
repeat
transform sticker_left:
xcenter 100 yalign 0.9 subpixel True
transform sticker_mid:
xcenter 220 yalign 0.9 subpixel True
transform sticker_right:
xcenter 340 yalign 0.9 subpixel True
transform sticker_glitch:
xcenter 50 yalign 1.8 subpixel True
transform sticker_m_glitch:
xcenter 32 yalign 0.9 subpixel True
transform sticker_move_n:
easein_quad .08 yoffset -15
easeout_quad .08 yoffset 0
transform sticker_hop:
easein_quad .18 yoffset -80
easeout_quad .18 yoffset 0
easein_quad .18 yoffset -80
easeout_quad .18 yoffset 0