Average improvements

fight-fixes
bobloy 7 years ago
parent 2be0b05994
commit e6f566dfdc

@ -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")

@ -1,8 +1,6 @@
import asyncio
import discord
from datetime import datetime, timedelta
import random
from werewolf.player import Player
@ -60,9 +58,6 @@ class Game:
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)

@ -1,8 +1,6 @@
import asyncio
import discord
from datetime import datetime, timedelta
class Player:
"""

@ -1,5 +1,6 @@
import asyncio
class Role:
"""
Base Role class for werewolf game

@ -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)

@ -5,8 +5,6 @@ from discord.ext import commands
from redbot.core import Config
from datetime import datetime, timedelta
from werewolf.game import Game
@ -49,7 +47,6 @@ class Werewolf:
else:
await ctx.send("New game has started")
@commands.guild_only()
@ww.command()
async def join(self, ctx):

Loading…
Cancel
Save