Commit 901df1f3 authored by Ferdinand Schober's avatar Ferdinand Schober 💬
Browse files

bug_fixes

parent 216972ef
......@@ -118,8 +118,8 @@ class WerwolfCommands(commands.Cog):
if not role_dead:
role_dead = await ctx.guild.create_role(name='tot', color=Colour.red(), hoist=True, mentionable=True)
roles = [Werewolf, Hunter, Witch, Whore, Seer]
#roles = [Werewolf, Villager, Amor, Witch, Whore, Werewolf, Seer, Hunter]
#roles = [Girl, Werewolf, Hunter, Witch, Whore, Seer]
roles = [Werewolf, Girl, Amor, Witch, Whore, Werewolf, Seer, Hunter, Villager, Werewolf]
category = await self.create_channels(ctx.guild, ['info', 'dorf'] + [role.get_channel_name() for role in set(roles[:len(members)]) ] + ['liebespaar'], role_alive, role_dead)
await gather(*[member.move_to(category.voice_channels[0]) for member in members])
self.game[ctx.guild] = Game(category, members, roles, role_alive, role_dead)
......@@ -137,16 +137,15 @@ class WerwolfCommands(commands.Cog):
game = self.game[message.guild]
if not game: return
ww_channel = game.role_of_type[Werewolf]
girl_channel = game.role_of_type.get(Girl)
ww_channel = game.role_of_type[Werewolf].channel
girl_channel = game.role_of_type.get(Girl).channel
if girl_channel and message.channel == ww_channel:
girl_channel.send(message.content)
if girl_channel and (message.channel == ww_channel):
await girl_channel.send(message.content)
@commands.command()
@commands.check(is_alive)
@commands.check(is_running)
@delete_command_message
@args_alive
async def accuse(self, ctx, *, player:Member):
await self.game[ctx.guild].day.accuse(ctx, player)
......@@ -246,12 +245,6 @@ class WerwolfCommands(commands.Cog):
async def alive(self, ctx):
await self.game[ctx.guild].print_living(ctx)
@commands.command()
@commands.check(is_running)
@delete_command_message
async def votes(self, ctx):
await self.game[ctx.guild].day.print_votes(ctx)
@commands.command()
@commands.check(is_running)
@delete_command_message
......
......@@ -90,7 +90,7 @@ class Day():
max_v = max(set(votes.values()))
self.accused = {k for k, v in votes.items() if v == max_v}
if len(self.accused) > 1:
await self.channel.send(embed=Embed(colour=Colour.orange(), title=f'Es gibt eine Stichwahl mit {[m.mention for m in self.accused]}'))
await self.channel.send(embed=Embed(colour=Colour.orange(), description=f'Es gibt eine Stichwahl mit {[m.mention for m in self.accused]}'))
self.votes = dict()
self.votes_event.clear()
......
......@@ -72,7 +72,7 @@ class Game():
if len(self.alive) == 0:
await self.channel.send('Somit ist das Spiel vorbei!\nNiemand hat gewonnen!')
return True
elif self.alive == self.couple:
elif self.alive == set(self.couple):
await self.channel.send('Somit ist das Spiel vorbei!\nDas Liebespaar hat gewonnen!')
return True
elif len({ self.role_of_member[member].get_team() for member in self.alive}) == 1:
......
......@@ -12,6 +12,12 @@ class Girl(Role):
@classmethod
def get_channel_name(cls): return 'mädchen'
@classmethod
def get_max_members(cls): return 1
@classmethod
async def task_(cls): pass
@classmethod
def get_command_help_embed(cls):
return {
......
......@@ -8,9 +8,9 @@ from discord import utils
def distribute_roles(game, members, roles):
random.shuffle(members)
members_for_role = { role : [] for role in roles[:len(members)] }
members_for_role = { role : set() for role in roles[:len(members)] }
for member, role in zip(members, roles):
members_for_role[role].append(member)
members_for_role[role].add(member)
roles = [ role(game, members_for_role[role]) for role in members_for_role.keys() ]
......
......@@ -9,7 +9,7 @@ from discord import Embed, Colour
class Werewolf(Role):
def info(self):
self.game.info.log(f'Die Werwölfe bringen {self.victim} um!')
self.game.info.log(f'Die Werwölfe bringen {self.victim.mention} um!')
@classmethod
def get_team(cls): return 'Werwölfe'
......@@ -37,6 +37,7 @@ class Werewolf(Role):
await self.channel.send(embed=Embed(colour=Colour(0x683820), description='Warten auf Amor...'))
await self.wait_for(Amor)
await self.channel.send(embed=Embed(colour=Colour(0x683820), description='Amor hat sich entschieden!'))
self.votes = dict()
self.vote_event.clear()
await gather(
self.game.channel.send(embed=Embed(colour=Colour(0x683820), description='Die Werwölfe erwachen und entscheiden sich für ihr nächstes Opfer...')),
......@@ -59,7 +60,8 @@ class Werewolf(Role):
else:
self.votes[ctx.author] = player
pprint(self.votes.keys)
if len(set(self.votes.values())) == 1 and self.votes.keys() == self.members:
if (len(set(self.votes.values())) == 1) and (set(self.votes.keys()) == { m for m in self.members if m in self.game.alive } ):
print('werwolf vote over')
self.game.night.victims[Werewolf] = next(iter(self.votes.values()))
self.victim = next(iter(self.votes.values()))
self.vote_event.set()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment