diff --git a/werewolf/builder.py b/werewolf/builder.py index b80fcb6..aad0604 100644 --- a/werewolf/builder.py +++ b/werewolf/builder.py @@ -2,7 +2,6 @@ import asyncio import discord # Import all roles here -from werewolf.role import Role from werewolf.roles.vanillawerewolf import VanillaWerewolf from werewolf.roles.villager import Villager from werewolf.roles.seer import Seer @@ -10,35 +9,41 @@ from werewolf.roles.seer import Seer # All roles in this list for iterating role_list = [Villager, VanillaWerewolf] -#Example code: -# 0 = Villager -# 1 = VanillaWerewolf -# E1 = Random Town -# R1 = Random Werewolf -# J1 = Benign Neutral +""" +Example code: +0 = Villager +1 = VanillaWerewolf +E1 = Random Town +R1 = Random Werewolf +J1 = Benign Neutral -# 0001-1112E11R112P2 -# 0,0,0,1,11,12,E1,R1,R1,R1,R2,P2 +0001-1112E11R112P2 +0,0,0,1,11,12,E1,R1,R1,R1,R2,P2 + +pre-letter = exact role position +double digit position preempted by `-` +""" -# pre-letter = exact role position -# double digit position pre-empted by `-` async def parse_code(code): + """Do the magic described above""" out = [] - #Do the magic described above decode = code.copy() # for now, pass exact names for role_id in decode: print(role_id) if role_id == "Villager": role = Villager - if role_id == "VanillaWerewolf": + elif role_id == "VanillaWerewolf": role = VanillaWerewolf - if role_id == "Seer": + elif role_id == "Seer": role = Seer + else: # Fail to parse + return None out.append(role) return out - + + async def build_game(channel: discord.TextChannel): await channel.send("Not currently available") diff --git a/werewolf/game.py b/werewolf/game.py index e16607b..d6ae1cf 100644 --- a/werewolf/game.py +++ b/werewolf/game.py @@ -1,8 +1,6 @@ import asyncio import discord -from datetime import datetime, timedelta - import random from werewolf.player import Player @@ -14,7 +12,7 @@ class Game: """ Base class to run a single game of Werewolf """ - + default_secret_channel = { "channel": None, "players": [], @@ -59,10 +57,7 @@ class Game: self.vote_groups = {} # ID : VoteGroup() self.night_results = [] - - - - + self.loop = asyncio.get_event_loop() async def setup(self, ctx): @@ -91,7 +86,8 @@ class Game: self.guild.me: discord.PermissionOverwrite(read_messages=True, send_messages=True) } - self.channel_category = await self.guild.create_category("ww-game", overwrites=overwrite, reason="New game of werewolf") + self.channel_category = await self.guild.create_category("ww-game", overwrites=overwrite, reason="New game of " + "werewolf") for player in self.players: overwrite[player.member] = discord.PermissionOverwrite(read_messages=True) diff --git a/werewolf/player.py b/werewolf/player.py index 374c8c3..a90a8be 100644 --- a/werewolf/player.py +++ b/werewolf/player.py @@ -1,8 +1,6 @@ import asyncio - import discord -from datetime import datetime, timedelta class Player: """ diff --git a/werewolf/role.py b/werewolf/role.py index dd7e944..a0c692b 100644 --- a/werewolf/role.py +++ b/werewolf/role.py @@ -1,5 +1,6 @@ import asyncio + class Role: """ Base Role class for werewolf game diff --git a/werewolf/roles/seer.py b/werewolf/roles/seer.py index 3ea8d76..ae7c5b2 100644 --- a/werewolf/roles/seer.py +++ b/werewolf/roles/seer.py @@ -97,12 +97,12 @@ class Seer(Role): # async def _at_day_end(self): # pass - async def _at_night_start(self): + async def _at_night_start(self, data=None): await self.game.generate_targets(self.player.member) await self.player.send_dm("{}\n**Pick a target to see tonight**\n") - async def _at_night_end(self): + async def _at_night_end(self, data=None): target = await self.game.visit(self.see_target) alignment = await target.see_alignment(self.player) diff --git a/werewolf/werewolf.py b/werewolf/werewolf.py index 3d0630c..10afe08 100644 --- a/werewolf/werewolf.py +++ b/werewolf/werewolf.py @@ -5,8 +5,6 @@ from discord.ext import commands from redbot.core import Config -from datetime import datetime, timedelta - from werewolf.game import Game @@ -48,9 +46,8 @@ class Werewolf: await ctx.send("Failed to start a new game") else: await ctx.send("New game has started") - - - @commands.guild_only() + + @commands.guild_only() @ww.command() async def join(self, ctx): """ @@ -157,7 +154,7 @@ class Werewolf: # If multiple games, panic for game in self.games.values(): if await game.get_player_by_member(ctx.author): - break #game = game + break # game = game else: await ctx.send("You're not part of any werewolf game") return