Refactor witch function
This commit is contained in:
parent
ce60013fbd
commit
a857221bed
1 changed files with 4 additions and 8 deletions
12
main.py
12
main.py
|
|
@ -275,12 +275,12 @@ class Game:
|
|||
"""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:
|
||||
if len(self.used_potions) >= 2:
|
||||
log.info("You already used all of your potions. ")
|
||||
elif len(self.used_potions) != 2:
|
||||
else:
|
||||
while True:
|
||||
options = ("Death", "Revive", "Nothing")
|
||||
potionchoice = self.choose_between(options).capitalise()
|
||||
potionchoice = self.choose_between(options).capitalize()
|
||||
if potionchoice == "Revive" and "Revive" not in self.used_potions:
|
||||
player = self.select_someone()
|
||||
if player in self.dead_this_night:
|
||||
|
|
@ -289,7 +289,7 @@ 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.")
|
||||
elif
|
||||
elif self.players[player].alive:
|
||||
log.info("This player is not dead.")
|
||||
else:
|
||||
log.info("Unknown error: Invalid player choice")
|
||||
|
|
@ -313,10 +313,6 @@ class Game:
|
|||
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