Skip to content

Commit

Permalink
Make sure dead players cant do actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Solirs committed Jun 27, 2023
1 parent abb0e26 commit 0694ed9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions freefang/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def vote(headers, game, connection):

target = game.getplayerbyname(headers.target)

if game.up == Werewolf and headers.sender.iswerewolf() and headers.sender.voted == False and target.alive:
if game.up == Werewolf and headers.sender.iswerewolf() and headers.sender.voted == False and target.alive and headers.sender.alive:
if target == headers.sender.protected:
return 3 # protected player case (3)
vt = WerewolfVote(headers.target, headers.sender)
Expand Down Expand Up @@ -128,7 +128,7 @@ class Seer:
def reveal(headers, game, connection):
target = game.getplayerbyname(headers.target)
# Check if the player is actually a seer, if the role currently woken up is seer, and if the target is alive
if game.up == Seer and headers.sender.role == Seer and target.alive:
if game.up == Seer and headers.sender.role == Seer and target.alive and headers.sender.alive:
# Create packet
packet = packets.SeerReveal(target.role.__name__, target.name)
# Send packet containing the desired info to the seer
Expand Down

0 comments on commit 0694ed9

Please sign in to comment.