forked from AvaricePrince/dndCharacterCreate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDNDCharacter.py
More file actions
862 lines (827 loc) · 32.2 KB
/
DNDCharacter.py
File metadata and controls
862 lines (827 loc) · 32.2 KB
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
import linecache as line
import sys
thismodule = sys.modules[__name__]
#==========DICTIONARIES==========#
_Character = {"pname":"", "fname":"", "lname":"","level":"", "race":"", "class":"", "alignment":""}
Items = {}
abilityScore = {"Strength":"", "Dexterity":"", "Constitution":"", "Intelligence":"", "Wisdom":"", "Charisma":"", "Proficiency Bonus":""}
savingThrows = {"Saving Strength":"", "Saving Dexterity":"", "Saving Constitution":"", "Saving Intelligence":"", "Saving Wisdom":"", "Saving Charisma":""}
#==========DICTIONARIES==========#
#-----------GLOBAL VARIABLES--------#
thismodule.save = "",""
thismodule.sMod = ""
thismodule.dMod = ""
thismodule.cMod = ""
thismodule.iMod = ""
thismodule.wMod = ""
thismodule.chMod = ""
#-----------GLOBAL VARIABLES--------#
#==========MAIN FUNCTION==========#
def _MakeACharacter():
_Logo()
while True:
newCharacter = input("Hello Adventurer, would you like to create a new character? Y/N ").capitalize()
if newCharacter == "Y":
updatePName()
updateCName()
updateLevel()
updateRace()
updateClass()
updateAlignment()
updateBackground()
updateAbilityScore()
calcSaveThrow()
saveCharacter()
saveAbilityScore()
saveSaveThrows()
print("Character created succesfully\n")
addStuff()
elif newCharacter == "N":
lookUp = input("Would you like to look up a character? Y/N ")
if lookUp.capitalize() == "Y":
lookUpCharacter()
elif lookUp.capitalize() == "N":
dele = input("Delete Everything? Y/N ")
if dele.capitalize() == "Y":
clearAllCharacters()
print("All characters have been deleted!\n")
elif dele.capitalize() == "N":
print("Have a good day Adventurer!\n ")
break
else:
print("Invalid entry\n")
continue
else:
print("Try again\n")
continue
#==========MAIN FUNCTION==========#
#==========FUNCTIONS==========#
def lookUpCharacter():
while True:
num = input("Which character do you want to see? ")
if str.isdigit(num):
#checks to see if the line the user typed in is populated, .strip() finds the empty space
if line.getline("Character.txt", int(num)).strip():
print(line.getline("Character.txt", int(num)))
print(line.getline("stuff.txt", int(num)))
print(line.getline("ability.txt", int(num)))
print(line.getline("Saving Throws.txt", int(num)))
break
else:
print("Character does not exit! \n")
break
else:
print("Please enter a row number\n")
continue
def updatePName():
name = input("What is your irl name? ").capitalize()
_Character["pname"]=name
print("Okay, your name is: " + name + "\n")
def updateCName():
fname = input("Character's First name: ").capitalize()
lname = input("Character's Last name: ").capitalize()
_Character["fname"] = fname
_Character["lname"] = lname
print("Your name is: " + fname, lname + "\n")
def updateRace():
# race = input("What is your race? ").capitalize()
# _Character["race"] = race
# print("You are a " + race)
print("""
--Select a Race--\n
1: Dragonborn\n
2: Dwarf\n
3: Elf\n
4: Gnome\n
5: Half-Elf\n
6: Halfling\n
7: Half-Orc\n
8: Human\n
9: Tiefling\n
""")
print("*Explorer's Guide to Wildemount*\n")
print("""
0: Orc of Exandria\n""")
print("*Elemental Evil Player's Companion*\n")
print("""
11: Aarakocra\n
12: Genasi\n
13: Goliath\n
""")
print("*Volo's Guide to Monsters*")
print("""
14: Aasimar\n
15: Bugbear\n
16: Firblog\n
17: Goblin\n
18: Hobgoblin\n
19: Kenku\n
20: Kobold\n
21: Lizardfolk\n
22: Orc\n
23: Tabaxi\n
24: Triton\n
25: Yuan-ti Pureblood\n
""")
print("*Sword Coast Adventurer's Guide*\n")
print("""
26: Feral Tiefling\n
""")
print("""
**The Tortle Package**\n
27: Tortle\n
*Eberron: Rising from the Last War*\n
28: Changeling\n
29: Kalashtar\n
30: Orc of Eberron\n
31: Shifter\n
32: Warforged\n
**Mordenkainen's Tome of Foes**\n
33: Gith\n
**Guildmasters' Guide to Ravnica**\n
34: Centaur\n
35: Loxodon\n
36: Minotaur\n
37: Simic Hybrid\n
38: Vedalken\n
**Acquisitions Incorporated**\n
39: Verdan\n
**Locathah Rising**\n
40: Locathah\n
**One Grung Above**\n
41: Grung\n
""")
while True:
try:
choice = int(input("Choose your race: "))
if choice == 1:
_Character["race"] = "Dragonborn"
print("You are a Dragonborn\n")
break
elif choice == 2:
_Character["race"] = "Dwarf"
print("You are a Dwarf\n")
break
elif choice == 3:
_Character["race"] = "Elf"
print("You are a Elf\n")
break
elif choice == 4:
_Character["race"] = "Gnome"
print("You are a Gnome\n")
break
elif choice == 5:
_Character["race"] = "Half-Elf"
print("You are a Half-Elf\n")
break
elif choice == 6:
_Character["race"] = "Halfling"
print("You are a Halfling\n")
break
elif choice == 7:
_Character["race"] = "Half-Orc"
print("You are a Half-Orc\n")
break
elif choice == 8:
_Character["race"] = "Human"
print("You are a Human\n")
break
elif choice == 9:
_Character["race"] = "Tiefling"
print("You are a Tiefling\n")
break
elif choice == 0:
_Character["race"] = "Orc of Exandria"
print("You are an Orc of Exandria\n")
break
elif choice == 11:
_Character["race"] = "Aarakocra"
print("You are a Aarakocra\n")
break
elif choice == 12:
_Character["race"] = "Genasi"
print("You are a Genasi\n")
break
elif choice == 13:
_Character["race"] = "Goliath"
print("You are a Goliath\n")
break
elif choice == 14:
_Character["race"] = "Aasimar"
print("You are a Aasimar\n")
break
elif choice == 15:
_Character["race"] = "Bugbear"
print("You are a Bugbear\n")
break
elif choice == 16:
_Character["race"] = "Firblog"
print("You are a Firblog\n")
break
elif choice == 17:
_Character["race"] = "Goblin"
print("You are a Goblin\n")
break
elif choice == 18:
_Character["race"] = "Hobgoblin"
print("You are a Hobgoblin\n")
break
elif choice == 19:
_Character["race"] = "Kenku"
print("You are a Kenku\n")
break
elif choice == 20:
_Character["race"] = "Kobold"
print("You are a Kobold\n")
break
elif choice == 21:
_Character["race"] = "Lizardfolk"
print("You are a Lizardfolk\n")
break
elif choice == 22:
_Character["race"] = "Orc"
print("You are a Orc\n")
break
elif choice == 23:
_Character["race"] = "Tabaxi"
print("You are a Tabaxi\n")
break
elif choice == 24:
_Character["race"] = "Triton"
print("You are a Triton\n")
break
elif choice == 25:
_Character["race"] = "Yuan-ti Pureblood"
print("You are a Yuan-ti Pureblood\n")
break
elif choice == 26:
_Character["race"] = "Feral Tiefling"
print("You are a Feral Tiefling\n")
break
elif choice == 27:
_Character["race"] = "Tortle"
print("You are a Tortle\n")
break
elif choice == 28:
_Character["race"] = "Changeling"
print("You are a Changeling\n")
break
elif choice == 29:
_Character["race"] = "Kalashtar"
print("You are a Kalashtar\n")
break
elif choice == 30:
_Character["race"] = "Orc of Eberron"
print("You are an Orc of Eberron\n")
break
elif choice == 31:
_Character["race"] = "Shifter"
print("You are a Shifter\n")
break
elif choice == 32:
_Character["race"] = "Warforged"
print("You are a Warforged\n")
break
elif choice == 33:
_Character["race"] = "Gith"
print("You are a Gith\n")
break
elif choice == 34:
_Character["race"] = "Centaur"
print("You are a Centaur\n")
break
elif choice == 35:
_Character["race"] = "Loxodon"
print("You are a Loxodon\n")
break
elif choice == 36:
_Character["race"] = "Minotaur"
print("You are a Minotaur\n")
break
elif choice == 37:
_Character["race"] = "Simic Hybrid"
print("You are a Simic Hybrid\n")
break
elif choice == 38:
_Character["race"] = "Vedalken"
print("You are a Vedalken\n")
break
elif choice == 39:
_Character["race"] = "Verdan"
print("You are a Verdan\n")
break
elif choice == 40:
_Character["race"] = "Locathah"
print("You are a Locathah\n")
break
elif choice == 41:
_Character["race"] = "Grung"
print("You are a Grung\n")
break
else:
print("No race selected\n")
continue
except ValueError:
print("Invalid, must be a number\n")
continue
def updateClass():
# _class = input("What is your class? ").capitalize()
# _Character["class"] = _class
# print("Your class is " + _class + "\n")
print("""---SELECT A CLASS---
1: Barbarian\n
2: Bard\n
3: Cleric\n
4: Druid\n
5: Fighter\n
6: Monk\n
7: Paladin\n
8: Ranger\n
9: Rogue\n
0: Sorcerer\n
11: Warlock\n
12: Wizard\n
***Eberron: Rising from the Last War***\n
13: Artificer\n
***Critical Role***\n
14: Blood Hunter\n
""")
while True:
try:
choice = int(input("Pick a Class: "))
if choice == 1:
_Character["class"] = "Barbarian"
print("You are a Barbarian\n")
thismodule.save = "s","c"
break
elif choice == 2:
_Character["class"] = "Bard"
print("You are a Bard\n")
thismodule.save = "d","c"
break
elif choice == 3:
_Character["class"] = "Cleric"
print("You are a Cleric\n")
thismodule.save = "w","c"
break
elif choice == 4:
_Character["class"] = "Druid"
print("You are a Druid\n")
thismodule.save = "i","w"
break
elif choice == 5:
_Character["class"] = "Fighter"
print("You are a Fighter\n")
thismodule.save = "s","c"
break
elif choice == 6:
_Character["class"] = "Monk"
print("You are a Monk\n")
thismodule.save = "s","d"
break
elif choice == 7:
_Character["class"] = "Paladin"
print("You are a Paladin\n")
thismodule.save = "w","c"
break
elif choice == 8:
_Character["class"] = "Ranger"
print("You are a Ranger\n")
thismodule.save = "s","d"
break
elif choice == 9:
_Character["class"] = "Rogue"
print("You are a Rogue\n")
thismodule.save = "d","i"
break
elif choice == 0:
_Character["class"] = "Sorcerer"
print("You are a Sorcerer\n")
thismodule.save = "c","c"
break
elif choice == 11:
_Character["class"] = "Warlock"
print("You are a Warlock\n")
thismodule.save = "w","c"
break
elif choice == 12:
_Character["class"] = "Wizard"
print("You are a Wizard\n")
thismodule.save = "i","w"
break
elif choice == 13:
_Character["class"] = "Artificer"
print("You are a Artificer\n")
thismodule.save = "c","i"
break
elif choice == 14:
_Character["class"] = "Blood Hunter"
print("You are a Artificer\n")
thismodule.save = "d","i"
break
else:
print("Class does not exist\n")
continue
except ValueError:
print("Must be a number!\n")
continue
def updateLevel():
while True:
try:
level = int(input("What level are you? Level: "))
if level > 20:
print("Your level is too high!\n")
continue
elif level < 1:
print("You cant be a negative level!\n")
continue
proBo(level)
except ValueError:
print("Invalid number\n")
continue
_Character["level"] = level
print("You're level " + str(level) + "\n")
break
#allows user to input their characters alignment
def updateAlignment():
# align = input("What is your alignment? ").capitalize()
# _Character["alignment"] = align
# print("Okay, your alignment is: " + align)
while True:
print("---Select your alignment--- \n")
print("1: Lawful Good \n")
print("2: Neutral Good \n")
print("3: Chaotic Good \n")
print("4: Lawful Neutral \n")
print("5: True Neutral \n")
print("6: Chaotic Neutral \n")
print("7: Lawful Evil \n")
print("8: Neutral Evil \n")
print("9: Chaotic Evil \n")
print("0: Unaligned \n")
align = int(input("Choose your alignment: "))
if align == 1:
_Character["alignment"] = "Lawful good"
print("Okay, you're Lawful good \n")
break
elif align == 2:
_Character["alignment"] = "Neutral Good"
print("Okay, you're Neutral good \n")
break
elif align == 3:
_Character["alignment"] = "Chaotic Good"
print("Okay, you're Chaotic good \n")
break
elif align == 4:
_Character["alignment"] = "Lawful Neutral"
print("Okay, you're Lawful Neutral \n")
break
elif align == 5:
_Character["alignment"] = "True Neutral"
print("Okay, you're True Neutral \n")
break
elif align == 6:
_Character["alignment"] = "Chaotic Neutral"
print("Okay, you're Chaotic Neutral \n")
break
elif align == 7:
_Character["alignment"] = "Lawful Evil"
print("Okay, you're Lawful Evil \n")
break
elif align == 8:
_Character["alignment"] = "Neutral Evil"
print("Okay, you're Neutral Evil \n")
break
elif align == 9:
_Character["alignment"] = "Chaotic Evil"
print("Okay, you're Chaotic Evil \n")
break
elif align == 0:
_Character["alignment"] = "Unaligned"
print("Okay, you're Unaligned \n")
break
else:
print("Invalid choice, try again\n")
continue
#allows user to input their characters background
def updateBackground():
bg = input("What is your background? ").capitalize()
_Character["background"] = bg
print("Your background is: " + bg + "\n")
#allows user to input their ability scores
def updateAbilityScore():
while True:
try:
st = int(input("What did you roll for strength? "))
if st < 2:
abilityScore["Strength"] = (st, "Modifier: ", -5)
thismodule.sMod = -5
elif st <= 3:
abilityScore["Strength"] = (st, "Modifier: ", -4)
thismodule.sMod = -4
elif st <= 5:
abilityScore["Strength"] = (st, "Modifer: ", -3)
thismodule.sMod = -3
elif st <= 7:
abilityScore["Strength"] = (st, "Modifier: ", -2)
thismodule.sMod = -2
elif st <= 9:
abilityScore["Strength"] = (st, "Modifier: ", -1)
thismodule.sMod = -1
elif st <= 11:
abilityScore["Strength"] = (st, "Modifier: ", 0)
thismodule.sMod = 0
elif st <= 13:
abilityScore["Strength"] = (st, "Modifier: ", 1)
thismodule.sMod = 1
elif st <= 15:
abilityScore["Strength"] = (st, "Modifier: ", 2)
thismodule.sMod = 2
elif st <= 17:
abilityScore["Strength"] = (st, "Modifier: ", 3)
thismodule.sMod = 3
else:
print("Invalid entry")
continue
dex = int(input("What did you roll for Dexterity? "))
if dex < 2:
abilityScore["Dexterity"] = (dex, "Modifier: ", -5)
thismodule.dMod = -5
elif dex <= 3:
abilityScore["Dexterity"] = (dex, "Modifier: ", -4)
thismodule.dMod = -4
elif dex <= 5:
abilityScore["Dexterity"] = (dex, "Modifer: ", -3)
thismodule.dMod = -3
elif dex <= 7:
abilityScore["Dexterity"] = (dex, "Modifier: ", -2)
thismodule.dMod = -2
elif dex <= 9:
abilityScore["Dexterity"] = (dex, "Modifier: ", -1)
thismodule.dMod = -1
elif dex <= 11:
abilityScore["Dexterity"] = (dex, "Modifier: ", 0)
thismodule.dMod = 0
elif dex <= 13:
abilityScore["Dexterity"] = (dex, "Modifier: ", 1)
thismodule.dMod = 1
elif dex <= 15:
abilityScore["Dexterity"] = (dex, "Modifier: ", 2)
thismodule.dMod = 2
elif dex <= 17:
abilityScore["Dexterity"] = (dex, "Modifier: ", 3)
thismodule.dMod = 3
else:
print("Invalid entry")
continue
con = int(input("What did you roll for Constitution? "))
if con < 2:
abilityScore["Constitution"] = (con, "Modifier: ",-5)
thismodule.cMod = -5
elif con <= 3:
abilityScore["Constitution"] = (con, "Modifier: ",-4)
thismodule.cMod = -4
elif con <= 5:
abilityScore["Constitution"] = (con, "Modifer: ",-3)
thismodule.cMod = -3
elif con <= 7:
abilityScore["Constitution"] = (con, "Modifier: ",-2)
thismodule.cMod = -2
elif con <= 9:
abilityScore["Constitution"] = (con, "Modifier: ",-1)
thismodule.cMod = -1
elif con <= 11:
abilityScore["Constitution"] = (con, "Modifier: ",0)
thismodule.cMod = 0
elif con <= 13:
abilityScore["Constitution"] = (con, "Modifier: ",1)
thismodule.cMod = 1
elif con <= 15:
abilityScore["Constitution"] = (con, "Modifier: ",2)
thismodule.cMod = 2
elif con <= 17:
abilityScore["Constitution"] = (con, "Modifier: ",3)
thismodule.cMod = 3
else:
print("Invalid entry")
continue
intel = int(input("What did you roll for Intelligence? "))
if intel < 2:
abilityScore["Intelligence"] = (intel, "Modifier: ",-5)
thismodule.iMod = -5
elif intel <= 3:
abilityScore["Intelligence"] = (intel, "Modifier: ",-4)
thismodule.iMod = -4
elif intel <= 5:
abilityScore["Intelligence"] = (intel, "Modifer: ",-3)
thismodule.iMod = -3
elif intel <= 7:
abilityScore["Intelligence"] = (intel, "Modifier: ",-2)
thismodule.iMod = -2
elif intel <= 9:
abilityScore["Intelligence"] = (intel, "Modifier: ",-1)
thismodule.iMod = -1
elif intel <= 11:
abilityScore["Intelligence"] = (intel, "Modifier: ",0)
thismodule.iMod = 0
elif intel <= 13:
abilityScore["Intelligence"] = (intel, "Modifier: ",1)
thismodule.iMod = 1
elif intel <= 15:
abilityScore["Intelligence"] = (intel, "Modifier: ",2)
thismodule.iMod = 2
elif intel <= 17:
abilityScore["Intelligence"] = (intel, "Modifier: ",3)
thismodule.iMod = 3
else:
print("Invalid entry")
continue
wis = int(input("What did you roll for Wisdom? "))
if wis < 2:
abilityScore["Wisdom"] = (wis, "Modifier: ",-5)
thismodule.wMod = -5
elif wis <= 3:
abilityScore["Wisdom"] = (wis, "Modifier: ",-4)
thismodule.wMod = -4
elif wis <= 5:
abilityScore["Wisdom"] = (wis, "Modifer: ",-3)
thismodule.wMod = -3
elif wis <= 7:
abilityScore["Wisdom"] = (wis, "Modifier: ",-2)
thismodule.wMod = -2
elif wis <= 9:
abilityScore["Wisdom"] = (wis, "Modifier: ",-1)
thismodule.wMod = -1
elif wis <= 11:
abilityScore["Wisdom"] = (wis, "Modifier: ",0)
thismodule.wMod = 0
elif wis <= 13:
abilityScore["Wisdom"] = (wis, "Modifier: ",1)
thismodule.wMod = 1
elif wis <= 15:
abilityScore["Wisdom"] = (wis, "Modifier: ",2)
thismodule.wMod = 2
elif wis <= 17:
abilityScore["Wisdom"] = (wis, "Modifier: ",3)
thismodule.wMod = 3
else:
print("Invalid entry")
continue
cha = int(input("What did you roll for Charisma? "))
if cha < 2:
abilityScore["Charisma"] = (cha, "Modifier: ",-5)
thismodule.chMod = -5
elif cha <= 3:
abilityScore["Charisma"] = (cha, "Modifier: ",-4)
thismodule.chMod = -4
elif cha <= 5:
abilityScore["Charisma"] = (cha, "Modifer: ",-3)
thismodule.chMod = -3
elif cha <= 7:
abilityScore["Charisma"] = (cha, "Modifier: ",-2)
thismodule.chMod = -2
elif cha <= 9:
abilityScore["Charisma"] = (cha, "Modifier: ",-1)
thismodule.chMod = -1
elif cha <= 11:
abilityScore["Charisma"] = (cha, "Modifier: ",0)
thismodule.chMod = 0
elif cha <= 13:
abilityScore["Charisma"] = (cha, "Modifier: ",1)
thismodule.chMod = 1
elif cha <= 15:
abilityScore["Charisma"] = (cha, "Modifier: ",2)
thismodule.chMod = 2
elif cha <= 17:
abilityScore["Charisma"] = (cha, "Modifier: ",3)
thismodule.chMod = 3
else:
print("Invalid entry")
continue
except ValueError:
print("Not a valid number")
continue
else:
return st,dex,con,intel,wis,cha
break
saveAbilityScore()
#adds items to the Items dictionary
def addStuff():
stuff = input("Do you have any items? Y/N ")
if stuff.capitalize() == "Y":
item = input("What item do you have? ")
amount = input("How much of the item do you have? ")
if amount.isdigit() is False:
print("Amount has to be a number")
addStuff()
Items[item] = amount
addStuff()
elif stuff.capitalize() == "N":
print("No items added \n")
saveStuff()
for key, val in Items.items():
print("You have " + val + " " + key +"\n")
else:
print("invalid")
addStuff()
#saves the character the user created when invoked
def saveCharacter():
f = open("Character.txt", "a")
f.write( str(_Character) + "\n" )
f.close()
#reads the Character.txt file
def readSavedCharacter():
f = open("Character.txt", "r")
print(f.read())
#saves items to the Items dictionary
def saveStuff():
f = open("stuff.txt", "a")
f.write( str(Items) + "\n")
f.close()
#self explanitory
def saveAbilityScore():
f = open("ability.txt","a")
f.write( str(abilityScore) + "\n")
f.close()
def saveSaveThrows():
f = open("Saving Throws.txt","a")
f.write( str(savingThrows) + "\n")
f.close()
def readSaveThrows():
f.open("Saving Throws.txt", "r")
print(f.read())
#deletes all information on every text file when invoked!!
def clearAllCharacters():
f = open("Character.txt", "w").close()
f = open("stuff.txt", "w").close()
f = open("ability.txt", "w").close()
f = open("Saving Throws.txt", "w").close()
#calculates the proficiency bonus based on inputed level
def proBo(level):
if 1 < level <= 4:
abilityScore["Proficiency Bonus"] = 2
elif 5 < level <=9:
abilityScore["Proficiency Bonus"] = 3
elif 9 < level <=13:
abilityScore["Proficiency Bonus"] = 4
elif 13 < level <=17:
abilityScore["Proficiency Bonus"] = 5
elif 17 < level <=21:
abilityScore["Proficiency Bonus"] = 6
def _Logo():
print("""
██████╗ ███╗ ██╗██████╗
██╔══██╗████╗ ██║██╔══██╗
██║ ██║██╔██╗ ██║██║ ██║
██║ ██║██║╚██╗██║██║ ██║
██████╔╝██║ ╚████║██████╔╝
╚═════╝ ╚═╝ ╚═══╝╚═════╝
██████╗██╗ ██╗ █████╗ ██████╗ █████╗ ██████╗████████╗███████╗██████╗
██╔════╝██║ ██║██╔══██╗██╔══██╗██╔══██╗██╔════╝╚══██╔══╝██╔════╝██╔══██╗
██║ ███████║███████║██████╔╝███████║██║ ██║ █████╗ ██████╔╝
██║ ██╔══██║██╔══██║██╔══██╗██╔══██║██║ ██║ ██╔══╝ ██╔══██╗
╚██████╗██║ ██║██║ ██║██║ ██║██║ ██║╚██████╗ ██║ ███████╗██║ ██║
╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝
██████╗██████╗ ███████╗ █████╗ ████████╗ ██████╗ ██████╗
██╔════╝██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██╔═══██╗██╔══██╗
██║ ██████╔╝█████╗ ███████║ ██║ ██║ ██║██████╔╝
██║ ██╔══██╗██╔══╝ ██╔══██║ ██║ ██║ ██║██╔══██╗
╚██████╗██║ ██║███████╗██║ ██║ ██║ ╚██████╔╝██║ ██║
╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝
""")
#calculates what your saving throw will be based off of ur level and class
def calcSaveThrow():
savingThrows["Saving Strength"] = sMod
savingThrows["Saving Dexterity"] = dMod
savingThrows["Saving Constitution"] = cMod
savingThrows["Saving Intelligence"] = iMod
savingThrows["Saving Wisdom"] = wMod
savingThrows["Saving Charisma"] = chMod
if save == ("s","c"):
savingThrows["Saving Strength"] = sMod + abilityScore.get("Proficiency Bonus")
savingThrows["Saving Constitution"] = cMod + abilityScore.get("Proficiency Bonus")
elif save == ("d","c"):
savingThrows["Saving Dexterity"] = dMod + abilityScore.get("Proficiency Bonus")
savingThrows["Saving Charisma"] = chMod + abilityScore.get("Proficiency Bonus")
elif save == ("w","c"):
savingThrows["Saving Wisdom"] = wMod + abilityScore.get("Proficiency Bonus")
savingThrows["Saving Charisma"] = chMod + abilityScore.get("Proficiency Bonus")
elif save == ("i","w"):
savingThrows["Saving Intelligence"] = iMod + abilityScore.get("Proficiency Bonus")
savingThrows["Saving Wisdom"] = wMod + abilityScore.get("Proficiency Bonus")
elif save == ("s","d"):
savingThrows["Saving Strength"] = sMod + abilityScore.get("Proficiency Bonus")
savingThrows["Saving Dexterity"] = dMod + abilityScore.get("Proficiency Bonus")
elif save == ("d","i"):
savingThrows["Saving Dexterity"] = dMod + abilityScore.get("Proficiency Bonus")
savingThrows["Saving Intelligence"] = iMod + abilityScore.get("Proficiency Bonus")
elif save == ("c","c"):
savingThrows["Saving Constitution"] = cMod + abilityScore.get("Proficiency Bonus")
savingThrows["Saving Charisma"] = chMod + abilityScore.get("Proficiency Bonus")
elif save == ("c","i"):
savingThrows["Saving Constitution"] = cMod + abilityScore.get("Proficiency Bonus")
savingThrows["Saving Intelligence"] = iMod + abilityScore.get("Proficiency Bonus")
#==========FUNCTIONS==========#
#==========RUN PROGRAM==========#
_MakeACharacter()
#==========RUN PROGRAM==========#