A save state/password generator for the original Metroid.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

metroidgen.py 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. class MetroidState:
  2. def __init__(self):
  3. self.itemsCollected = {
  4. "Maru Mari": False,
  5. "Bombs": False,
  6. "Long Beam": False,
  7. "Ice Beam": False,
  8. "Wave Beam": False,
  9. "High Jump Boots": False,
  10. "Varia": False,
  11. "Screw Attack": False
  12. }
  13. self.samusHas = {
  14. "Maru Mari": False,
  15. "Bombs": False,
  16. "Long Beam": False,
  17. "Ice Beam": False,
  18. "Wave Beam": False,
  19. "High Jump Boots": False,
  20. "Varia": False,
  21. "Screw Attack": False
  22. }
  23. self.missileTanks = {
  24. 1: False,
  25. 2: False,
  26. 3: False,
  27. 4: False,
  28. 5: False,
  29. 6: False,
  30. 7: False,
  31. 8: False,
  32. 9: False,
  33. 10: False,
  34. 11: False,
  35. 12: False,
  36. 13: False,
  37. 14: False,
  38. 15: False,
  39. 16: False,
  40. 17: False,
  41. 18: False,
  42. 19: False,
  43. 20: False,
  44. 21: False
  45. }
  46. self.energyTanks = {
  47. 1: False,
  48. 2: False,
  49. 3: False,
  50. 4: False,
  51. 5: False,
  52. 6: False,
  53. 7: False,
  54. 8: False
  55. }
  56. self.zebetitesDestroyed {
  57. 1: False,
  58. 2: False,
  59. 3: False,
  60. 4: False,
  61. 5: False
  62. }
  63. self.doors {
  64. "Brinstar": {
  65. 1: False,
  66. 2: False,
  67. 3: False,
  68. 4: False,
  69. 5: False
  70. }, "Norfair": {
  71. 1: False,
  72. 2: False,
  73. 3: False,
  74. 4: False
  75. }, "Kraid": {
  76. 1: False,
  77. 2: False,
  78. 3: False,
  79. 4: False,
  80. 5: False
  81. }, "Ridley": {
  82. 1: False,
  83. 2: False
  84. }, "Tourian" {
  85. 1: False,
  86. 2: False,
  87. 3: False
  88. }
  89. }
  90. self.kraidKilled = False
  91. self.ridleyKilled = False
  92. self.motherBrainKilled = False
  93. self.kraidStatue = False
  94. self.ridleyStatue = False
  95. self.swimsuit = False
  96. self.missileCount = 0
  97. self.gameAge = 0
  98. self.locations = ["Brinstar", "Norfair", "Kraid's Lair", "Ridley's Lair", "Tourian"]
  99. self.startLocation = 0
  100. def toggleItem(itm):
  101. if itm in self.itemsCollected.keys():
  102. self.itemsCollected[itm] = not self.itemsCollected[itm]
  103. self.samusHas[itm] = not self.samusHas[itm]
  104. else:
  105. print("Couldn't find item: {}".format(str(itm)))
  106. def toggleMissileTank(num):
  107. try:
  108. num = int(num)
  109. except:
  110. print("{} is not a number".format(num))
  111. return
  112. if num in self.missileTanks.keys():
  113. self.missileTanks[num] = not self.missileTanks[num]
  114. else:
  115. print("Couldn't find missile tank: {}".format(num))
  116. def toggleEnergyTank(num):
  117. try:
  118. num = int(num)
  119. except:
  120. print("{} is not a number".format(num))
  121. return
  122. if num in self.energyTanks.keys():
  123. self.energyTanks[num] = not self.energyTanks[num]
  124. else:
  125. print("Couldn't find energy tank: {}".format(num))
  126. def toggleZebetite(num):
  127. try:
  128. num = int(num)
  129. except:
  130. print("{} is not a number".format(num))
  131. return
  132. if num in self.zebetitesDestroyed.keys():
  133. self.zebetitesDestroyed[num] = not self.zebetitesDestroyed[num]
  134. else:
  135. print("Couldn't find Zebetite: {}".format(num))
  136. def toggleKraid():
  137. self.kraidKilled = not self.kraidKilled
  138. self.kraidStatue = self.kraidKilled
  139. def toggleKraidStatue():
  140. self.kraidStatue = not self.kraidStatue
  141. if self.kraidKilled and not self.kraidStatue:
  142. print("WARNING: Kraid has been killed but his statue has not been raised.")
  143. def toggleRidley():
  144. self.ridleyKilled = not self.ridleyKilled
  145. self.ridleyStatue = self.ridleyKilled
  146. def toggleRidleyStatue():
  147. self.ridleyStatue = not self.ridleyStatue
  148. if self.ridleyKilled and not self.ridleyStatue:
  149. print("WARNING: Ridley has been killed but his statue has not been raised.")
  150. def toggleMotherBrain():
  151. self.motherBrainKilled = not self.motherBrainKilled
  152. def toggleDoor(area, door) {
  153. try:
  154. area = str(area)
  155. door = int(door)
  156. except:
  157. print("Area must be string, door must be a positive integer")
  158. return
  159. if area in self.doors.keys() and int(door) in self.doors[area].keys():
  160. self.doors[area][door] = not self.doors[area][door]
  161. else:
  162. print("Couldn't find door {} in area {}".format(door, area))
  163. }
  164. def toggleSwimsuit():
  165. self.swimsuit = not self.swimsuit
  166. def newLocation(loc):
  167. try:
  168. loc = str(loc)
  169. except:
  170. print("Location must be a string")
  171. return
  172. if loc in self.locations:
  173. self.startLocation = self.locations.index(loc)
  174. else:
  175. print("Couldn't find location: {}".format(loc))
  176. def main():
  177. pass
  178. if __name__ == "__main__":
  179. main()