further progress
This commit is contained in:
parent
c7eafed293
commit
976d041073
@ -22,17 +22,58 @@ class Game:
|
||||
self.start_vote = 0
|
||||
|
||||
self.started = False
|
||||
self.game_over = False
|
||||
|
||||
self.village_channel = None
|
||||
self.secret_channels = {}
|
||||
|
||||
|
||||
|
||||
|
||||
async def setup(self, ctx):
|
||||
"""
|
||||
Runs the initial setup
|
||||
"""
|
||||
if self.role_code:
|
||||
if not await self.get_roles():
|
||||
|
||||
if not self.roles:
|
||||
ctx.send("No game code set, cannot start until this is set")
|
||||
1. Assign Roles
|
||||
2. Create Channels
|
||||
2a. Channel Permissions :eyes:
|
||||
3. Check Initial role setup (including alerts)
|
||||
4. Start game
|
||||
"""
|
||||
|
||||
|
||||
async def _cycle(self):
|
||||
"""
|
||||
Each event calls the next event
|
||||
|
||||
_at_start()
|
||||
|
||||
_at_day_start()
|
||||
_at_vote()
|
||||
_at_kill()
|
||||
_at_day_end()
|
||||
_at_night_begin()
|
||||
_at_night_end()
|
||||
|
||||
and repeat with _at_morning_start() again
|
||||
"""
|
||||
await self._at_start():
|
||||
|
||||
async def _at_start(self):
|
||||
|
||||
async def _at_day_start(self):
|
||||
|
||||
async def _at_vote(self):
|
||||
|
||||
async def _at_kill(self):
|
||||
|
||||
async def _at_day_end(self):
|
||||
|
||||
async def _at_night_start(self):
|
||||
|
||||
async def _at_night_end(self):
|
||||
|
||||
|
||||
async def join(self, member: discord.Member):
|
||||
"""
|
||||
Joins a game
|
||||
|
@ -36,7 +36,7 @@ class Werewolf:
|
||||
await ctx.send_help()
|
||||
|
||||
@ww.command()
|
||||
async def join(self, ctx, setup_id=None):
|
||||
async def join(self, ctx, role_code=None):
|
||||
"""
|
||||
Joins a game of Werewolf or start a new one
|
||||
"""
|
||||
@ -57,22 +57,10 @@ class Werewolf:
|
||||
out = await game.quit(ctx.author)
|
||||
|
||||
ctx.send(out)
|
||||
|
||||
@ww.command()
|
||||
async def start(self, ctx):
|
||||
"""
|
||||
Vote to start a game of Werewolf
|
||||
"""
|
||||
|
||||
game = self._get_game(ctx)
|
||||
|
||||
out = await game.start_vote(ctx.author)
|
||||
|
||||
ctx.send(out)
|
||||
|
||||
def _get_game(self, ctx, setup):
|
||||
|
||||
def _get_game(self, ctx, role_code):
|
||||
if ctx.guild.id not in self.games:
|
||||
self.games[ctx.guild.id] = Game()
|
||||
self.games[ctx.guild.id] = Game(role_code)
|
||||
|
||||
return self.games[ctx.guild.id]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user