Commit 0cb46a3e authored by Ferdinand Schober's avatar Ferdinand Schober 💬
Browse files

bug fixes

parent 84b4bb3e
......@@ -58,11 +58,11 @@ class Werwolf(commands.Cog):
self.game_event.clear()
@commands.command()
async def accuse(self, ctx, player:Member):
async def accuse(self, ctx, *, player:Member):
await self.game.day.accuse(ctx, player)
@commands.command()
async def withdraw(self, ctx, player:Member):
async def withdraw(self, ctx, *, player:Member):
await self.game.day.withdraw(ctx, player)
@commands.command()
......@@ -70,7 +70,7 @@ class Werwolf(commands.Cog):
await self.game.day.confirm(ctx)
@commands.command()
async def vote(self, ctx, player:Member):
async def vote(self, ctx, *, player:Member):
if ctx.channel.id == Werewolf.get_channel_id():
await self.game.role[ctx.message.author].vote(ctx, player)
elif ctx.channel.id == Day.get_channel_id():
......@@ -86,19 +86,19 @@ class Werwolf(commands.Cog):
await self.game.role[ctx.message.author].heal()
@commands.command()
async def poison(self, ctx, player:Member):
async def poison(self, ctx, *, player:Member):
if ctx.channel.id == Witch.get_channel_id():
self.game.role[ctx.message.author].poison(player)
@commands.command()
async def see(self, ctx, player:Member):
async def see(self, ctx, *, player:Member):
if ctx.channel.id == Seer.get_channel_id():
await self.game.role[ctx.message.author].see(player)
@commands.command()
async def kill(self, ctx, player:Member):
async def kill(self, ctx, *, player:Member):
if ctx.channel.id == Witch.get_channel_id():
await self.game.role[ctx.message.author].kill(player)
await self.game.role[ctx.message.author].poison(player)
if isinstance(self.game.role[ctx.message.author], Hunter):
await self.game.role[ctx.message.author].kill(ctx, player)
......@@ -108,7 +108,7 @@ class Werwolf(commands.Cog):
await self.game.role[ctx.message.author].love(p1, p2)
@commands.command()
async def sleep(self, ctx, player:Member):
async def sleep(self, ctx, *, player:Member):
if ctx.channel.id == Whore.get_channel_id():
await self.game.role[ctx.message.author].sleep(player)
......
......@@ -87,7 +87,7 @@ class Day():
await self.channel.send(f'Die Stimme des Hauptmanns entschied die Wahl!')
victim = max(votes, key=votes.get)
await self.channel.send(f'{victim.mention} wird hingerichtet!')
await self.channel.send(f'{victim.mention} wird hingerichtet er ist {self.game.role[victim].get_name()}!')
await self.game.kill(victim)
async def accuse(self, ctx, player):
......
......@@ -45,9 +45,7 @@ class Game():
await self.channel.send(f'Es spielen mit: {[role.get_name() for role in self.role.values()]}')
while True:
if await self.night.tasks(): break
if await self.day.tasks(): break
if await self.day.tasks(): break
async def check_winconditions(self):
print({ self.role[p].get_team() for p in self.players})
......
......@@ -11,8 +11,8 @@ def distribute_roles(game, members):
from amor import Amor
from whore import Whore
from girl import Girl
l = [Werewolf, Hunter, Amor, Whore, Seer, Witch, Villager, Werewolf, Werewolf, Girl]
#l = [Werewolf, Villager, Seer, Witch, Werewolf, Hunter, Amor, Whore, Werewolf, Girl]
#l = [Werewolf, Hunter, Amor, Whore, Seer, Witch, Villager, Werewolf, Werewolf, Girl]
l = [Werewolf, Seer, Witch, Villager, Whore, Werewolf, Hunter, Amor, Werewolf, Girl]
random.shuffle(members)
roles = zip(l, itertools.repeat(game), members)
return dict(zip(members, [role[0](role[1], role[2]) for role in roles]))
......
......@@ -38,9 +38,12 @@ class Werewolf(Role):
if Werewolf.vote_event.is_set():
await self.channel.send('Die Abstimmung ist vorbei!')
else:
Werewolf.votes[ctx.message.author] = player
if len(set(Werewolf.votes.values())) == 1:
if Werewolf.votes.keys() == { p for p in self.game.players if isinstance(self.game.role[p], Werewolf) }:
self.game.night.victims[Werewolf] = next(iter(Werewolf.votes.values()))
Werewolf.votes = dict()
Werewolf.vote_event.set()
\ No newline at end of file
if player in self.game.players:
Werewolf.votes[ctx.message.author] = player
if len(set(Werewolf.votes.values())) == 1:
if Werewolf.votes.keys() == { p for p in self.game.players if isinstance(self.game.role[p], Werewolf) }:
self.game.night.victims[Werewolf] = next(iter(Werewolf.votes.values()))
Werewolf.votes = dict()
Werewolf.vote_event.set()
else:
await self.channel.send(f'{player.mention} ist bereits tot!')
\ No newline at end of file
......@@ -57,5 +57,8 @@ class Whore(Role):
await self.channel.send(f'Du hast schon letzte Nacht bei {player.mention} geschlafen!\n'
'Du bist eine Hure also benehm dich auch so! (no offense :^) )')
else:
self.last_player = player
self.whore_event.set()
\ No newline at end of file
if player not in self.game.players:
await self.channel.send(f'{player.mention} lebt nicht mehr!')
else:
self.last_player = player
self.whore_event.set()
\ No newline at end of file
......@@ -55,12 +55,16 @@ class Witch(Role):
async def poison(self, player):
if not self.poison_event.is_set():
self.game.night.victims[Witch] = player
self.poison_potion = False
await self.channel.send(f'{player.mention} wurde vergiftet!')
if player not in self.game.players:
await self.channel.send(f'{player.mention} ist bereits tot!')
else:
self.game.night.victims[Witch] = player
self.poison_potion = False
self.poison_event.set()
await self.channel.send(f'{player.mention} wurde vergiftet!')
else:
await self.channel.send('Du hast deinen Gifttrank bereits verbraucht!')
self.poison_event.set()
self.poison_event.set()
async def no(self):
self.poison_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