Expand night powers

Signed-off-by: Bobloy <alboblexloy@gmail.com>
pull/28/head
Bobloy 7 years ago
parent 337618314a
commit c95b2e4ef2

@ -3,3 +3,21 @@ from werewolf.role import Role
def night_immune(role: Role): def night_immune(role: Role):
role.player.alive = True 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

@ -1,3 +1,4 @@
from werewolf.night_powers import pick_target
from werewolf.role import Role from werewolf.role import Role
@ -83,19 +84,7 @@ class Seer(Role):
async def choose(self, ctx, data): async def choose(self, ctx, data):
"""Handle night actions""" """Handle night actions"""
if not self.player.alive: # FixMe: Game handles this? await super().choose(ctx, data)
await self.player.send_dm("You're already dead!")
return
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)) await ctx.send("**You will attempt to see the role of {} tonight...**".format(target.member.display_name))

Loading…
Cancel
Save