Fix witch function
This commit is contained in:
parent
9e8b7a3e40
commit
ce60013fbd
1 changed files with 17 additions and 4 deletions
21
main.py
21
main.py
|
|
@ -274,12 +274,13 @@ class Game:
|
|||
def witch(self) -> None:
|
||||
"""Interactively choose to kill or revive someone"""
|
||||
log.info("With the Revive Potion, you can revive someone, and with the Death Potion, you can kill someone. You can only use each potion once, and you can also choose to do nothing.")
|
||||
log.info("Players who might die are %s", ' '.join(map(str, self.dead_this_night)))
|
||||
if len(self.used_potions) == 2:
|
||||
log.info("You already used all of your potions. ")
|
||||
else:
|
||||
elif len(self.used_potions) != 2:
|
||||
while True:
|
||||
options = ("Death", "Revive", "Nothing")
|
||||
potionchoice = self.choose_between(options)
|
||||
potionchoice = self.choose_between(options).capitalise()
|
||||
if potionchoice == "Revive" and "Revive" not in self.used_potions:
|
||||
player = self.select_someone()
|
||||
if player in self.dead_this_night:
|
||||
|
|
@ -288,8 +289,11 @@ class Game:
|
|||
return
|
||||
elif player not in self.dead_this_night and not self.players[player].alive:
|
||||
log.info("You cannot bring this person back to life because they have been buried.")
|
||||
else:
|
||||
elif
|
||||
log.info("This player is not dead.")
|
||||
else:
|
||||
log.info("Unknown error: Invalid player choice")
|
||||
return
|
||||
elif potionchoice == "Death" and "Death" not in self.used_potions:
|
||||
player = self.select_someone()
|
||||
if self.players[player].alive:
|
||||
|
|
@ -297,13 +301,22 @@ class Game:
|
|||
self.kill(player)
|
||||
return
|
||||
elif not self.players[player].alive:
|
||||
self.used_potions.append("Death")
|
||||
log.info("This player is already dead.")
|
||||
else:
|
||||
log.info("Unknown error: Invalid player choice")
|
||||
return
|
||||
elif potionchoice == "Nothing":
|
||||
log.info("You are not doing anything tonight.")
|
||||
return
|
||||
elif potionchoice in self.used_potions:
|
||||
log.info("You already used this potion.")
|
||||
else:
|
||||
log.critical("Unknown error: Invalid potion choice.")
|
||||
return
|
||||
else:
|
||||
log.critical("Unknown error: Invalid check")
|
||||
|
||||
|
||||
|
||||
# -------------------------
|
||||
# game flow
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue