-
Notifications
You must be signed in to change notification settings - Fork 0
/
encounter_temp.py
414 lines (341 loc) · 14.6 KB
/
encounter_temp.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
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
from underpython import *
import os
import random
player = Player('Frisk', 20, 5, 20, 1)
flowery_ani = Animations((640, 240), 4, tpf=5)
flowery_ani.add_animation('idle',
['monsters.flowery.idle.%d' % i for i in [1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1]])
flowery_ani.add_animation('hurt',
['monsters.flowery.idle.1' for i in range(4)], nxt='idle')
flowery_ani.change_animation('idle')
flowery = Monster(flowery_ani, 'flowery', 400, 14, 8,
['hopes', 'dreams'])
@flowery.events
def on_act(name: str) -> list[str] | None:
if name == 'check':
return ['Flowery, 15 at 15 df.[endl]The loast princess.']
elif name == 'hopes':
player.df += 2
return ['You thought about why you\'re [nxtl]here, ', 'Defense greatly increased!!']
elif name == 'dreams':
player.heal(20)
return ['You closed your eyes, ', 'Thinking about what you [nxtl]are looking for', 'HP fully recovered!']
monsters = [flowery]
class Fb(Attack):
def u_ani(self):
self.set_img(GAME.graphics['pj.attack.fb.idle.%d' % (self.tick // 2 % 2 + 1)])
class FbRise(Fb):
def on_action(self):
if self.tick > 40:
self.move_forward(20 + self.tick // 2)
elif self.tick == 40:
self.face_to(GAME.ui.souls.get_now().pos)
else:
self.move_pos((0, -40 + self.tick))
self.u_ani()
class FbRhb(FbRise):
def on_action(self):
r = GAME.ui.soul_rect.rect
if self.tick > 65:
self.move_forward(20 + self.tick // 2)
if self.pos[1] > r.bottom:
chanel.Chanel.play(GAME.sounds['hitsound'])
self.remove_atk()
elif self.tick == 65:
chanel.Chanel.play(GAME.sounds['toss'])
self.face_to((random.randint(r.left, r.right), r.bottom))
else:
self.move_pos((0, -45 + self.tick))
self.u_ani()
class FbD(Fb):
def on_action(self):
self.move_forward(10 + self.tick // 2)
self.u_ani()
class FbS(Fb):
def set_r(self, r):
self.set_attribute(r=r)
def on_action(self):
rot = (self.get_attribute('r') + self.tick * 10) % 360
# print(rot, self.tick)
self.set_pos(GAME.ui.soul_rect.rect.center)
self.set_rotation(rot)
self.move_forward(400 - self.tick * 10)
if self.tick >= 40:
self.remove_atk()
self.u_ani()
self.set_rotation(0)
class BulletRiser(Wave):
def on_wave_start(self):
game.GAME.ui.soul_rect.exp_rect.__init__(540, 500, 200, 200)
self.attacks.append(attacks.Attacks(GAME.monsters[0]))
GAME.ui.souls.get_now().set_pos(GAME.ui.soul_rect.rect.center)
def on_wave_update(self):
for atk in self.attacks:
atk.update()
if self.tick % 20 == 1:
self.attacks[0].add(FbRise((random.randint(0, 200), random.randint(1000, 1500)), game.GAME.graphics['pj.attack.fb.idle.1']))
elif self.tick % 20 == 11:
self.attacks[0].add(FbRise((random.randint(1080, 1280), random.randint(1000, 1500)), game.GAME.graphics['pj.attack.fb.idle.1']))
if self.tick >= 200:
self.end_wave()
class BulletSpin(Wave):
def on_wave_start(self):
game.GAME.ui.soul_rect.exp_rect.__init__(490, 350, 300, 300)
self.attacks.append(attacks.Attacks(GAME.monsters[0]))
GAME.ui.souls.get_now().set_pos(GAME.ui.soul_rect.rect.center)
def on_wave_update(self):
for atk in self.attacks:
atk.update()
if self.tick % 30 == 1:
r = random.randint(0, 359)
for i in range(r, r + 359, 45):
atk = FbS((0, 0), GAME.graphics['pj.attack.fb.idle.1'])
atk.set_r(i % 360)
self.attacks[0].add(atk)
if self.tick >= 200:
self.end_wave()
class BulletRiserOver(Wave):
def on_wave_start(self):
game.GAME.ui.soul_rect.exp_rect.__init__(440, 300, 400, 400)
self.attacks.append(attacks.Attacks(GAME.monsters[0]))
GAME.ui.souls.get_now().set_pos(GAME.ui.soul_rect.rect.center)
def on_wave_update(self):
for atk in self.attacks:
atk.update()
if self.tick % 15 == 1:
for i in range(2):
self.attacks[0].add(FbRise((random.randint(200, 1080), random.randint(900, 1000)), game.GAME.graphics['pj.attack.fb.idle.1']))
if self.tick >= 200:
self.end_wave()
class BulletShoot(Wave):
def __init__(self):
super().__init__()
self.tgt = 0
def on_wave_start(self):
game.GAME.ui.soul_rect.exp_rect.__init__(440, 560, 400, 200)
self.attacks.append(attacks.Attacks(GAME.monsters[0]))
GAME.ui.souls.get_now().set_pos(GAME.ui.soul_rect.rect.center)
def on_wave_update(self):
for atk in self.attacks:
atk.update()
if self.tick % 20 == 1:
self.tgt = random.randint(240, 1040)
if self.tick == 181:
self.tgt = 640
elif self.tick % 20 < 12:
flowery_ani.set_pos(((flowery_ani.pos[0] + self.tgt) // 2, flowery_ani.pos[1]))
else:
a_s = []
if self.tick % 5 == 1:
a_s = [-30, 0, 30]
elif self.tick % 5 == 3:
a_s = [-15, 15]
for a in a_s:
atk = FbD(flowery_ani.pos, GAME.graphics['pj.attack.fb.idle.1'])
atk.face_to(GAME.ui.souls.get_now().pos)
atk.rotate(a)
self.attacks[0].add(atk)
if self.tick >= 200:
self.end_wave()
def on_wave_end(self):
flowery_ani.pos = (640, flowery_ani.pos[1])
class BulletMixed(Wave):
def __init__(self):
super().__init__()
self.tgt = 0
def on_wave_start(self):
GAME.ui.soul_rect.exp_rect.__init__(390, 300, 500, 400)
self.attacks.append(attacks.Attacks(GAME.monsters[0]))
GAME.ui.souls.get_now().set_pos(GAME.ui.soul_rect.rect.center)
def on_wave_update(self):
for atk in self.attacks:
atk.update()
if self.tick % 30 == 21:
for i in range(2):
self.attacks[0].add(FbRise((random.randint(100, 1180), random.randint(900, 1000)), game.GAME.graphics['pj.attack.fb.idle.1']))
if self.tick >= 200:
self.end_wave()
for atk in self.attacks:
atk.update()
if self.tick % 30 == 1:
self.tgt = random.randint(240, 1040)
if self.tick == 271:
self.tgt = 640
elif self.tick % 30 < 12:
flowery_ani.set_pos(((flowery_ani.pos[0] + self.tgt) // 2, flowery_ani.pos[1]))
elif self.tick % 30 < 16:
pass
else:
a_s = []
if self.tick % 10 == 2:
a_s = [-60, -30, 0, 30, 60]
elif self.tick % 10 == 6:
a_s = [-45, -15, 15, 45]
for a in a_s:
atk = FbD(flowery_ani.pos, GAME.graphics['pj.attack.fb.idle.1'])
atk.face_to(GAME.ui.souls.get_now().pos)
atk.rotate(a)
self.attacks[0].add(atk)
if self.tick >= 300:
self.end_wave()
def on_wave_end(self):
flowery_ani.pos = (640, 240)
class BulletShootFast(BulletShoot):
def on_wave_update(self):
for atk in self.attacks:
atk.update()
if self.tick % 10 == 1:
self.tgt = random.randint(240, 1040)
if self.tick == 181:
self.tgt = 640
elif self.tick % 10 < 9:
flowery_ani.set_pos(((flowery_ani.pos[0] + self.tgt) // 2, flowery_ani.pos[1]))
else:
for a in [-30, 0, 30]:
atk = FbD(flowery_ani.pos, GAME.graphics['pj.attack.fb.idle.1'])
atk.face_to(GAME.ui.souls.get_now().pos)
atk.rotate(a)
self.attacks[0].add(atk)
if self.tick >= 200:
self.end_wave()
class BottomShooter(Wave):
def on_wave_start(self):
game.GAME.ui.soul_rect.exp_rect.__init__(540, 530, 200, 100)
self.attacks.append(attacks.Attacks(GAME.monsters[0]))
GAME.ui.souls.get_now().set_pos(GAME.ui.soul_rect.rect.center)
def on_wave_update(self):
for atk in self.attacks:
atk.update()
if self.tick % 20 == 1:
self.attacks[0].add(FbRhb((random.randint(0, 640), random.randint(1000, 1200)), game.GAME.graphics['pj.attack.fb.idle.1']))
elif self.tick % 20 == 11:
self.attacks[0].add(FbRhb((random.randint(640, 1280), random.randint(1000, 1200)), game.GAME.graphics['pj.attack.fb.idle.1']))
if self.tick >= 200:
self.end_wave()
class MixShooter(BottomShooter):
def on_wave_start(self):
game.GAME.ui.soul_rect.exp_rect.__init__(490, 500, 300, 200)
self.attacks.append(attacks.Attacks(GAME.monsters[0]))
GAME.ui.souls.get_now().set_pos(GAME.ui.soul_rect.rect.center)
def on_wave_update(self):
for atk in self.attacks:
atk.update()
if self.tick % 10 == 1:
self.attacks[0].add(FbRise((random.randint(400, 880), random.randint(1500, 1700)), game.GAME.graphics['pj.attack.fb.idle.1']))
if random.randint(0, 1):
self.attacks[0].add(FbRhb((random.randint(0, 400), random.randint(1000, 1200)), game.GAME.graphics['pj.attack.fb.idle.1']))
else:
self.attacks[0].add(FbRhb((random.randint(880, 1280), random.randint(1000, 1200)), game.GAME.graphics['pj.attack.fb.idle.1']))
if self.tick >= 200:
self.end_wave()
class Hurricane(BottomShooter):
def on_wave_start(self):
game.GAME.ui.soul_rect.exp_rect.__init__(390, 500, 500, 200)
self.attacks.append(attacks.Attacks(GAME.monsters[0]))
GAME.ui.souls.get_now().set_pos(GAME.ui.soul_rect.rect.center)
def on_wave_update(self):
for atk in self.attacks:
atk.update()
if self.tick % 5 == 1:
if random.randint(0, 1):
self.attacks[0].add(FbRhb((random.randint(0, 400), random.randint(1000, 1200)), game.GAME.graphics['pj.attack.fb.idle.1']))
else:
self.attacks[0].add(FbRhb((random.randint(880, 1280), random.randint(1000, 1200)), game.GAME.graphics['pj.attack.fb.idle.1']))
if self.tick >= 300:
self.end_wave()
class BulletFinal(BulletShoot):
def on_wave_start(self):
game.GAME.ui.soul_rect.exp_rect.__init__(440, 400, 400, 400)
self.attacks.append(attacks.Attacks(GAME.monsters[0]))
GAME.ui.souls.get_now().set_pos(GAME.ui.soul_rect.rect.center)
def on_wave_update(self):
for atk in self.attacks:
atk.update()
if self.tick % 15 == 1:
if self.tick % 45 == 1:
r = random.randint(0, 359)
for i in range(r, r + 340, 60):
atk = FbS((0, 0), GAME.graphics['pj.attack.fb.idle.1'])
atk.set_r(i % 360)
self.attacks[0].add(atk)
self.tgt = random.randint(240, 1040)
if self.tick == 181:
self.tgt = 640
elif self.tick % 15 < 9:
GAME.ui.soul_rect.exp_rect.centerx -= (flowery_ani.pos[0] + self.tgt) // 2 - flowery_ani.pos[0]
GAME.ui.souls.get_now().move_pos((-(flowery_ani.pos[0] + self.tgt) // 2 + flowery_ani.pos[0], 0))
flowery_ani.set_pos(((flowery_ani.pos[0] + self.tgt) // 2, flowery_ani.pos[1]))
if self.tick % 15 == 4:
self.attacks[0].add(FbRhb((random.randint(0, 1280), random.randint(1000, 1200)), game.GAME.graphics['pj.attack.fb.idle.1']))
elif self.tick % 4 == 1:
for a in [-30, 0, 30]:
atk = FbD(flowery_ani.pos, GAME.graphics['pj.attack.fb.idle.1'])
atk.face_to(GAME.ui.souls.get_now().pos)
atk.rotate(a)
self.attacks[0].add(atk)
if self.tick >= 200:
self.end_wave()
waves = [BulletRiser, BulletShoot, BulletRiserOver, BulletSpin, BulletMixed, BulletShootFast,
BottomShooter, MixShooter, Hurricane, BulletFinal]
GAME = Game(player, monsters, waves, os.path.join('../undertale.determination/', 'resources'))
write_game(GAME)
GAME.build()
idx = 0
say = [
['You are just[nxtl]so stupid', 'You know I\'ll[nxtl]become a flower[nxtl]again, don\'t you?'],
['Are you just[nxtl]trying to get[nxtl]your[nxtl]\'Perfect Endding\'?', 'So silly,', 'You are just[nxtl]noob trying to[nxtl]save everything'],
['See this?[nxtl]Your determination,[nxtl]it helps you[nxtl]to achieve[nxtl]everything,'],
['How much I[nxtl]love it?', 'But got STUCK[nxtl]with it!', 'All you do[nxtl]was not in[nxtl]mind, right?'],
['Let\'s just[nxtl]don\'t say this', 'Focus on your[nxtl]fight'],
['Hey,[endl]watch out!'],
['You\'ve seen[nxtl]rain?'],
['Hey,[endl]watch up!', 'No![endl]watch down!'],
['shooting quickly,[nxtl]looks like rain,[nxtl]', 'I\'d like to[nxtl]call it[nxtl]\'The Hurricane\''],
['let\'s see[nxtl]how many times[nxtl]will you try[nxtl]for this attack?'],
['']
]
@GAME.set_event
def on_wave_start(wave):
global say, idx
GAME.ui.monster_speech(flowery_ani().midleft, say[idx])
idx = min(idx + 1, len(say) - 1)
GAME.theme_color = (127, 0, 0)
@GAME.set_event
def on_wave_end(wave):
GAME.player.df = 20
GAME.ins_wave = (GAME.ins_wave + 1) % len(waves)
if not GAME.ins_wave and flowery.hp == flowery.max_hp:
flowery.defeat = PACIFIST_ROUTE
GAME.theme_color = (255, 255, 255)
GAME.inventory.set_item('last dream', False)
GAME.inventory.set_item('determin.', False)
GAME.inventory.set_inventory(['last dream' for i in range(8)])
@GAME.inventory.events
def on_item_used(item_name: str) -> list[str] | None:
if item_name == 'last dream':
GAME.player.heal(10)
GAME.player.hp += 30
return ['Your last hopes, [endl]Your last dreams,', 'Your determination..', 'Your recover 10 HP!', 'You got extra 30 hp!']
if item_name == 'determin.':
GAME.player.heal(100)
return ['Determination.']
@GAME.ui.attack_bars
def atk():
tmp = []
for i in range(4):
tmp.append((-i * 200, 50))
return tmp
@player.events
def on_attack(damage: int, target: monster.Monster) -> int | None:
global idx
GAME.inventory.set_inventory(['determin.' for i in range(8)])
flowery.acts = ['useless']
player.lv = 20
player.max_hp = 100
MChanel.stop()
idx = len(say) - 1
return damage * max(player.at * 5 - target.df * 3, 0) // 3
MChanel.play(GAME.sounds['mus_flowery'])
GAME.theme_color = (127, 0, 0)
if __name__ == '__main__':
GAME.go()