fork download
  1. print('[help] for command list')
  2. def help():
  3. print("[inv] to open inventory")
  4. print("[stats] to show player stats")
  5.  
  6.  
  7.  
  8.  
  9. enemy = { #stats of the enemy (changes depending on monster type)
  10. 'health': 0,
  11. 'onfire': 0,
  12. 'stun': 0,
  13. 'atkblocked': False
  14. }
  15.  
  16.  
  17.  
  18.  
  19. player = { #stats of the player
  20. 'otherspells': [],
  21. 'combatspells': [],
  22. 'passivespells': [],
  23. 'health': 100,
  24. 'onfire': 0,
  25. 'protegocooldown': 0,
  26. 'incendiocooldown': 0,
  27. }
  28.  
  29. game = { #game varables
  30. 'dooropen': False,
  31. 'stage': 0,
  32. 'light': False,
  33. 'allspells': ["alohomora", "stupefy", "incendio", "protego", "lumos", "episkey"], #all obtainable spells in the game
  34. 'spelltype': ["passive", 'combat', 'combat', 'combat', 'passive', 'other'] #type of spell corresponding to allspells index
  35. }
  36.  
  37. #functions of all spells for easy casting
  38.  
  39. def alohomora(use):
  40. global enemy
  41. global player
  42. global game
  43. if 'alohomora' in player['combatspells']:
  44.  
  45. if use == "use":
  46. if game['stage'] == 10: #change this to where the door is
  47. game['doorlocked'] = False
  48. else:
  49. print("No door to unlock.")
  50. elif use == 'stats':
  51. print("Alohomora is a spell that unlocks doors. Cannot be used in battle.\n")
  52.  
  53.  
  54. def stupefy(use):
  55. global enemy
  56. global player
  57. global game
  58. if 'stupefy' in player['combatspells']:
  59.  
  60. if use == 'use':
  61. enemy['health'] -= 5
  62. print("Dealed 5 damage using Stupefy.")
  63.  
  64. elif use == 'stats':
  65. print("Stupefy is an attack spell, only useable in combat. Deals 5 damage, no cooldown.\n")
  66.  
  67. def protego(use):
  68. global enemy
  69. global player
  70. global game
  71. if 'protego' in player['combatspells']:
  72.  
  73. if use == 'use':
  74. if player['protegocooldown'] == 0: #check cooldown
  75. enemy['atkblocked'] = True #variable to check if protego has been sucecssfully casted
  76. print("BLOCKED\n")
  77. else:
  78. print("Protego on cooldown. {} turns remaining.".format(player['protegocooldown']))
  79.  
  80. def incendio(use):
  81. global enemy
  82. global player
  83. global game
  84. if 'incendio' in player['combatspells']:
  85.  
  86. if use == 'use':
  87. if player['incendiocooldown'] == 0: #check cooldown
  88. enemy['health'] -= 8
  89. print("Dealed 8 damage using Incendio. Enemy burning for 2 rounds.")
  90. player['incendiocooldown'] += 3
  91. else:
  92. print("Incendio on cooldown. {} turns remaining.".format(player['incendiocooldown']))
  93.  
  94. def lumos(use):
  95. global enemy
  96. global player
  97. global game
  98.  
  99. if 'lumos' in player['passivespells']:
  100. if use == 'use':
  101. if game['stage'] == 16: #change this to whatever stage uses lumos
  102. game['light'] == True #variable to check if lumos has been sucecssfully casted
  103. else:
  104. print("Lumos has no use here.")
  105. elif use == 'stats':
  106. print("Lumos casts light into the dark, letting you see. Cannot be used in combat.")
  107.  
  108.  
  109.  
  110. def newspell(spell):
  111. global enemy
  112. global player
  113. global game
  114.  
  115. if spell in game['allspells']:
  116. spellindex = game['allspells'].index(spell)
  117. spelltype = game['spelltype'][spellindex]
  118. if spelltype == 'combat':
  119. player['combatspells'].append(spell)
  120. elif spelltype == 'passive':
  121. player['passivespells'].append(spell)
  122. elif spelltype == 'other':
  123. player['otherspells'].append(spell)
  124. else:
  125. print("spell not found")
  126. print(spell, 'added to inventory.\n')
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
Success #stdin #stdout 0.08s 14040KB
stdin
Standard input is empty
stdout
[help] for command list