forked from vaendryl/Sunrider
-
Notifications
You must be signed in to change notification settings - Fork 0
/
screens custom.rpy
1449 lines (1245 loc) · 59.7 KB
/
screens custom.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
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
## this module creates custom screens. I prefer not to clutter the ren'py
## default screens.rpy module as it's pretty full already
## 0) transforms
## 1) status screens
## 2) battle map
## 3) command menu
init -2: ##0) transforms
# $import random
transform hoverglow(img1): #makes units glow when you mouseover
im.MatrixColor(img1,im.matrix.brightness(.05))
pause 0.1
im.MatrixColor(img1,im.matrix.brightness(.10))
pause 0.1
im.MatrixColor(img1,im.matrix.brightness(.15))
pause 0.1
im.MatrixColor(img1,im.matrix.brightness(.10))
pause 0.1
im.MatrixColor(img1,im.matrix.brightness(.05))
pause 0.1
im.MatrixColor(img1,im.matrix.brightness(.0))
pause 0.1
im.MatrixColor(img1,im.matrix.brightness(-0.05))
pause 0.1
im.MatrixColor(img1,im.matrix.brightness(-0.10))
pause 0.1
im.MatrixColor(img1,im.matrix.brightness(-0.15))
pause 0.1
im.MatrixColor(img1,im.matrix.brightness(-0.10))
pause 0.1
im.MatrixColor(img1,im.matrix.brightness(-0.05))
pause 0.1
im.MatrixColor(img1,im.matrix.brightness(0.0))
pause 0.1
repeat
transform vanguard_cannon:
crop (0,0,0,int(200 / zoomlevel))
easeout 1 crop (0,0,1344 / zoomlevel,200 / zoomlevel)
transform warpout:
alpha 0
easein 1 alpha 1
transform buffup(xx):
ypos xx
alpha 1
parallel:
linear 1 ypos int(xx-190*zoomlevel)
parallel:
time 0.5
linear 0.5 alpha 0
transform cursedown(xx):
ypos xx
alpha 1
parallel:
linear 1 ypos int(xx+190*zoomlevel)
parallel:
time 0.5
linear 0.5 alpha 0
transform movebutton: #used to make it look cool when you click Move
zoom zoomlevel/5.0
alpha 0.5
on start:
alpha 0.5
on hover:
linear 0.3 alpha 1.0
on idle:
linear 0.5 alpha 0.5
transform zoom_button(xx,yy=1):
zoom xx
alpha yy
transform move_ship(x1,y1,x2,y2,speed=0.45):
on start:
xpos x1 ypos y1
linear speed xpos x2 ypos y2
transform delayed_image(wait,img):
alpha 0
pause wait
alpha 0.8
transform delay_float_text(yy,wait):
ypos yy
alpha 0
time wait
alpha 1
easein 1.0 ypos int(yy-80*zoomlevel)
screen battle_screen:
tag tactical
modal False
zorder -5
key "mousedown_4" action Return(["zoom", "in"]) #scroll in and out
key "mousedown_5" action Return(["zoom", "out"])
key "K_PAGEUP" action Return(["zoom", "in"])
key "K_PAGEDOWN" action Return(["zoom", "out"])
if 'mouseup_2' not in config.keymap['hide_windows']:
key "mousedown_2" action Return("next ship")
if 'mouseup_3' not in config.keymap['game_menu']:
key "mousedown_3" action Return("deselect")
key "]" action Return("next ship")
key "[" action Return("previous ship")
##messing with the player for fun and profit
if BM.battlemode:
timer 900 repeat False action Show('game_over_gimmick')
add MouseTracker() #relates drags and clicks to the viewport and the BM
if config.developer: #a release version should have set this to False
key "Q" action Jump('quit') ##DEBUG FAST QUIT##
key "A" action Return('anime')
key "P" action Return('I WIN')
$childx = round(3840*zoomlevel) #this makes it so you can't scroll past the edge of the battlefield when zoomed out
$childy = round(3006*zoomlevel+300) #extra 300 is so that the status window doesn't occlude ships in the far right bottom corner
# use tooltips #wtf doesn't this work
add BM.battle_bg xalign 0.5 yalign 0.5 #zoom 0.5 ##background for the battlefield##
viewport id "grid":
xmaximum 1920
ymaximum 1080
xadjustment BM.xadj
yadjustment BM.yadj
child_size (childx,childy)
draggable False #BM.draggable
mousewheel False
edgescroll BM.edgescroll #(0,0) #(70,400*zoomlevel)
##CREATE HEX GRID##
##laggy as fuck!!
if BM.show_grid:
for a in range(1,GRID_SIZE[0]+1): #cycle through rows
for b in range(1,GRID_SIZE[1]+1): #cycle through columns
$xposition = dispx(a, b, zoomlevel)
$yposition = dispy(a, b, zoomlevel)
$xsize = int((HEXW + 4) * zoomlevel)
$ysize = int((HEXH + 4) * zoomlevel)
add "Battle UI/hex.png":
xpos xposition
ypos yposition
size (xsize,ysize)
alpha 0.4
else:
$xsize = int((HEXW+5.5) * zoomlevel * 18)
$ysize = int((HEXD+4) * zoomlevel * 16)
add 'Battle UI/hexgrid.png':
alpha 0.4
# zoom zoomlevel * 0.685
size (xsize,ysize)
xpos int(HEXW * zoomlevel)
ypos int((HEXD-2) * zoomlevel)
##legion warning indicator
##the idea that uses this has been scrapped, but I'll keep the code around in case it proves useful in the future
# if hasattr(store,'legion'):
# if legion.active:
# if legion.row != 0:
# text ' - - - - warning - - - - - warning - - - - - warning- - - - - warning - - - - ':
# color 'f00' ypos int(120*(legion.row-0.25) *zoomlevel)
# size int(120*zoomlevel)
## layout nowrap
##display shield and flak ranges
if not BM.hovered == None: #when you hover over a ship
if BM.hovered.shield_generation > 0:
for a in range(1,GRID_SIZE[0]+1): #cycle through rows
for b in range(1,GRID_SIZE[1]+1): #cycle through columns
if get_distance(BM.hovered.location,(a,b)) <= BM.hovered.shield_range:
$ ship = BM.hovered
$ effective_shielding = ship.shield_generation + ship.modifiers['shield_generation'][0]
if effective_shielding > 0:
$xposition = dispx(a,b,zoomlevel)
$yposition = dispy(a,b,zoomlevel)
$xsize = int((HEXW + 4) * zoomlevel)
$ysize = int((HEXH + 4) * zoomlevel)
add "Battle UI/blue hex.png":
xpos xposition
ypos yposition
size (xsize,ysize)
alpha 0.7
if BM.hovered.flak > 0:
for a in range(1,GRID_SIZE[0]+1): #cycle through rows
for b in range(1,GRID_SIZE[1]+1): #cycle through columns
if get_distance(BM.hovered.location,(a,b)) <= BM.hovered.flak_range:
$ ship = BM.hovered
$effective_flak = ship.flak + ship.modifiers['flak'][0]
if effective_flak > 0:
$xposition = dispx(a,b,zoomlevel)
$yposition = dispy(a,b,zoomlevel)
$xsize = int((HEXW + 4) * zoomlevel)
$ysize = int((HEXH + 4) * zoomlevel)
add "Battle UI/red hex.png":
xpos xposition
ypos yposition
size (xsize,ysize)
alpha 0.9
if not BM.weaponhover == None: #when you hover over a weapon button
if BM.weaponhover.wtype == 'Missile' or BM.weaponhover.wtype == 'Rocket' or BM.weaponhover.name == 'Flak Off':
for a in range(1,GRID_SIZE[0]+1): #cycle through rows
for b in range(1,GRID_SIZE[1]+1): #cycle through columns
for ship in enemy_ships:
if get_distance(ship.location,(a,b)) <= ship.flak_range:
$effective_flak = ship.flak + ship.modifiers['flak'][0]
if effective_flak > 0:
$xposition = dispx(a,b,zoomlevel)
$yposition = dispy(a,b,zoomlevel)
$xsize = int((HEXW + 4) * zoomlevel)
$ysize = int((HEXH + 4) * zoomlevel)
add "Battle UI/red hex.png":
xpos xposition
ypos yposition
size (xsize,ysize)
alpha 0.9
if BM.weaponhover.wtype == 'Laser' or BM.weaponhover.wtype == 'Pulse' or BM.weaponhover.name == 'Shield Down':
for a in range(1,GRID_SIZE[0]+1): #cycle through rows
for b in range(1,GRID_SIZE[1]+1): #cycle through columns
for ship in enemy_ships:
if get_distance(ship.location,(a,b)) <= ship.shield_range:
$effective_shielding = ship.shield_generation + ship.modifiers['shield_generation'][0]
if effective_shielding > 0:
$xposition = dispx(a,b,zoomlevel)
$yposition = dispy(a,b,zoomlevel)
$xsize = int((HEXW + 4) * zoomlevel)
$ysize = int((HEXH + 4) * zoomlevel)
add "Battle UI/blue hex.png":
xpos xposition
ypos yposition
size (xsize,ysize)
alpha 0.7
## DISPLAY COVER ##
for cover in BM.covers:
$xposition = dispx(cover.location[0],cover.location[1],zoomlevel, 0.5)
$yposition = dispy(cover.location[0],cover.location[1],zoomlevel, 0.5)
$xsize = int(210 * zoomlevel)
$ysize = int(120 * zoomlevel)
add cover.label:
xanchor 0.5
yanchor 0.5
xpos xposition
ypos yposition
size (xsize,ysize)
at Transform(cover.label,rotate = cover.angle)
## DISPLAY SHIP AVATARS ##
for ship in BM.ships: #cycle through every ship in the battle
##first we show the circle base below every unit
if ship.location != None:
$xposition = dispx(ship.location[0],ship.location[1],zoomlevel, 0.50 * ADJX) + int(zoomlevel * MOVX)
$yposition = dispy(ship.location[0],ship.location[1],zoomlevel, 0.50 * ADJY) + int(zoomlevel * MOVY)
$xsize = int(210 * zoomlevel)
$ysize = int(120 * zoomlevel)
if ship.faction == 'Player':
add "Battle UI/player base.png":
xanchor 0.5
yanchor 0.5
xpos xposition
ypos yposition
size (xsize,ysize)
if ship.faction == 'PACT':
add "Battle UI/pact_base.png":
xanchor 0.5
yanchor 0.5
xpos xposition
ypos yposition
size (xsize,ysize)
if ship.faction == 'Pirate':
add "Battle UI/pirate_base.png":
xanchor 0.5
yanchor 0.5
xpos xposition
ypos yposition
size (xsize,ysize)
$cell_width = 1920 / ((GRID_SIZE[0]+2)/2)
$cell_height = 1503 / ((GRID_SIZE[1]+2)/2)
#$cell_offset = cell_width / 2
#calculate the position of the ships on the field
$xposition = dispx(ship.location[0],ship.location[1],zoomlevel, 0.50 * ADJX) + int(zoomlevel * MOVX)
$yposition = dispy(ship.location[0],ship.location[1],zoomlevel, 0.25 * ADJY) + int(zoomlevel * MOVY)
if ship.getting_buff: #used if you buff someone
add 'Battle UI/buff_back.png':
xpos int(xposition-(cell_width/2)*zoomlevel)
zoom (zoomlevel/2.0)
at buffup(yposition)
if ship.getting_curse: #used if you curse someone
add 'Battle UI/curse_back.png':
xpos int(xposition-(cell_width/2)*zoomlevel)
zoom (zoomlevel/2.0)
at cursedown(yposition-(190)*zoomlevel)
#default values
$mode = '' #default
$act = Return(['selection',ship])
$lbl = ship.lbl
$hvr = hoverglow(ship.lbl)
$hvrd = SetField(BM,'hovered',ship)
$unhvrd = SetField(BM,'hovered',None)
#some properties of the imagebutton representing a ship change depending on circumstances
if ship.faction == 'Player':
#by default player ships can be selected, which the above values are already set to.
if BM.targetingmode:
#you cannot target yourself with an active weapon
$ mode = 'offline'
if BM.active_weapon.wtype == 'Support':
#except when the active weapon is a support skill. in that case, player ships become targets
$ mode = 'target'
else: #ship is an enemy faction
#by default enemy ships can be selected (to view stat details), which the above values are already set to.
if BM.targetingmode:
#with an active weapon selected enemies become targets
$ mode = 'target'
if BM.active_weapon.wtype == 'Melee' and (ship.stype != 'Ryder' or get_ship_distance(BM.selected,ship) != 1):
#except when the active weapon is melee and this enemy is neither a ryder nor next to the attacking ship
$ mode = 'offline'
if BM.active_weapon.wtype == 'Support':
$ mode = 'offline'
if BM.active_weapon.name == 'Gravity Gun':
#the gravity gun is a special type weapon
if ship.stype != 'Ryder':
$ mode = 'offline'
if mode == 'target':
$ lbl = hoverglow(ship.lbl)
$ hvr = im.MatrixColor(ship.lbl,im.matrix.brightness(0.2))
elif mode == 'offline':
$ act = NullAction()
$ hvr = im.MatrixColor(ship.lbl,im.matrix.brightness(-0.3))
$ lbl = hvr
if BM.hovered != None:
if BM.hovered == ship:
$ lbl = hoverglow(ship.lbl)
add lbl:
xanchor 0.5
yanchor 0.5
xpos xposition
ypos yposition
zoom (zoomlevel/2.5)
if ship.getting_buff:
add 'Battle UI/buff_front.png':
xpos int(xposition-96*zoomlevel)
zoom (zoomlevel/2.0)
at buffup(int(yposition+50*zoomlevel))
if ship.getting_curse:
add 'Battle UI/curse_front.png':
xpos int(xposition-96*zoomlevel)
zoom (zoomlevel/2.0)
at cursedown(yposition-(190-50)*zoomlevel)
##add the HP bar and the EN bar
if ship.faction == 'Player':
$xposition = dispx(ship.location[0],ship.location[1],zoomlevel,0.08 * ADJX) + int(zoomlevel * MOVX)
$yposition = dispy(ship.location[0],ship.location[1],zoomlevel,0.66 * ADJY) + int(zoomlevel * MOVY)
$hp_size = int(405*(float(ship.hp)/ship.max_hp))
add 'Battle UI/label hp bar.png':
xpos xposition
ypos yposition
zoom (zoomlevel/2.5)
crop (0,0,hp_size,79)
# text str(ship.hp):
# xpos (xposition+60*zoomlevel)
# ypos (yposition+30*zoomlevel)
# size int(30 * zoomlevel)
$xposition = dispx(ship.location[0],ship.location[1],zoomlevel,0.08 * ADJX) + int(zoomlevel * MOVX)
$yposition = dispy(ship.location[0],ship.location[1],zoomlevel,0.72 * ADJY) + int(zoomlevel * MOVY)
$energy_size = int(405*(float(ship.en)/ship.max_en))
add 'Battle UI/label energy bar.png':
xpos xposition
ypos yposition
zoom (zoomlevel/2.5)
crop (0,0,energy_size,79)
else: #enemies
$xposition = dispx(ship.location[0],ship.location[1],zoomlevel,0.09 * ADJX) + int(zoomlevel * MOVX)
$yposition = dispy(ship.location[0],ship.location[1],zoomlevel,0.70 * ADJY) + int(zoomlevel * MOVY)
$hp_size = int(405*(float(ship.hp)/ship.max_hp))
add 'Battle UI/label hp bar.png':
xpos xposition
ypos yposition
zoom (zoomlevel/2.5)
crop (0,0,hp_size,90)
text str(ship.hp):
xanchor 0.5
yanchor 0.5
xpos int(xposition+80*zoomlevel)
ypos int(yposition+27*zoomlevel)
size int(16*zoomlevel)
font "Font/sui generis rg.ttf"
outlines [(2,'000',0,0)]
##show flak icon and intercept text
if BM.missile_moving:
for ship in BM.ships:
if ship.flaksim != None:
$xposition = dispx(ship.location[0],ship.location[1],zoomlevel,0.50 * ADJX) + int(zoomlevel * MOVX)
$yposition = dispy(ship.location[0],ship.location[1],zoomlevel,0.25 * ADJY) + int(zoomlevel * MOVY)
$ wait = ship.flaksim[0]
$ intercept_count = ship.flaksim[1]
add 'Battle UI/warning icon.png':
xanchor 0.5
yanchor 0.5
xpos xposition
ypos yposition
zoom (zoomlevel/2.5)
alpha 0.8
at delayed_image(wait)
$ textcolor = 'f00'
if ship.faction == 'Player':
$ textcolor = '0f0'
text '{} intercepted! \neffectiveness: {}%'.format( intercept_count , int(ship.flak_effectiveness) ):
xanchor 0.5
yanchor 0.5
# xmaximum 200
xpos xposition
ypos yposition
size 28
color textcolor
outlines [(2,'000',0,0)]
at delay_float_text(yposition,wait)
##show missiles on the map that are currently flying in space##
if BM.missile_moving:
for missile in BM.missiles:
$xposition = dispx(missile.parent.location[0], missile.parent.location[1],zoomlevel,0.50 * ADJX) + int(zoomlevel * MOVX)
$yposition = dispy(missile.parent.location[0], missile.parent.location[1],zoomlevel,0.25 * ADJY) + int(zoomlevel * MOVY)
$next_xposition = dispx(missile.target.location[0],missile.target.location[1],zoomlevel,0.50 * ADJX) + int(zoomlevel * MOVX)
$next_yposition = dispy(missile.target.location[0],missile.target.location[1],zoomlevel,0.25 * ADJY) + int(zoomlevel * MOVY)
# if missile.shot_down != None:
# $ travel_time = missile.shot_down
# else:
$ travel_time = get_ship_distance(missile.parent,missile.target)*MISSILE_SPEED
add missile.lbl:
at move_ship(xposition,yposition,next_xposition,next_yposition,travel_time)
xanchor 0.5
yanchor 0.5
zoom (zoomlevel/4.0)
# text str(missile.shot_count):
# at move_ship(xposition,yposition,next_xposition,next_yposition,0.1)
# xanchor 0.5
# yanchor 0.5
# size (20/zoomlevel)
# outlines [(1,'000',0,0)]
##targeting window##
##if targeting mode is active show a targeting window over all enemy_ships that gives you chance to hit and other data
if BM.weaponhover != None or BM.targetingmode and BM.selected != None:
$ selected = BM.selected
for ship in BM.ships:
if ship.location != None:
if BM.weaponhover == None:
$BM.weaponhover = BM.active_weapon
if BM.weaponhover.wtype == 'Support' and (ship.faction != 'Player' or BM.weaponhover.self_buff == True):
$continue
if BM.weaponhover.wtype != 'Support' and ship.faction == 'Player':
$continue
if BM.weaponhover.wtype == 'Melee' and (ship.stype != 'Ryder' or get_ship_distance(ship,selected) > 1):
$continue
if BM.weaponhover.name == 'Gravity Gun' and ship.stype != 'Ryder':
$continue
$xposition = dispx(ship.location[0],ship.location[1],zoomlevel,0.75 * ADJX) + int(zoomlevel * MOVX)
$yposition = dispy(ship.location[0],ship.location[1],zoomlevel,0.15 * ADJY) + int(zoomlevel * MOVY)
add 'Battle UI/targeting_window.png':
xpos xposition
ypos yposition
xanchor 0.5
yanchor 0.5
zoom (zoomlevel/1.3)
$xposition = dispx(ship.location[0],ship.location[1],zoomlevel,.92 * ADJX) + int(zoomlevel * MOVX)
$yposition = dispy(ship.location[0],ship.location[1],zoomlevel,.20 * ADJY) + int(zoomlevel * MOVY)
text (str(ship.cth) + '%'):
xpos xposition
ypos yposition
xanchor 0.5
yanchor 0.5
size (20 * zoomlevel)
color '000'
$xposition = dispx(ship.location[0],ship.location[1],zoomlevel,0.75 * ADJX) + int(zoomlevel * MOVX)
$yposition = dispy(ship.location[0],ship.location[1],zoomlevel,0.40 * ADJY) + int(zoomlevel * MOVY)
if selected == None: #workarounds
$ effective_flak = 0
else:
if BM.weaponhover.wtype == 'Rocket':
#this looks double but missile_eccm is from a ship through upgrades whereas weaponhover.eccm is rom the rocket itself. (default 10)
$effective_flak = ship.flak + ship.modifiers['flak'][0] - selected.missile_eccm - BM.weaponhover.eccm
else:
$effective_flak = ship.flak + ship.modifiers['flak'][0] - selected.missile_eccm
if effective_flak < 0:
$ effective_flak = 0
elif effective_flak > 100:
$ effective_flak = 100
text str(effective_flak):
xpos xposition
ypos yposition
xanchor 1.0
yanchor 0.5
size (14 * zoomlevel)
color 'fff'
$xposition = dispx(ship.location[0],ship.location[1],zoomlevel,.92 * ADJX) + int(zoomlevel * MOVX)
$yposition = dispy(ship.location[0],ship.location[1],zoomlevel,.40 * ADJY) + int(zoomlevel * MOVY)
text str(ship.shields):
xpos xposition
ypos yposition
xanchor 1.0
yanchor 0.5
size (14 * zoomlevel)
color 'fff'
$xposition = dispx(ship.location[0],ship.location[1],zoomlevel,1.0 * ADJX) + int(zoomlevel * MOVX)
$yposition = dispy(ship.location[0],ship.location[1],zoomlevel,0.4 * ADJY) + int(zoomlevel * MOVY)
##when you hover over a weapon that does kinetic or assault type damage it shows you armor is double as effective
if BM.weaponhover == None:
$weapon = BM.active_weapon
else:
$weapon = BM.weaponhover
if weapon.wtype == 'Kinetic' or weapon.wtype == 'Assault':
text (str(ship.armor) + 'x2'):
xpos xposition
ypos yposition
xanchor 0.0
yanchor 0.5
size (12 * zoomlevel)
color 'fff'
else:
text str(ship.armor):
xpos xposition
ypos yposition
xanchor 0.0
yanchor 0.5
size (14 * zoomlevel)
color 'fff'
#when you hover over an emeny ship the HP bar and HP text will overlay again on top of other ships.
if BM.hovered != None: #when you hover over a ship
$ hovered_ship = BM.hovered
if hovered_ship.location == None:
$ pass
elif hovered_ship.faction != 'Player':
$xposition = dispx(hovered_ship.location[0],hovered_ship.location[1],zoomlevel,0.09 * ADJX) + int(zoomlevel * MOVX)
$yposition = dispy(hovered_ship.location[0],hovered_ship.location[1],zoomlevel,0.70 * ADJY) + int(zoomlevel * MOVY)
$hp_size = int(405*(float(BM.hovered.hp)/BM.hovered.max_hp))
add 'Battle UI/label hp bar.png':
xpos xposition
ypos yposition
zoom (zoomlevel/2.5)
crop (0,0,hp_size,90)
text str(BM.hovered.hp):
xanchor 0.5
yanchor 0.5
xpos int(xposition+80*zoomlevel)
ypos int(yposition+27*zoomlevel)
size int(16*zoomlevel)
font "Font/sui generis rg.ttf"
outlines [(2,'000',0,0)]
##DISPLAY MOVEMENT OPTIONS##
if BM.selectedmode and BM.selected.faction == 'Player' and not BM.targetingmode:
for tile in BM.selected.movement_tiles:
# imagebutton:
# at movebutton
# idle 'Battle UI/move_tile.png'
# hover 'Battle UI/move_tile.png'
# xanchor 0.5
# yanchor 0.5
# xpos tile[0]
# ypos tile[1]
# action Return(['move',(tile[3],tile[4])])
# alternate Return("deselect")
$ lbl = 'Battle UI/move_tile.png'
$ tile_location = (tile[3],tile[4])
if tile_location == BM.mouse_location:
$ lbl = hoverglow(lbl)
add lbl:
zoom (0.2 * zoomlevel)
alpha 0.5
xanchor 0.5
yanchor 0.5
xpos tile[0]
ypos tile[1]
text (str(BM.selected.move_cost*tile[2]) + ' EN'):
xpos tile[0]
ypos tile[1]
xanchor 0.5
yanchor 0.5
size (20 * zoomlevel)
outlines [(2,'000',0,0)]
#firing the vanguard cannon [[doesn't seem to be used any more]]
if BM.vanguard:
$xposition = dispx(sunrider.locatio[0],sunrider.location[1],zoomlevel,0.5 * ADJX) + int(zoomlevel * MOVX)
$yposition = dispy(sunrider.locatio[0],sunrider.location[1],zoomlevel) + int(zoomlevel * MOVY)
add 'Battle UI/vanguard beam wave.png':
xanchor 0.0
yanchor 0.27
xpos int(xposition+100/zoomlevel)
ypos yposition
size (int(1344/zoomlevel),int(120/zoomlevel))
at vanguard_cannon
alpha 1.0
#selecting target for vanguard cannon
if BM.vanguardtarget: #creates buttons over enemy ships
#for ship in BM.ships:
#if get_distance(sunrider.location,ship.location) <= 6 and ship.faction != 'Player':
#$xposition = dispx(ship.location[0],ship.location[1],zoomlevel,0.5 * ADJX) + int(zoomlevel * MOVX)
#$yposition = dispy(ship.location[0],ship.location[1],zoomlevel,0.5 * ADJY) + int(zoomlevel * MOVY)
#imagebutton:
# at movebutton
#idle 'Battle UI/move_tile.png'
#hover 'Battle UI/move_tile.png'
#xanchor 0.5
#yanchor 0.5
#xpos xposition
#ypos yposition
#action Return(['vanguardtarget',(ship.location[0],ship.location[1])])
#alternate Return("deselect")
#text (str(ship.location[0]) + ',' + str(ship.location[1])): #printed the x,y coordiantes for debugging purposes
# xpos xposition
# ypos yposition
# xanchor 0.5
# yanchor 0.5
# size (20 * zoomlevel)
# outlines [(2,'000',0,0)]
if not BM.hovered == None: #displayes red tiles on location affected by vanguard
$ hovered_ship = BM.hovered
if hovered_ship.location == None:
$ pass
elif hovered_ship.faction != 'Player':
$loc1 = sunrider.location
$loc2 = hovered_ship.location
if get_distance(loc1, loc2) <= 6:
$tiles = interpolate_hex(loc1, loc2)
for i in tiles:
$xposition = dispx(i[0],i[1],zoomlevel)
$yposition = dispy(i[0],i[1],zoomlevel)
$xsize = int((HEXW + 4) * zoomlevel)
$ysize = int((HEXH + 4) * zoomlevel)
add "Battle UI/vanguard hex.png":
xpos xposition
ypos yposition
size (xsize,ysize)
alpha 0.7
#the Sunrider warps from one cell to another
if BM.warping:
for location in store.flash_locations:
$xposition = dispx(location[0],location[1],zoomlevel) + int(zoomlevel * MOVX)
$yposition = dispy(location[0],location[1],zoomlevel,-0.5 * ADJY) + int(zoomlevel * MOVY)
add 'Battle UI/label_warpflash.png':
# anchor 0.5 #I get a float object not iterable crash. very annoying
xpos xposition
ypos yposition
at warpout
zoom 0.25 * zoomlevel
##MOVE SHIP FROM GRID TO GRID##
if BM.moving:
$xposition = dispx(BM.selected.current_location[0],BM.selected.current_location[1],zoomlevel,0.50 * ADJX) + int(zoomlevel * MOVX)
$yposition = dispy(BM.selected.current_location[0],BM.selected.current_location[1],zoomlevel,0.25 * ADJY) + int(zoomlevel * MOVY)
$next_xposition = dispx(BM.selected.next_location[0],BM.selected.next_location[1],zoomlevel,0.50 * ADJX) + int(zoomlevel * MOVX)
$next_yposition = dispy(BM.selected.next_location[0],BM.selected.next_location[1],zoomlevel,0.25 * ADJY) + int(zoomlevel * MOVY)
$travel_time = BM.selected.travel_time
add BM.selected.lbl:
at move_ship(xposition,yposition,next_xposition,next_yposition,travel_time)
xanchor 0.5
yanchor 0.5
zoom (zoomlevel/2.5)
if BM.debugoverlay: #may use this later for AI debug things too
for a in range(1,GRID_SIZE[0]+1): #cycle through rows
for b in range(1,GRID_SIZE[1]+1): #cycle through columns
$xposition = dispx(a,b,zoomlevel,0.5 * ADJX) + int(zoomlevel * MOVX)
$yposition = dispy(a,b,zoomlevel,0.5 * ADJY) + int(zoomlevel * MOVY)
text '{}/{}'.format(a,b):
xanchor 0.5
yanchor 0.5
xpos xposition
ypos yposition
##not part of the viewport##
if config.developer:
vbox:
ypos 100
xalign 1.0
textbutton "Debug Cheats" action Return('cheat')
textbutton "Fast Quit" xalign 1.0 action Jump('quit')
if BM.debugoverlay:
textbutton "coord overlay" xalign 1.0 action SetField(BM,'debugoverlay',False)
else:
textbutton "coord overlay" xalign 1.0 action SetField(BM,'debugoverlay',True)
if BM.show_grid:
textbutton "regular grid" xalign 1.0 action SetField(BM,'show_grid',False)
else:
textbutton "new grid" xalign 1.0 action SetField(BM,'show_grid',True)
vbox:
xalign 1.0
if BM.edgescroll == (0,0):
textbutton "enable edgescroll" action SetField(BM,'edgescroll',(100,800*zoomlevel))
else:
textbutton "disable edgescroll" action SetField(BM,'edgescroll',(0,0))
if BM.show_tooltips:
textbutton "disable tooltips" xalign 1.0 action SetField(BM,'show_tooltips',False)
else:
textbutton "enable tooltips" xalign 1.0 action SetField(BM,'show_tooltips',True)
textbutton "restart turn" xalign 1.0 action Jump('restartturn')
if BM.just_moved:
textbutton 'cancel movement':
ypos 70
text_size 50
text_color 'fff'
action Return('cancel movement')
if not BM.showing_orders and not BM.order_used and not BM.missile_moving and not BM.moving and BM.phase == "Player":
imagebutton:
xpos 0
ypos 0
idle 'Battle UI/commandbar.png'
hover hoverglow('Battle UI/commandbar.png')
action [SetField(BM,'showing_orders',True),Show('orders')]
text '{!s}'.format(BM.cmd):
xanchor 1.0
xpos 165
ypos 10
size 30
color 'fff'
outlines [(1,'000',0,0)]
if BM.phase == 'Player':
$endturnbutton_idle = im.MatrixColor('Battle UI/button_endturn.png',im.matrix.tint(0.6, 1.0, 0.5))
for ship in player_ships:
if ship.en >= ship.max_en:
$endturnbutton_idle = im.MatrixColor('Battle UI/button_endturn.png',im.matrix.tint(1.0, 0.6, 0.5))
imagebutton:
xpos 90
yalign 1.0
idle endturnbutton_idle
hover hoverglow(endturnbutton_idle)
action Return('endturn')
transform move_down(ystart,yend,xx=0):
xpos xx
ypos ystart
linear 0.5 ypos yend
on hide:
linear 0.5 ypos ystart
#not sure why this is needed. I'm calling bug in renpy
time 2
alpha 0
screen orders:
zorder 1
modal True
frame:
background 'Battle UI/commandbar_window.png'
at move_down(-590,0)
vbox:
spacing 20
for order in BM.orders:
button:
xpos 20
# insensitive_background im.MatrixColor('Battle UI/commandbar_button.png',im.matrix.brightness(-0.50))
idle_background 'Battle UI/commandbar_button.png'
hover_background hoverglow('Battle UI/commandbar_button.png')
action [Return(order),Hide('orders'),SetField(BM,'showing_orders',False),SetField(BM,'order_used',True)]
# action If(BM.cmd >= BM.orders[order][1],[Return(order),Hide('orders'),SetField(BM,'showing_orders',False)])
has hbox
text order:
ypos 5
min_width 300
size 22
outlines [(1,'222',0,0)]
text str(BM.orders[order][0]):
ypos 5
xpos 50
min_width 50
text_align 1.0
# first_indent 150
size 18
outlines [(1,'222',0,0)]
hbox:
if order == 'REPAIR DRONES':
if sunrider.repair_drones != None:
if sunrider.repair_drones == 0:
$colour = '900'
else:
$colour = '050'
text '[[' + str(sunrider.repair_drones) + ']':
ypos 5
first_indent -170
size 22
color colour
outlines [(1,colour,0,0)]
if order == 'FULL FORWARD' and BM.show_tooltips == True:
frame:
background Solid((0,0,0,200))
xpos 150
ycenter 20
text str('Provides +15 Aim and +20% damage to all allied units.'):
xpos 0
ypos 0
size 18
font "Font/sui generis rg.ttf"
outlines [(1,'000',0,0)]
if order == 'REPAIR DRONES' and BM.show_tooltips == True:
frame:
background Solid((0,0,0,200))
xpos 150
ycenter 20
text str('Restores 50% of the Sunrider\'s health.'):
xpos 0
ypos 0
size 18
font "Font/sui generis rg.ttf"
outlines [(1,'000',0,0)]
if order == 'VANGUARD CANNON' and BM.show_tooltips == True:
frame:
background Solid((0,0,0,200))
xpos 150
ycenter 20
text str('Deals 800 unavoidable damage to all units within a straight line within 7 tiles to the right of the Sunrider'):
xpos 0
ypos 0
size 18
font "Font/sui generis rg.ttf"
outlines [(1,'000',0,0)]
if order == 'SHORT RANGE WARP' and BM.show_tooltips == True:
frame:
background Solid((0,0,0,200))
xpos 150
ycenter 20
text str('Moves the Sunrider to any point on the map. Can be used with another Order.'):
xpos 0
ypos 0
size 18
font "Font/sui generis rg.ttf"
outlines [(1,'000',0,0)]
#I couldn't get the mouse detection working properly with the buttons. Sorry! :S
imagebutton:
at move_down(0,590)
idle 'Battle UI/commandbar.png'
hover hoverglow('Battle UI/commandbar.png')
action [Hide('orders'),SetField(BM,'showing_orders',False)]
text '{!s}'.format(BM.cmd):
xanchor 1.0
xpos 165
ypos 10
at move_down(10,600,165)
size 30
color 'fff'
outlines [(1,'000',0,0)]
screen commands: ##show the weapon buttons etc##
zorder 1 #always show on top of the battle screen
##show status window and it's data
if not BM.selected == None:
$ ship = BM.selected
add 'Battle UI/statuswindow.png' xalign 1.0 yalign 1.0
if not BM.selected.portrait == None:
add BM.selected.portrait xalign 1.0 yalign 1.0
else:
$ index = ''
if config.developer and BM.selected.faction != 'Player':
if BM.selected in enemy_ships:
$ index = ' ' + str(enemy_ships.index(BM.selected))
# text str(index) xanchor 1.0 xpos 1880 ypos 800 size 20 outlines [(1,'000',0,0)]
text (BM.selected.name + index) xanchor 1.0 xpos 1880 ypos 726 outlines [(1,'000',0,0)]
$hp_size = int(374*(float(BM.selected.hp)/BM.selected.max_hp))
$en_size = int(298*(float(BM.selected.en)/BM.selected.max_en))
add 'Battle UI/status window_HP.png' xpos 1080 ypos 779 crop (0,0,hp_size,49)
add 'Battle UI/status window_EN.png' xpos 1133 ypos 805 crop (0,0,en_size,19)
text (str(BM.selected.hp) + '/' + str(BM.selected.max_hp)) xanchor 0.5 xpos 1510 ypos 779 size 19 font "Font/sui generis rg.ttf" outlines [(1,'000',0,0)]
text (str(BM.selected.en) + '/' + str(BM.selected.max_en)) xanchor 0.5 xpos 1490 ypos 805 size 19 font "Font/sui generis rg.ttf" outlines [(1,'000',0,0)]
$effective_flak = ship.flak + ship.modifiers['flak'][0]
if effective_flak < 0:
$ effective_flak = 0
elif effective_flak > 100:
$ effective_flak = 100
text (str(effective_flak)) xanchor 1.0 xpos 1149 ypos 847 size 24 font "Font/sui generis rg.ttf" outlines [(1,'000',0,0)]
text (str(BM.selected.shields)) xanchor 1.0 xpos 1149 ypos 897 size 24 font "Font/sui generis rg.ttf" outlines [(1,BM.selected.shield_color,0,0)]
text (str(BM.selected.armor)) xanchor 1.0 xpos 1149 ypos 947 size 24 font "Font/sui generis rg.ttf" outlines [(1,BM.selected.armor_color,0,0)]
text (str(BM.selected.evasion)) xanchor 1.0 xpos 1149 ypos 997 size 24 font "Font/sui generis rg.ttf" outlines [(1,'000',0,0)]
##show weapon stats in status window on hover
if not BM.weaponhover == None or not BM.active_weapon == None:
if BM.weaponhover == None:
$weapon = BM.active_weapon
else:
$weapon = BM.weaponhover
text (str(real_damage(weapon,ship))) xanchor 1.0 xpos 1380 ypos 840 size 24 font "Font/sui generis rg.ttf" outlines [(1,'000',0,0)]
text (str(real_damage(weapon,ship)*weapon.shot_count)) xanchor 1.0 xpos 1380 ypos 870 size 24 font "Font/sui generis rg.ttf" outlines [(1,'000',0,0)]
text (str(weapon.shot_count)) xanchor 1.0 xpos 1515 ypos 840 size 24 font "Font/sui generis rg.ttf" outlines [(1,'000',0,0)]
##show buffs
$count = 0
for modifier in BM.selected.modifiers:
if BM.selected.modifiers[modifier][0] != 0:
text modifier xpos 1217 ypos (922+count*24) size 20 outlines [(1,'000',0,0)]
if BM.selected.modifiers[modifier][0] > 0:
$ status_effect = '+{}% for {} turns'.format(BM.selected.modifiers[modifier][0],BM.selected.modifiers[modifier][1])
else:
$ status_effect = '{}% for {} turns'.format(BM.selected.modifiers[modifier][0],BM.selected.modifiers[modifier][1])
text status_effect xanchor 1.0 xpos 1554 ypos (922+count*24) size 19 outlines [(1,'000',0,0)]