Advertisement
Guest User

Untitled

a guest
Mar 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. """
  3. @author: Chris
  4. Main File
  5. """
  6.  
  7. import character
  8. import random
  9.  
  10. def main():
  11. race = character.genRace(random.randint(0, 100))
  12. align = character.genAlign(random.randint(0, 100))
  13. classes = character.genClass(random.randint(0, 100))
  14. bGround = character.genBackground(random.randint(0, 100))
  15.  
  16. player = character.Character(race, classes, align, bGround)
  17.  
  18. print(player.toString())
  19.  
  20. if __name__ == "__main__":
  21. # execute only if run as a script
  22. main()
  23.  
  24.  
  25. # -*- coding: utf-8 -*-
  26. """
  27. Character Class
  28. """
  29.  
  30. class Character:
  31.  
  32. def __init__(self, race, lvlClass, align, bGround):
  33. self.__race = race
  34. self.__class = lvlClass
  35. self.__align = align
  36. self.__bGround = bGround
  37.  
  38. def getRace(self):
  39. return self.__race
  40.  
  41. def getClass(self):
  42. return self.__class
  43.  
  44. def getBackground(self):
  45. return self.__bGround
  46.  
  47. def getAlign(self):
  48. return self.__align
  49.  
  50. def toString(self):
  51. return "A " + self.__align + ", " + self.__bGround + ", " + self.__race + " " + self.__class
  52.  
  53. def genRace(x):
  54. races = ["Arakoocra", "Aasimar", "Bugbear", "Dragonborn", "Dwarf", "Elf", "Firbolg", "Genasi", "Gnome", "Goblin", "Goliath",
  55. "Half-Elf", "Halfling", "Half-Orc", "Hobgoblin", "Human", "Kenku", "Kobold", "Lizardfolk", "Orc", "Tabaxi", "Tiefling",
  56. "Tortle", "Triton", "Yuan-ti Pureblood"]
  57. x = x % len(races)
  58. return races[x]
  59.  
  60. def genClass(x):
  61. classes = ["Barbarian", "Bard", "Druid", "Monk", "Paladin", "Ranger", "Sorcerer", "Warlock"]
  62. x = x % len(classes)
  63. return classes[x]
  64.  
  65. def genAlign(x):
  66. alignments = ["Lawful Good", "Neutral Good", "Chaotic Good", "Lawful Neutral", "True Neutral", "Chaotic Neutral",
  67. "Lawful Evil", "Neutral Evil", "Chaotic Neutral"]
  68. x = x % len(alignments)
  69. return alignments[x]
  70.  
  71. def genBackground(x):
  72. backgrounds = ["Acolyte", "Charlatan", "Criminal", "Entertainer", "Folk Hero", "Guild Artisan", "Hermit", "Noble",
  73. "Outlander", "Sage", "Sailor", "Soldier", "Urchin"]
  74. x = x % len(backgrounds)
  75. return backgrounds[x]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement