forked from vaendryl/Sunrider
-
Notifications
You must be signed in to change notification settings - Fork 0
/
combatlabels.rpy
391 lines (320 loc) · 11.7 KB
/
combatlabels.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
#these labels are called by combat code
#init:
# image movie = Movie(size=(400, 300), xalign=0.5, yalign=0.5)
image black = Solid((0, 0, 0, 255))
#label no_animation: #defunct
# scene black with dissolve
# show work_in_progress
# pause 0.5
# return
transform shake(time=0.5,repeats=20): #defunct?
xalign 0.5 yalign 0.5
pause time
block:
ease 0.01 xpos 0.51
ease 0.02 xpos 0.49
ease 0.01 xpos 0.5
repeat repeats
label test_battle:
python:
zoomlevel = 1
enemy_ships = []
destroyed_ships = []
BM.mission = 'test'
BM.orders['SHORT RANGE WARP'] = [750,'short_range_warp']
#create the sunrider. you only have to create a player ship once:
sunrider_weapons = [SunriderLaser(),SunriderKinetic(),SunriderMissile(),SunriderRocket(),SunriderAssault()]
sunrider = create_ship(Sunrider(),(8,6),sunrider_weapons)
blackjack_weapons = [BlackjackMelee(),BlackjackLaser(),BlackjackAssault(),BlackjackMissile(),BlackjackPulse()]
blackjack = create_ship(BlackJack(),(10,5),blackjack_weapons)
liberty_weapons = [LibertyLaser(),Repair(),AccUp(),DamageUp(),AccDown()]
liberty = create_ship(Liberty(),(8,7),liberty_weapons)
phoenix_weapons = [PhoenixMelee(),Stealth(),GravityGun()]
phoenix = create_ship(Phoenix(),(10,7),phoenix_weapons)
create_ship(Havoc(),(13,5),[Melee(),HavocAssault(),HavocMissile(),HavocRocket()])
enemy_ships[-1].hp = 1
create_ship(PirateGrunt(),(13,7),[PirateGruntLaser(),PirateGruntMissile(),PirateGruntAssault()])
create_ship(PirateGrunt(),(13,6),[PirateGruntLaser(),PirateGruntMissile(),PirateGruntAssault()])
create_ship(PirateGrunt(),(13,8),[PirateGruntLaser(),PirateGruntMissile(),PirateGruntAssault()])
create_ship(PactCruiser(),(14,8),[])
create_ship(PirateDestroyer(),(16,5),[PirateDestroyerLaser(),PirateDestroyerKinetic()])
create_ship(PirateDestroyer(),(16,7),[PirateDestroyerLaser(),PirateDestroyerKinetic()])
#center the viewport on the sunrider
BM.xadj.value = 872
BM.yadj.value = 370
$ PlayerTurnMusic = "music/Titan.ogg"
$ EnemyTurnMusic = "music/Dusty_Universe.ogg"
# $ buy_upgrades() ##testing
jump battle_start
return
label missiontest:
$BM.battle() #continue the battle
if BM.battlemode == True: #whenever this is set to False battle ends.
jump missiontest #loop back
else:
pass #continue down
return
transform melee_atkanim(img1,img2):
img1
xalign 0.5 yalign 0.5
zoom 2 xpos 0.2
ease 0.5 zoom 1 xpos 0.5
pause 1.3
img2 with Dissolve(.5, alpha=True)
pause 1.0
xpos 0.5 ypos 0.5
ease 1.0 xpos 2.0 ypos -1.0
xpos -2.0 ypos 1.0
ease 1.5 xpos 0.9 ypos 0.5
pause 0.5
xpos 0.9 ypos 0.5
ease 1.0 xpos 2.0 ypos -1.0
transform melee_atkanim_enemy(img1,img2):
img1
xalign 0.5 yalign 0.5
zoom 2 xpos 0.8
ease 0.5 zoom 1 xpos 0.5
pause 1.3
img2 with Dissolve(.5, alpha=True)
pause 1.0
xpos 0.5 ypos 0.5
ease 1.0 xpos -2.0 ypos -1.0
xpos 2.0 ypos 1.0
ease 1.5 xpos 0.1 ypos 0.5
pause 0.5
xpos 0.1 ypos 0.5
ease 1.0 xpos -1.0 ypos -1.0
transform melee_atkanim_sprite(img1):
img1
yanchor 0.51 ypos 1.0
xanchor 0.5
zoom 0.6255
subpixel True
xzoom -1 xpos -0.2
ease 0.3 xpos 0.15
pause 0.5
ease 1.5 alpha 0
transform melee_hitanim(img1,yy):
pause 3.5
img1
yanchor 0.5 xanchor 0.5
xpos 0.5 ypos 0.5
linear 1.0 ypos yy
screen melee_player:
zorder 2
if store.damage == 'miss':
add melee_hitanim(BM.target.sprites['standard'],-1.5)
else:
add melee_hitanim(BM.target.sprites['standard'],0.5)
if BM.attacker.faction == 'Player':
add melee_atkanim(BM.attacker.sprites['standard'],BM.attacker.sprites['melee'])
else:
add melee_atkanim_enemy(BM.attacker.sprites['standard'],BM.attacker.sprites['melee'])
add melee_atkanim_sprite(BM.attacker.sprites['character'])
label melee_attack_player:
python:
renpy.show_screen('show_background',_layer='master')
renpy.show_screen('melee_player',_layer='master')
try:
random = renpy.random.randint(0,len(BM.attacker.attack_voice)-1)
renpy.music.play(BM.attacker.attack_voice[random],channel=BM.attacker.voice_channel)
except:
pass
pause 1.3
if BM.attacker.name == 'Havoc':
play sound "sound/chainsaw.ogg"
else:
play sound "sound/mech1.ogg"
pause 1.0 #I think dissolve effect also pauses for a little while
play sound "sound/boasters.ogg"
pause 1.4
## hitanim ## little reason not to combine them if it's all dynamically generated anyway.
show screen animation_hp
pause 1.0
play sound "sound/Sword Shing 2.ogg"
if store.damage != 'miss':
if BM.attacker.faction == 'Player':
show melee_overlay onlayer screens:
xzoom -1
with meleehitreverse
else:
show melee_overlay onlayer screens:
xzoom -1
with meleehit
pause 0.1
hide melee_overlay onlayer screens with dissolvequick
pause 0.5
play sound1 "sound/explosion1.ogg"
show layer master at shake2(repeats=6)
if BM.attacker.faction == 'Player':
show piratebomber_kinetichit2 onlayer screens:
xpos 0.55 ypos 0.5 zoom 1.2
ease 1.2 alpha 0
pause 0.1
play sound2 "sound/explosion1.ogg"
show layer master at shake2(repeats=6)
show piratebomber_kinetichit1 onlayer screens:
xpos 0.55 ypos 0.5 zoom 1.2
ease 1.2 alpha 0
else:
show piratebomber_kinetichit2 onlayer screens:
xpos 0.4 ypos 0.5 xzoom -1 zoom 1.2
ease 1.2 alpha 0
pause 0.1
play sound2 "sound/explosion1.ogg"
show layer master at shake2(repeats=6)
show piratebomber_kinetichit1 onlayer screens:
xpos 0.4 ypos 0.5 xzoom -1 zoom 1.2
ease 1.2 alpha 0
pause 0.5
if BM.attacker.faction == 'Player':
$renpy.call('attacksuccess_{}'.format(BM.attacker.animation_name))
else:
$renpy.call('hit_{}'.format(BM.target.animation_name))
else:
pause 0.5
if BM.attacker.faction == 'Player':
$renpy.call('attackfail_{}'.format(BM.attacker.animation_name))
else:
python:
try:
random = renpy.random.randint(0,len(BM.attacker.no_damage_voice)-1)
renpy.music.play(BM.attacker.no_damage_voice[random],channel=BM.attacker.voice_channel)
except:
pass
return
label endofturn:
show screen battle_screen
$update_stats()
if not BM.phase == 'Player':
play sound 'sound/battle.wav'
show sunrider_phase onlayer screens zorder 50
pause TURN_SPEED
play sound 'sound/drum.ogg'
hide sunrider_phase onlayer screens zorder 50 with dissolve
$ BM.phase = 'Player'
elif BM.phase == 'Player' and enemy_ships[0].faction == 'PACT':
play sound 'sound/battle.wav'
show PACT_phase onlayer screens zorder 50
pause TURN_SPEED
play sound 'sound/drum.ogg'
hide PACT_phase onlayer screens zorder 50 with dissolve
$ BM.phase = 'PACT'
elif BM.phase == 'Player' and enemy_ships[0].faction == 'Pirate':
play sound 'sound/battle.wav'
show Pirate_phase onlayer screens zorder 50
pause TURN_SPEED
play sound 'sound/drum.ogg'
hide Pirate_phase onlayer screens zorder 50 with dissolve
$ BM.phase = 'Pirate'
$update_modifiers() #update buffs and curses
if BM.phase == 'Player':
$ renpy.take_screenshot()
$ renpy.save('beginturn')
return
label battle_start:
play music PlayerTurnMusic
python:
BM.stopAI = False
BM.order_used = False
renpy.take_screenshot()
renpy.save('battlestart')
renpy.take_screenshot()
renpy.save('beginturn')
if BM.show_tooltips:
renpy.show_screen('tooltips')
BM.xadj.value = 872
BM.yadj.value = 370
for ship in player_ships:
ship.hp = ship.max_hp
ship.en = ship.max_en
# renpy.show_screen('mousefollow')
store.zoomlevel = 0.65
BM.show_grid = False
sort_ship_list()
BM.start()
return
label sunrider_destroyed:
hide screen commands
hide screen battle_screen
scene badend
$ BM.phase = 'Player' #this makes it so you can save and load again, as it's normally blocked during the enemy's turn
menu:
"Try Again":
jump tryagain
"Load Saved Game":
jump loadsavedgame
return
label loadsavedgame: #used when the player chooses to load a saved game after game over
show screen load
pause
jump sunrider_destroyed
return
#label battle:
# $BM.battle()
# if BM.battlemode == True:
# jump battle
# else:
# return
label tryagain:
$renpy.load('battlestart')
pause
$show_message('this should never show up')
pause
return
label restartturn:
$renpy.load('beginturn')
pause
$show_message('this should never show up')
pause
return
label after_load:
python:
reset = False
if not hasattr(store,'BM'):
BM = Battle()
if hasattr(BM,'save_version'):
if BM.save_version != config.version:
reset = True
else:
pass #everything is fine, do not reset
else:
reset = True
if reset:
rocketdamage = 800
if hasattr(store,'sunrider_rocket'):
rocketdamage = store.sunrider_rocket.damage
reset_classes()
store.sunrider.weapons[3].damage = rocketdamage
BM.save_version = config.version
res_location = "lab"
res_event = "allocatefunds"
#check if the ship variable is defined or not. if not, define it
if not hasattr(store,'bianca'):
bianca = None
#it should now be defined. if it's None create the ship at location None
if bianca == None:
pass
else:
bianca.weapons = [BiancaAssault(),GravityGun(),AccDown(),DamageUp()]
if not hasattr(store,'liberty'):
liberty = None
if liberty == None:
pass
else:
liberty.weapons = [LibertyLaser(),Repair(),AccUp(),Disable(),FlakOff(),ShutOff()]
if not hasattr(store,'phoenix'):
phoenix = None
if phoenix == None:
pass
else:
phoenix.weapons = [PhoenixAssault(),PhoenixMelee(),Stealth()]
#cleanup
if hasattr(BM,'ships') and hasattr(store,'player_ships') and hasattr(store,'enemy_ships'):
if BM.ships != []:
BM.ships = []
for ship in player_ships:
BM.ships.append(ship)
for ship in enemy_ships:
BM.ships.append(ship)
return