瀏覽代碼

Add toggles to game state object

master
Noëlle Anthony 4 年之前
父節點
當前提交
755a848d6a
共有 1 個檔案被更改,包括 117 行新增30 行删除
  1. 117
    30
      metroidgen.py

+ 117
- 30
metroidgen.py 查看文件

@@ -60,36 +60,34 @@ class MetroidState:
4: False,
5: False
}
self.brinstarDoors {
1: False,
2: False,
3: False,
4: False,
5: False
}
self.norfairDoors {
1: False,
2: False,
3: False,
4: False
}
self.kraidDoors {
1: False,
2: False,
3: False,
4: False,
5: False
}
self.ridleyDoors {
1: False,
2: False
self.doors {
"Brinstar": {
1: False,
2: False,
3: False,
4: False,
5: False
}, "Norfair": {
1: False,
2: False,
3: False,
4: False
}, "Kraid": {
1: False,
2: False,
3: False,
4: False,
5: False
}, "Ridley": {
1: False,
2: False
}, "Tourian" {
1: False,
2: False,
3: False
}
}
self.tourianDoors {
1: False,
2: False,
3: False
}
self.kraidKilles = False
self.kraidKilled = False
self.ridleyKilled = False
self.motherBrainKilled = False
self.kraidStatue = False
@@ -97,7 +95,96 @@ class MetroidState:
self.swimsuit = False
self.missileCount = 0
self.gameAge = 0
self.startLocation = ["Brinstar", "Norfair", "Kraid's Lair", "Ridley's Lair", "Tourian"]
self.locations = ["Brinstar", "Norfair", "Kraid's Lair", "Ridley's Lair", "Tourian"]
self.startLocation = 0

def toggleItem(itm):
if itm in self.itemsCollected.keys():
self.itemsCollected[itm] = not self.itemsCollected[itm]
self.samusHas[itm] = not self.samusHas[itm]
else:
print("Couldn't find item: {}".format(str(itm)))
def toggleMissileTank(num):
try:
num = int(num)
except:
print("{} is not a number".format(num))
return
if num in self.missileTanks.keys():
self.missileTanks[num] = not self.missileTanks[num]
else:
print("Couldn't find missile tank: {}".format(num))
def toggleEnergyTank(num):
try:
num = int(num)
except:
print("{} is not a number".format(num))
return
if num in self.energyTanks.keys():
self.energyTanks[num] = not self.energyTanks[num]
else:
print("Couldn't find energy tank: {}".format(num))
def toggleZebetite(num):
try:
num = int(num)
except:
print("{} is not a number".format(num))
return
if num in self.zebetitesDestroyed.keys():
self.zebetitesDestroyed[num] = not self.zebetitesDestroyed[num]
else:
print("Couldn't find Zebetite: {}".format(num))

def toggleKraid():
self.kraidKilled = not self.kraidKilled
self.kraidStatue = self.kraidKilled

def toggleKraidStatue():
self.kraidStatue = not self.kraidStatue
if self.kraidKilled and not self.kraidStatue:
print("WARNING: Kraid has been killed but his statue has not been raised.")

def toggleRidley():
self.ridleyKilled = not self.ridleyKilled
self.ridleyStatue = self.ridleyKilled

def toggleRidleyStatue():
self.ridleyStatue = not self.ridleyStatue
if self.ridleyKilled and not self.ridleyStatue:
print("WARNING: Ridley has been killed but his statue has not been raised.")
def toggleMotherBrain():
self.motherBrainKilled = not self.motherBrainKilled

def toggleDoor(area, door) {
try:
area = str(area)
door = int(door)
except:
print("Area must be string, door must be a positive integer")
return
if area in self.doors.keys() and int(door) in self.doors[area].keys():
self.doors[area][door] = not self.doors[area][door]
else:
print("Couldn't find door {} in area {}".format(door, area))
}

def toggleSwimsuit():
self.swimsuit = not self.swimsuit

def newLocation(loc):
try:
loc = str(loc)
except:
print("Location must be a string")
return
if loc in self.locations:
self.startLocation = self.locations.index(loc)
else:
print("Couldn't find location: {}".format(loc))

def main():
pass

Loading…
取消
儲存