-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main_Game.py
2242 lines (1997 loc) · 97 KB
/
Main_Game.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
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
import collections
import random
from os import system, name
from time import sleep
import os
import sys
import time
############################
##### GLOBAL FUNCTIONS #####
############################
def ClearScreen():
# for windows
if name == 'nt':
_ = system('cls')
# for mac and linux(here, os.name is 'posix')
else:
_ = system('clear')
def PressEnterToContinue():
GMtalk.write ("\nPress Enter to continue")
input()
ClearScreen()
def PressEnterToGoBack():
GMtalk.write ("\nPress Enter to go back")
input()
ClearScreen()
def InvalidChoice():
GMtalk.write ("That won't work here... you'll have to try something else.")
PressEnterToGoBack()
def CountDown():
timer = 3
while timer > 0:
GMtalk.write(f"{timer}...")
timer -= 1
sleep(1)
ClearScreen()
##################################
##################################
##### SECTION - USABLE MOVES #####
##################################
##################################
# THIS SECTION IS FOR USABLE MOVES BY THE PLAYER AND ENEMIES - IT'S UP AT THE TOP BECAUSE CHARACTERS AND WEAPON ITEMS WON'T INITIALISE UNLESS THESE COME FIRST
# ABILITY CLASS ALLOWS FOR CREATION OF ABILITY OBJECTS THAT WILL BE HELD WITHIN WEAPON OBJECTS WHICH ALLOWS DYNAMIC ABILITY SWAPPING.
class Ability:
def __init__(self, name, effect, damage, rounds, apcost, chancetomiss):
self.name = name
self.effect = effect
self.damage = damage
self.apcost = apcost
self.rounds = rounds
self.chancetomiss = chancetomiss
def __repr__(self):
if self.rounds > 1:
return (f'''{self.name} - can hit {self.rounds} times.\n AP: {self.apcost}''')
else:
return (f'''{self.name} \n AP: {self.apcost}''')
class AbilityEffects(Ability):
def PhysicalDamage():
totaleffect = (BattleSystem.movechoice.damage + BattleSystem.currentplayer.phystr - BattleSystem.selectedtarget.phydef)
BattleSystem.selectedtarget.hp -= totaleffect
GMnarrate.write (f"{BattleSystem.currentplayer.name} used {BattleSystem.movechoice.name} for {totaleffect} damage")
def ArmatekDamage():
totaleffect = (BattleSystem.movechoice.damage + BattleSystem.currentplayer.armstr - BattleSystem.selectedtarget.armdef)
BattleSystem.selectedtarget.hp -= totaleffect
GMnarrate.write (f"{BattleSystem.currentplayer.name} used {BattleSystem.movechoice.name} for {totaleffect} damage")
def Scan():
BattleSystem.selectedtarget.ShowCurrentStats()
def Legendary():
totaleffect = ((BattleSystem.currentplayer.phystr + BattleSystem.currentplayer.armstr) * 2) * 10
GMnarrate.write (f"{BattleSystem.currentplayer.name} used {BattleSystem.movechoice.name} for {totaleffect} damage")
##################
# STANDARD MOVES #
##################
# CONTAINS ALL AVAILABLE FUNCTIONS FOR ABILITIES TO SAVE MEMORY
AbilityEffectsList = AbilityEffects
# ABILITIES ARE SHARED BETWEEN PLAYER AND ENEMY CHARACTERS. PLAYER ABIILITIES ARE EQUIPPED THROUGH WEAPONS, ENEMIES CAN JUST DO THEM.
Attack = Ability ("Attack", AbilityEffectsList.PhysicalDamage, 20, 1, 0, 10)
Punches = Ability ("Punches", AbilityEffectsList.PhysicalDamage, 15, 3, 15, 30)
Lunge = Ability ("Lunge", AbilityEffectsList.PhysicalDamage, 30, 1, 5, 20)
KnifeCuts = Ability ("Knife Cuts", AbilityEffectsList.PhysicalDamage, 25, 2, 10, 30)
AnchorStrike = Ability ("Anchor Strike", AbilityEffectsList.PhysicalDamage, 15, 1, 15, 15)
PistolShot = Ability ("Pistol Shot", AbilityEffectsList.PhysicalDamage, 60, 1, 10, 10)
VibraSwordSlice = Ability ("VibraSword Slice", AbilityEffectsList.PhysicalDamage, 40, 1, 20, 10)
VibraSwordSlashes = Ability ("VibraSword Slashes", AbilityEffectsList.PhysicalDamage, 25, 3, 30, 20)
LoaderFist = Ability ("Loader Fist", AbilityEffectsList.PhysicalDamage, 25, 2,25, 30)
ArmaScopeShot = Ability ("ArmaScope Shot", AbilityEffectsList.ArmatekDamage, 50, 1, 15, 5)
ArmaFist = Ability ("Arma Fist", AbilityEffectsList.ArmatekDamage, 30, 2, 20, 10)
ArmaMechArmLow = Ability ("Pneumatic Fist", AbilityEffectsList.PhysicalDamage, 40, 1, 0, 10)
ArmaMechArmHigh = Ability ("Grand Slam", AbilityEffectsList.PhysicalDamage, 30, 2, 0, 20)
ArmaMechChestLow = Ability ("Arma Beam Blast", AbilityEffectsList.ArmatekDamage, 200, 1, 0, 50)
ArmaMechChestHigh = Ability ("Arma Beam Bomb", AbilityEffectsList.ArmatekDamage, 150, 1, 0, 50)
#################
# ARMATEK MOVES #
#################
# LIMIT BREAK IS FOR PLAYER ONLY, REPLACES STANDARD ATTACK WHEN HEALTH IS LOW
LimitBreak = Ability ("Limit Break", AbilityEffectsList.Legendary, 10, 1,0, 0)
# FAR LESS USEFUL THAN I'D LIKE... I SHOULD HAVE DONE SOME SORT OF SPECIAL ABILITIES SYSTEM WHERE WEAPON ABILTIES ARE EQUIPPED WITH WEAPONS AND ARMATEK ABILITES ARE ACQUIRED... MAYBE IN THE NEXT EDITION.
Scan = Ability ("Scan", AbilityEffectsList.Scan, 0, 1,5, 0)
################################################
################################################
##### SECTION - USABLE ITEMS AND EQUIPMENT #####
################################################
################################################
class Item:
def __init__(self, name, effect, action, actionlevel, damage, hits, value):
self.name = name
self.effect = effect
self.action = action
self.actionlevel = actionlevel
self.damage = damage
self.hits = hits
self.value = value
self.totaleffect = self.actionlevel * self.damage
def __repr__(self):
return (f"{self.name} - {self.effect} effect for {self.damage} points")
class ItemEffects(Item):
def HPBuff():
if ConsumableSystem.selectedtarget.hp == ConsumableSystem.selectedtarget.hpmax:
GMtalk.write(f"{ConsumableSystem.selectedtarget.name} is already at full health!")
PressEnterToGoBack()
ConsumableSystem.ShowConsumables()
else:
pass
ConsumableSystem.selectedtarget.hp += ConsumableSystem.selectedconsumable.totaleffect
if ConsumableSystem.selectedtarget.hp > ConsumableSystem.selectedtarget.hpmax:
ConsumableSystem.selectedtarget.hp = ConsumableSystem.selectedtarget.hpmax
else:
pass
GMnarrate.write(f"{ConsumableSystem.selectedtarget.name} HP raised to {ConsumableSystem.selectedtarget.hp}")
def APBuff():
if ConsumableSystem.selectedtarget.ap == ConsumableSystem.selectedtarget.apmax:
GMtalk.write(f"{ConsumableSystem.selectedtarget.name} is already at full health!")
else:
pass
ConsumableSystem.selectedtarget.ap += ConsumableSystem.selectedconsumable.totaleffect
if ConsumableSystem.selectedtarget.ap > ConsumableSystem.selectedtarget.apmax:
ConsumableSystem.selectedtarget.ap = ConsumableSystem.selectedtarget.apmax
else:
pass
GMnarrate.write(f"{ConsumableSystem.selectedtarget.name} AP raised to {ConsumableSystem.selectedtarget.ap}")
def PhysicalDamage():
BattleSystem.selectedtarget.hp -= (ConsumableSystem.selectedconsumable.totaleffect - BattleSystem.selectedtarget.phydef)
GMnarrate.write(f"{ConsumableSystem.selectedconsumable.name} used on {BattleSystem.selectedtarget.name} to cause {ConsumableSystem.selectedconsumable.totaleffect} damage.")
def ArmatekDamage():
BattleSystem.selectedtarget.hp -= (ConsumableSystem.selectedconsumable.totaleffect - BattleSystem.selectedtarget.armdef)
GMnarrate.write(f"{ConsumableSystem.selectedconsumable.name} used on {BattleSystem.selectedtarget.name} to cause {ConsumableSystem.selectedconsumable.totaleffect} damage.")
def PhyDefBuff():
BattleSystem.selectedtarget.phydef += (ConsumableSystem.selectedconsumable.totaleffect)
GMnarrate.write(f"{ConsumableSystem.selectedconsumable.name} used on {BattleSystem.selectedtarget.name}. Permanently raised Physical Defense to {BattleSystem.selectedtarget.phydef}.")
def PhyStrBuff():
BattleSystem.selectedtarget.phystr += (ConsumableSystem.selectedconsumable.totaleffect)
GMnarrate.write(f"{ConsumableSystem.selectedconsumable.name} used on {BattleSystem.selectedtarget.name}. Permanently raised Physical Strength to {BattleSystem.selectedtarget.phystr}.")
def ArmDefBuff():
BattleSystem.selectedtarget.armdef += (ConsumableSystem.selectedconsumable.totaleffect)
GMnarrate.write(f"{ConsumableSystem.selectedconsumable.name} used on {BattleSystem.selectedtarget.name}. Permanently raised Armatek Defense to {BattleSystem.selectedtarget.armdef}.")
def ArmStrBuff():
BattleSystem.selectedtarget.armstr += (ConsumableSystem.selectedconsumable.totaleffect)
GMnarrate.write(f"{ConsumableSystem.selectedconsumable.name} used on {BattleSystem.selectedtarget.name}. Permanently raised Armatek Strength to {BattleSystem.selectedtarget.armstr}.")
class Weapon:
def __init__(self, name, effect, damage, special, value):
self.name = name
self.effect = effect
self.damage = damage
self.special = special
self.value = value
def __repr__(self):
if self.special == "":
return (f"{self.name} - {self.effect} weapon for {self.damage} points.")
else:
return (f"{self.name} - {self.effect} weapon for {self.damage} points. Gives abiility: {self.special.name} for {self.special.apcost} AP cost.")
class Armatek:
def __init__(self, name, effect, damage, special, value):
self.name = name
self.effect = effect
self.damage = damage
self.special = special
self.value = value
def __repr__(self):
if self.special == "":
return (f"{self.name} - {self.effect} weapon for {self.damage} points.")
else:
return (f"{self.name} - {self.effect} weapon for {self.damage} points. Gives abiility: {self.special.name} for {self.special.apcost} AP cost.")
# DEFENSIVE / BUFFS
# THIS OBJECT HOLDS ALL AVAILABLE ITEM EFFECT FUNCTIONS
ItemEffectsList = ItemEffects
##############
# BUFF ITEMS #
##############
HPup1 = Item ("Field Dressing", "HP Buff", ItemEffectsList.HPBuff, 1, 30, 1, 20)
HPup2 = Item ("Medkit", "HP Buff", ItemEffectsList.HPBuff, 2, 30, 1, 40)
HPup3 = Item ("Doctor's Kit", "HP Buff", ItemEffectsList.HPBuff, 3, 30, 1, 60)
APup1 = Item ("Adreno Shot", "AP Buff", ItemEffectsList.APBuff, 1, 20, 1, 20)
APup2 = Item ("Hi Adreno Shot", "AP Buff", ItemEffectsList.APBuff, 2, 20, 1, 20)
APup3 = Item ("Mega Adreno Shot", "AP Buff", ItemEffectsList.APBuff, 3, 20, 1, 60)
DefBooster = Item ("PhyDef Booster", "Physical Defense Buff", ItemEffectsList.PhyDefBuff, 1, 20, 1, 200)
StrBooster = Item ("PhyStr Booster", "Physical Strength Buff", ItemEffectsList.PhyStrBuff, 1, 20, 1, 200)
ArmDefBooster = Item ("ArmDef Booster", "Armatek Defense Buff", ItemEffectsList.ArmDefBuff, 1, 20, 1, 200)
ArmStrBooster = Item ("ArmStr Booster", "Armatek Strength Buff", ItemEffectsList.ArmStrBuff, 1, 20, 1, 200)
################
# DEBUFF ITEMS #
################
Grenade = Item ("Grenade", "Physical Damage", ItemEffectsList.PhysicalDamage, 1, 200, 1, 50)
Grenade2 = Item ("Hi Grenade", "Physical Damage", ItemEffectsList.PhysicalDamage, 1, 375, 1, 75)
Grenade3 = Item ("Mega Grenade", "Physical Damage", ItemEffectsList.PhysicalDamage, 1, 500, 1, 100)
ArmaGrenade = Item ("Arma Grenade", "Armatek Damage", ItemEffectsList.ArmatekDamage, 1, 200, 1, 50 )
ArmaGrenade2 = Item ("Hi Arma Grenade", "Armatek Damage", ItemEffectsList.ArmatekDamage, 1, 375, 1, 75 )
ArmaGrenade3 = Item ("Mega Arma Grenade", "Armatek Damage", ItemEffectsList.ArmatekDamage, 1, 500, 1, 100 )
###########
# WEAPONS #
###########
BareKnuckles = Weapon ("Bare Knuckles", "Physical", 10, Punches, 0)
Knife = Weapon ("Knife", "Physical", 15, KnifeCuts, 0)
Pistol = Weapon ("Pistol", "Physical", 50, PistolShot, 150)
###########
# ARMATEK #
###########
ScanningGlove = Armatek ("Scanning Glove", "Armatek", 0, Scan, 100)
ArmaGauntlet = Armatek ("Mecha Gauntlet", "Armatek", 18, ArmaFist, 100)
ArmaRifle = Armatek ("Arma Rifle", "Armatek", 30, ArmaScopeShot, 100)
NanoTransfuser = Armatek ("Nano Transfuser", "Armatek", 0, "", 100)
################################
################################
##### SECTION - CHARACTERS #####
################################
################################
# MAIN CHARACTER CLASS WITH VARIABLES NECESSARY FOR ALL CHARACTERS
class Character:
def __init__(self, name):
self.name = name
if self.name != "":
self.items = collections.Counter()
job = ""
credits = ""
hpmax = ""
hp = ""
apmax = ""
mp = apmax
phystr = ""
phydef = ""
armstr = ""
armdef = ""
phyweapons = []
physequip = []
armweapons = []
armequip = []
moveset = []
menuselect = ""
movechoice = ""
selectedtarget = ""
def MenuSelection(self):
print()
self.menuselect = (input())
try:
self.menuselectint = int(self.menuselect)
except ValueError:
self.menuselectint = 0
print()
# PLAYER CHARACTER SUBCLASS IS CONTROLLABLE BY THE PLAYER
class Player(Character):
def __init__(self, name):
self.name = name
if self.name == "Player":
self.currentlocation = ""
self.holdlocation = ""
self.lastlocation = ""
self.activecombat = False
self.combatarea = ""
self.credits = 200
self.job = ""
self.hpmax = 500
self.hp = 500
self.apmax = 200
self.ap = 200
self.phystr = 10
self.phydef = 10
self.armstr = 10
self.armdef = 10
self.phyweapons = []
self.physequip = [BareKnuckles]
self.armweapons = []
self.armequip = []
self.items = collections.Counter()
self.moveset = [Attack,Punches,"-"]
self.arenawins = 0
self.arenaroundcomplete = False
self.handholding = ""
self.equipmenttutorial = False
self.statstutorial = False
self.itemstutorial = False
self.combattutorial = False
def Naming(self):
PlayerInput.write("Enter your name: \n")
self.name = str(input())
if self.name == "":
self.Naming()
else:
pass
def ClassChoice(self):
GMtalk.write ('''
Different roles will affect your how strong your Physical and Armatek abilities are, and how well you can defend against them.
The damage you deal and receive will be influenced by these stats.
Remember, your enemies will have strengths and weaknesses too!
''')
PlayerInput.write ('''
What was your role in the military? Enter a role number to view it's stats.
1: Soldier
2: Scientist
3: Medic
4: Officer''')
DecisionMaker.MenuSelection()
if DecisionMaker.menuselect == "1":
self.job = "Soldier"
GMnarrate.write ("A former Soldier, you fought in the Alliance Army as a Shock Trooper.The Army's excellent training has given you great strength when fighting. \n")
GMtalk.write ("Your stats will be: \n13 Physical Strength \n10 Physical Defense \n10 Armatek Strength \n8 Armatek Defense")
self.ClassChoiceConfirm()
elif DecisionMaker.menuselect == "2":
self.job = "Scientist"
GMnarrate.write ("A former Scientist, you designed weaponry to be used against the enemy. \nYour knowledge of Armatek gives you an advantage when using Armatek equipment. \n")
GMtalk.write ("Your stats will be: \n10 Physical Strength \n8 Physical Defense \n13 Armatek Strength \n10 Armatek Defense")
self.ClassChoiceConfirm()
elif DecisionMaker.menuselect == "3":
self.job = "Medic"
GMnarrate.write ("A former Medic you served and saved alongside you soldier brothers.Your hardiness earned in battle has given you stronger physical defense. \n")
GMtalk.write ("Your stats will be: \n8 Physical Strength \n13 Physical Defense \n10 Armatek Strength \n10 Armatek Defense")
self.ClassChoiceConfirm()
elif DecisionMaker.menuselect == "4":
self.job = "Officer"
GMnarrate.write ("A former Officer in the Alliance Navy, you commanded SkyCruiser fleets against the Commonwealth. Your officer's training gave you increased defense against Armatek abilities. \n")
GMtalk.write ("Your stats will be: \n10 Physical Strength \n10 Physical Defense \n8 Armatek Strength \n13 Armatek Defense")
self.ClassChoiceConfirm()
def ClassChoiceConfirm(self):
PlayerInput.write ('''
Would you like to select this class, or view another?
1: Select Role
2: Go Back to select another Role''')
DecisionMaker.MenuSelection()
if DecisionMaker.menuselect == "1":
if self.job == "Soldier":
self.phystr = 13
self.armdef = 8
elif self.job == "Scientist":
self.phydef = 8
self.armstr = 13
elif self.job == "Medic":
self.phydef = 13
self.phystr = 8
elif self.job == "Officer":
self.armdef = 13
self.armstr = 8
else:
pass
elif DecisionMaker.menuselect == "2":
GMtalk.write ("Okay, this section of the tutorial will restart so you can choose another class.")
PressEnterToGoBack()
MainCharacter.ClassChoice()
else:
GMtalk.write ("Please enter the number of your selection")
MainCharacter.ClassChoiceConfirm()
# NON COMBAT EQUIPMENT FUNCTIONS
def ShowStats(self):
ClearScreen()
if MainCharacter.handholding == True and MainCharacter.statstutorial == False:
MainCharacter.statstutorial = True
GMtalk.write('''
Here you can view your stats and how many credits you have.
Remember, there will be items you can acquire in the world to improve these stats...
''')
MenuTitle.write("Credits:")
GMtalk.write(f"{MainCharacter.credits} \n")
for elem in BattleSystem.party:
MenuTitle.write(f"{elem.name} Vitals:")
#for health
if elem.hp > (elem.hpmax /100 * 25):
print (f' {type.fg_silver}HP:{type.reset} {type.fg_green}{elem.hp}/{elem.hpmax}{type.reset}')
elif elem.hp <= (elem.hpmax /100 * 25):
print (f' {type.fg_silver}HP:{type.reset} {type.fg_red}{elem.hp}{type.reset}/{type.fg_green}{elem.hpmax}{type.reset}')
#for ap
if elem.ap > (elem.apmax /100 * 25):
print (f' {type.fg_silver}MP:{type.reset} {type.fg_green}{elem.ap}/{elem.apmax}{type.reset}')
elif elem.ap <= (elem.apmax /100 *25):
print (f' {type.fg_silver}MP:{type.reset} {type.fg_red}{elem.ap}{type.reset}/{type.fg_green}{elem.apmax}{type.reset}\n')
print()
MenuTitle.write(f"{elem.name} Stats:")
GMtalk.write(f" Physical Strength: {elem.phystr}")
GMtalk.write(f" Physical Defense: {elem.phydef}")
GMtalk.write(f" Armatek Strength: {elem.armstr}")
GMtalk.write(f" Armatek Defense: {elem.armdef}")
def ShowWeapons(self):
ClearScreen()
if MainCharacter.handholding == True and MainCharacter.equipmenttutorial == False:
GMtalk.write ('''
Welcome to the Equipment screen. From here, you will be able to view and change your equipped items.
Items that you equip will change your abilities in combat.
You'll be able to see what the ability is and how much AP it costs when viewing the items.
Selecting menu items here works the same as everywhere else.
''')
MainCharacter.equipmenttutorial = True
else:pass
MenuTitle.write ("Equipment Menu: \n")
MenuTitle.write("Physical Weapon:")
if len(self.physequip) == 0:
GMtalk.write("You do not have a weapon equipped. \n")
else:
GMtalk.write(f"{self.physequip[0]} \n")
MenuTitle.write("Armatek Gear")
if len(self.armequip) == 0:
GMtalk.write("You do not have any gear equipped. \n")
else:
GMtalk.write(f"{self.armequip[0]} \n")
self.ChangeEquipment()
def ChangeEquipment(self):
GMtalk.write("Would you like to change any of your current equipment?")
PlayerInput.write ("1: Yes \n2: No")
DecisionMaker.MenuSelection()
if DecisionMaker.menuselect == "1":
self.SelectEquipment()
elif DecisionMaker.menuselect == "2":
pass
else:
InvalidChoice()
self.ShowWeapons()
def SelectEquipment(self):
listorder = 0
GMtalk.write ("Select an equipment type to change")
PlayerInput.write("0: Cancel \n1: Physical Equipment \n2: Armatek")
DecisionMaker.MenuSelection()
if DecisionMaker.menuselect =="0":
pass
#if player selected physical weapons
elif DecisionMaker.menuselect == "1":
if len (self.phyweapons) == 0:
GMtalk.write( "You do not have another weapon to equip. \n")
PressEnterToGoBack()
self.ShowWeapons()
else:
GMtalk.write("Select a weapon to equip.")
for elem in self.phyweapons:
listorder += 1
PlayerInput.write(f"{listorder}: {elem}")
DecisionMaker.MenuSelection()
if DecisionMaker.menuselectint in range (1, listorder+1):
removeditem = self.physequip.pop (0)
# self.menuselect = int(self.menuselect)
selecteditem = self.phyweapons.pop (DecisionMaker.menuselectint-1)
self.phyweapons.append (removeditem)
self.physequip.append (selecteditem)
self.moveset[1] = self.physequip[0].special
GMtalk.write (f"You now have the {self.physequip[0].name} equipped. \nYou can now use the {self.moveset[1].name} ability!")
else:
InvalidChoice()
self.ShowWeapons()
#if player selected armatek
elif DecisionMaker.menuselect == "2":
if len (self.armweapons) == 0:
GMtalk.write("You do not have any Armatek Gear to equip")
PressEnterToGoBack()
self.ShowWeapons()
else:
GMtalk.write("Select gear to equip.")
for elem in self.armweapons:
listorder += 1
PlayerInput.write(f"{listorder}: {elem}")
DecisionMaker.MenuSelection()
if DecisionMaker.menuselectint in range (1,listorder+1):
if len (self.armequip) == 0:
# self.menuselect = int(self.menuselect)
selecteditem = self.armweapons.pop (DecisionMaker.menuselectint-1)
print (selecteditem.name)
self.armequip.append (selecteditem)
self.moveset[2] = self.armequip[0].special
GMtalk.write (f"You now have the {self.armequip[0].name} equipped. \nYou can now use the {self.moveset[2].name} ability!")
else:
removeditem = self.armequip.pop (0)
selecteditem = self.armweapons.pop (DecisionMaker.menuselectint-1)
self.armweapons.append (removeditem)
self.armequip.append (selecteditem)
self.moveset[2] = self.armequip[0].special
GMtalk.write (f"You now have the {self.armequip[0].name} equipped. \nYou can now use the {self.moveset[2].name} ability!")
else:
InvalidChoice()
self.ShowWeapons()
else:
InvalidChoice()
self.ShowWeapons()
# COMBAT ABILITY AND ITEM FUNCTIONS - ITEM FUNCTIONS ARE DESIGNED TO WORK INSIDE AND OUTSIDE OF COMBAT
def PlayerTurnDisplay(self):
if MainCharacter.handholding == True and MainCharacter.combattutorial == False:
MainCharacter.combattutorial = True
GMtalk.write(f'''
Welcome to combat, {MainCharacter.name}... select your moves and items in combat the same way you would anywhere else.''')
else:pass
MenuTitle.write("Your Turn: \n")
# for elem in BattleSystem.enemies:
# if elem.hp > (elem.hpmax /100 *70):
# GMnarrate.write("The foe stands strong! Don't give up! \n")
# elif elem.hp > (elem.hpmax /100 *30):
# GMnarrate.write("Your foe grows weaker! Keep it up! \n")
# elif elem.hp <= (elem.hpmax /100 *30):
# GMnarrate.write("Your enemy grows weak! Almost there! \n")
MenuTitle.write (f"{self.name}:")
if self.hp > (self.hpmax /100 * 25):
print (f' {type.fg_orange}HP:{type.reset} {type.fg_green}{self.hp}/{self.hpmax}{type.reset}')
elif self.hp <= (self.hpmax /100 * 25):
print (f' {type.fg_orange}HP:{type.reset} {type.fg_red}{self.hp}{type.reset}/{type.fg_green}{self.hpmax}{type.reset}')
if self.ap > (self.apmax /100 * 25):
print (f' {type.fg_orange}MP:{type.reset} {type.fg_green}{self.ap}/{self.apmax}{type.reset}')
elif self.ap <= (self.apmax /100 *25):
print (f' {type.fg_orange}MP:{type.reset} {type.fg_red}{self.ap}{type.reset}/{type.fg_green}{self.apmax}{type.reset}\n')
print()
self.PlayerSelectAbility()
def PlayerSelectAbility(self):
listmoves = 0 #to number the ability list dynamically
MenuTitle.write ("Select an option:")
#this bit swaps out the standard attack move in move slot 0 with LimtBreak when health is below 10%
if self.hp <= (self.hpmax/100*10):
self.moveset [0] = LimitBreak
else:
self.moveset [0] = Attack
# list the choices
for elem in self.moveset:
listmoves += 1
PlayerInput.write (f" {listmoves}: {elem} \n")
listmoves+=1
PlayerInput.write(f" {listmoves}: Items")
#get player selection
DecisionMaker.MenuSelection()
#check to see if selection is valid, then move to select the enemy
if DecisionMaker.menuselectint in range(1, listmoves+1):
if DecisionMaker.menuselectint == 4:
ConsumableSystem.ShowConsumables()
else:
self.PlayerSelectAbilityTarget()
else:
InvalidChoice()
BattleSystem.PlayerTurn()
def PlayerSelectAbilityTarget(self):
listofenemies = 0
#autoselect if there's only one enemy cos duh...
if len (BattleSystem.enemies) == 1:
BattleSystem.selectedtarget = BattleSystem.enemies[0]
self.PlayerSelectAbilityTargetConfirmed()
#if more than one, list and select in the same way as selecting an ability. Neat!
else:
GMtalk.write(f"Select an enemy to attack \n")
for elem in BattleSystem.enemies:
listofenemies += 1
PlayerInput.write (f" {listofenemies}: {elem.name}")
DecisionMaker.MenuSelection()
if DecisionMaker.menuselectint in range (1, listofenemies+1):
BattleSystem.selectedtarget = BattleSystem.enemies[DecisionMaker.menuselectint-1]
self.PlayerSelectAbilityTargetConfirmed()
else:
GMtalk.write ("Invalid Input")
self.PlayerSelectAbilityTarget()
def PlayerSelectAbilityTargetConfirmed(self):
BattleSystem.movechoice = self.moveset[DecisionMaker.menuselectint-1]
#accuracycheck checks against the misschance of the selected move.
if BattleSystem.movechoice == "-":
InvalidChoice()
BattleSystem.PlayerTurn()
else:
if BattleSystem.movechoice.apcost > self.ap:
GMtalk.write("You don't have enough AP for that right now!")
self.PlayerTurnDisplay()
else:
self.ap -= BattleSystem.movechoice.apcost
for i in range (1,BattleSystem.movechoice.rounds+1):
accuracycheck = random.randint (1,100)
if accuracycheck in range (BattleSystem.movechoice.chancetomiss): # so if the accuracycheck falls within the misschance of the selected move, it misses.
GMnarrate.write (f"You tried to use {BattleSystem.movechoice.name}, but missed! \n")
else: #otherwise, it hits and so determines how damage or buffs work here base on the selected move effect value
BattleSystem.movechoice.effect()
# elif selectedmove.effect == "Armatek":
# pass
# elif selectedmove.effect == "Scan":
# BattleSystem.selectedtarget.ShowCurrentStats()
# elif selectedmove.effect == "Legendary":
# if self.hp <= ((self.hpmax / 100) * 10):
# damage = (self.phystr * selectedmove.damage)
# BattleSystem.selectedtarget.hp -= damage
# GMnarrate.write (f"You used {selectedmove.name} to inflict {damage} damage. \n")
# BattleSystem.CheckEnemyStatus()
# else:
# GMnarrate.write ("You can't use your Limit Break ability unless your health is below 10%!")
# PressEnterToGoBack()
# BattleSystem.PlayerTurn()
# else:
# pass
BattleSystem.CheckEnemyStatus()
# NPC CHARACTER SUBCLASS CAN BE INTERACTED WITH BY THE PLAYER TO TRIGGER CONVERSATIONS AND EVENTS
class NPC(Character):
firstmeet = True
gmintro1 = ""
gmintro2 = ""
talkoption1 = ""
talkoption2 = ""
talkoption3 = ""
talkselect1 = ""
talkselect2 = ""
talkselect3 = ""
def Talk(self):
WorldBuilding.WorldUpdater()
if self.firstmeet:
self.gmintro1()
else:
self.gmintro2()
MenuTitle.write (f"\n{self.name}")
PlayerInput.write (f"0: Leave this conversation")
PlayerInput.write (f"1: {self.talkoption1}")
PlayerInput.write (f"2: {self.talkoption2}")
PlayerInput.write (f"3: {self.talkoption3}")
print ()
self.TalkSelection()
def TalkSelection(self):
DecisionMaker.MenuSelection()
if DecisionMaker.menuselectint in range (1,4):
self.firstmeet = False
if DecisionMaker.menuselect == "0":
ClearScreen()
MainCharacter.currentlocation()
elif DecisionMaker.menuselect == "1":
if self.talkselect1 == "":
self.InvalidChoice()
else:
ClearScreen()
self.talkselect1()
elif DecisionMaker.menuselect == "2":
if self.talkselect2 == "":
self.InvalidChoice()
else:
ClearScreen()
self.talkselect2()
elif DecisionMaker.menuselect == "3":
if self.talkselect3 == "":
self.InvalidChoice()
else:
ClearScreen()
self.talkselect3()
else:
self.InvalidChoice()
def InvalidChoice(self):
InvalidChoice()
self.Talk()
# VENDORS ARE AN NPC SUBCLASS TO DIFFERENTIATE BETWEEN CONVERSATIONS AND COMMERCE
class Vendor (NPC):
def SaleDisplay(self):
ScreenTitle.write (f"{self.name} \n")
if len (self.items) == 0:
GMnarrate.write ("The Vendor shakes their head... \n")
NPCtalk.write ("I'm not selling anything else right now. Be sure to come back and try again later.")
PressEnterToGoBack()
MainCharacter.currentlocation()
else:
Interactions.VendorPresentItems()
listitem = 0
PlayerInput.write ("0: Cancel \n")
for count in self.items:
listitem += 1
PlayerInput.write (f"{listitem}: {self.items[count]} x {count} \n : {count.value} credits \n")
GMtalk.write (f"You currently have {MainCharacter.credits} credits.")
self.MenuSelection()
if self.menuselect == "0":
NPCtalk.write ('''
No worries - later now.''')
PressEnterToGoBack()
MainCharacter.currentlocation()
else:
pass
if self.menuselectint in range (1,listitem+1):
itemsforsale = list(self.items)
selecteditem = itemsforsale[self.menuselectint-1]
NPCtalk.write (f'''
You sure about that {selecteditem.name}?. The developer hasn't programmed me to buy it back!
''')
PlayerInput.write ("1: I'm sure")
PlayerInput.write ("2: Let me look again")
self.MenuSelection()
if self.menuselect == "1":
if MainCharacter.credits >= selecteditem.value:
boughtitem = selecteditem
MainCharacter.credits -= boughtitem.value
GMnarrate.write (f"You acquired a {boughtitem.name}! You now have {MainCharacter.credits} credits left.")
x = isinstance (selecteditem, Item)
y = isinstance (selecteditem, Weapon)
z = isinstance (selecteditem, Armatek)
if x:
MainCharacter.items[boughtitem] += 1
elif y:
MainCharacter.phyweapons.append(boughtitem)
elif z:
MainCharacter.armweapons.append(boughtitem)
self.items[boughtitem] -= 1
if self.items[boughtitem] == 0:
del self.items[boughtitem]
PressEnterToGoBack()
ClearScreen()
self.SaleDisplay()
else:
Interactions.VendorNoMoney()
self.SaleDisplay()
elif self.menuselect == "2":
NPCtalk.write ('''
No worries - have a look at what I have''')
PressEnterToGoBack()
self.SaleDisplay()
else:
NPCtalk.write ('''
What? I didn't quite catch that. Have another look and let me know if you need anything.''')
InvalidChoice()
self.SaleDisplay()
else:
NPCtalk.write ('''
What? I didn't quite catch that. ''')
InvalidChoice()
self.SaleDisplay()
# MEDICS ARE AN NPC SUBCLASS TO KEEP HEALING OPTIONS SEPERATE, JUST FOR ORGANISATION REALLY.
class Medic (NPC):
def Healing(self):
if self.name == "Medic":
Interactions.MedicHealing()
elif self.name == "Field Droid":
Interactions.FieldDroidHealing()
# ENEMY CHARACTERS ARE USED IN COMBAT
class Enemy(Character):
def __init__(self, name, job):
self.name = name
self.job = job
if self.job == "Vagrant":
self.hpmax = 80
self.hp = 80
self.phystr = 5
self.phydef = 5
self.armstr = 5
self.armdef = 5
self.moveset = [Lunge, KnifeCuts]
elif self.job == "Bouncer":
self.hpmax = 120
self.hp = 120
self.phystr = 12
self.phydef = 10
self.armstr = 10
self.armdef = 8
self.moveset = [Punches, ArmaFist]
elif self.job == "Docker":
self.hpmax = 150
self.hp = 150
self.phystr = 10
self.phydef = 10
self.armstr = 12
self.armdef = 8
self.moveset = [AnchorStrike, LoaderFist]
elif self.job == "Officer":
self.hpmax = 175
self.hp = 175
self.phystr = 10
self.phydef = 10
self.armstr = 8
self.armdef = 14
self.moveset = [PistolShot, ArmaScopeShot]
elif self.job == "Assassin":
self.hpmax = 200
self.hp = 200
self.phystr = 14
self.phydef = 8
self.armstr = 10
self.armdef = 10
self.moveset = [VibraSwordSlice, VibraSwordSlashes]
elif self.job == "Arma Tank Arm":
self.hpmax = 150
self.hp = 150
self.phystr = 18
self.phydef = 18
self.armstr = 15
self.armdef = 15
self.moveset = [ArmaMechArmLow, ArmaMechArmHigh]
elif self.job == "Arma Tank Core":
self.hpmax = 200
self.hp = 200
self.phystr = 20
self.phydef = 20
self.armstr = 20
self.armdef = 20
self.moveset = [ArmaMechChestLow, ArmaMechChestHigh]
def MoveSelect(self):
misschance = random.randint (1,100)
BattleSystem.movechoice = self.moveset [(random.randint (1,len(self.moveset)))-1]
if misschance in range (1,BattleSystem.movechoice.chancetomiss+1):
GMnarrate.write (f"{self.name} tried to attack, but missed!")
else:
Enemy.DamageCalculation(self)
def DamageCalculation(self):
BattleSystem.selectedtarget = BattleSystem.party[random.randint(1,len(BattleSystem.party))-1]
BattleSystem.movechoice.effect()
def ShowCurrentStats(self):
MenuTitle.write (f"{self.name} \n")
MenuTitle.write ("HP:"); GMtalk.write(f"{self.hp}/{self.hpmax} \n")
MenuTitle.write ("Physical Strength:");GMtalk.write(f"{self.phystr} \n")
MenuTitle.write ("Physical Defense: ");GMtalk.write(f"{self.phydef} \n")
MenuTitle.write ("Armatek Strength: ");GMtalk.write(f"{self.armstr} \n")
MenuTitle.write ("Armatek Defense: ");GMtalk.write(f"{self.armdef} \n")
print()
MenuTitle.write ("Abilities: ")
for elem in self.moveset:
GMtalk.write (f"{elem}")
##############
# CHARACTERS #
##############
# PLAYABLE CHARACTERS
DecisionMaker = Player ("DecisionMaker") #THIS GUY EXISTS PURELY SO THAT DECISIONS ARE HANDED OFF INSTEAD OF RELYING ON SELF FOR CHARACTERS, MAKES LIFE EASIER FOR ME.
MainCharacter = Player ("Player")
# NPC CHARACTERS
TutorialCharacter = NPC("Tutorial NPC")
DockPorter = NPC ("Skytrain Dock Porter")
HomelessGuy = NPC ("Homeless Guy")
PowerStationBoss = NPC ("Power Station Boss")
# STORE VENDORS
VendorItem = Vendor("Item Vendor")
VendorWeapon = Vendor ("Physical Equipment Vendor")
VendorArmatek = Vendor ("Armatek Equipment Vendor")
# MEDIIIIIIIC!!!!!
MedicFella = Medic ("Medic")
FieldDroid = Medic ("Field Droid")
# ENEMY CHARACTERS
Vagrant = Enemy ("Vagrant", "Vagrant")
Bouncer = Enemy ("Bouncer", "Bouncer")
Docker = Enemy ("Docker", "Docker")
Officer = Enemy ("Officer", "Officer")
Assassin = Enemy ("Assassin", "Assassin")
ArmaTankLeftArm = Enemy ("Arma Tank - Left Arm", "Arma Tank Arm")
ArmaTankRightArm = Enemy ("Arma Tank - Right Arm", "Arma Tank Arm")
ArmaTankCentre = Enemy ("Arma Tank - Centre", "Arma Tank Core")
################################
################################
##### SECTION - NAVIGATION #####
################################
################################
# THE LOCATION CLASS AND LOCATION OBJECTS SHOW INFORMATION ABOUT THE PLAYER'S LOCATION AND FACILITATE NAVIGATION
class Location:
def __init__(self, name):
self.name = name
firstvisit = True
describe1 = ""
describe2 = ""
option1 = "-"
option2 = "-"
option3 = "-"
travel1 = "-"
travel2 = "-"
travel3 = "-"
selectoption1 = "-"
selectoption2 = "-"
selectoption3 = "-"
selecttravel1 = "-"
selecttravel2 = "-"
selecttravel3 = "-"
# LOADS WHEN A LOCATION IS TRAVELLED TO - DISPLAYS LOCATION INFO AND SORTS TRAVEL BACK TO PREVIOUS
def Area (self):
MainCharacter.currentlocation = self.Area
MainCharacter.lastlocation = MainCharacter.holdlocation
WorldBuilding.WorldUpdater()
if self.firstvisit:
self.describe1()
print()
else:
self.describe2()
print()
ScreenTitle.write (f"{self.name}\n")
MenuTitle.write ("Travel Menu")
PlayerInput.write (f"1: {self.travel1}")