Expand night powers

Signed-off-by: Bobloy <alboblexloy@gmail.com>
This commit is contained in:
Bobloy 2018-05-10 14:00:19 -04:00
parent 337618314a
commit c95b2e4ef2
2 changed files with 21 additions and 14 deletions

View File

@ -3,3 +3,21 @@ from werewolf.role import Role
def night_immune(role: Role):
role.player.alive = True
async def pick_target(role: Role, ctx, data):
if not role.player.alive: # FixMe: Game handles this?
await role.player.send_dm("You're already dead!")
return None
target_id = int(data)
try:
target = role.game.players[target_id]
except IndexError:
target = None
if target is None:
await ctx.send("Not a valid ID")
return None
return target_id, target

View File

@ -1,3 +1,4 @@
from werewolf.night_powers import pick_target
from werewolf.role import Role
@ -83,19 +84,7 @@ class Seer(Role):
async def choose(self, ctx, data):
"""Handle night actions"""
if not self.player.alive: # FixMe: Game handles this?
await self.player.send_dm("You're already dead!")
return
await super().choose(ctx, data)
target_id = int(data)
try:
target = self.game.players[target_id]
except IndexError:
target = None
if target is None:
await ctx.send("Not a valid ID")
return
self.see_target = target_id
self.see_target, target = await pick_target(self, ctx, data)
await ctx.send("**You will attempt to see the role of {} tonight...**".format(target.member.display_name))