pep8
This commit is contained in:
parent
e03c32926e
commit
6e87f41dcc
@ -28,7 +28,7 @@ double digit position preempted by `-`
|
|||||||
async def parse_code(code):
|
async def parse_code(code):
|
||||||
"""Do the magic described above"""
|
"""Do the magic described above"""
|
||||||
out = []
|
out = []
|
||||||
decode = code.copy() # for now, pass exact names
|
decode = code.copy() # for now, pass exact names
|
||||||
for role_id in decode:
|
for role_id in decode:
|
||||||
print(role_id)
|
print(role_id)
|
||||||
if role_id == "Villager":
|
if role_id == "Villager":
|
||||||
|
@ -13,15 +13,15 @@ class Game:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
default_secret_channel = {
|
default_secret_channel = {
|
||||||
"channel": None,
|
"channel": None,
|
||||||
"players": [],
|
"players": [],
|
||||||
"votegroup": None # uninitialized VoteGroup
|
"votegroup": None # uninitialized VoteGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
morning_messages = [
|
morning_messages = [
|
||||||
"**The sun rises on day {} in the village..**",
|
"**The sun rises on day {} in the village..**",
|
||||||
"**Morning has arrived on day {}..**"
|
"**Morning has arrived on day {}..**"
|
||||||
]
|
]
|
||||||
|
|
||||||
day_vote_count = 3
|
day_vote_count = 3
|
||||||
|
|
||||||
@ -81,9 +81,9 @@ class Game:
|
|||||||
|
|
||||||
# Create category and channel with individual overwrites
|
# Create category and channel with individual overwrites
|
||||||
overwrite = {
|
overwrite = {
|
||||||
self.guild.default_role: discord.PermissionOverwrite(read_messages=False, send_messages=True),
|
self.guild.default_role: discord.PermissionOverwrite(read_messages=False, send_messages=True),
|
||||||
self.guild.me: discord.PermissionOverwrite(read_messages=True, send_messages=True)
|
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 "
|
self.channel_category = await self.guild.create_category("ww-game", overwrites=overwrite, reason="New game of "
|
||||||
"werewolf")
|
"werewolf")
|
||||||
@ -101,11 +101,11 @@ class Game:
|
|||||||
await self._at_game_start() # This will queue channels and votegroups to be made
|
await self._at_game_start() # This will queue channels and votegroups to be made
|
||||||
print("Post at_game_start")
|
print("Post at_game_start")
|
||||||
for channel_id in self.p_channels:
|
for channel_id in self.p_channels:
|
||||||
print("Channel id: "+channel_id)
|
print("Channel id: " + channel_id)
|
||||||
overwrite = {
|
overwrite = {
|
||||||
self.guild.default_role: discord.PermissionOverwrite(read_messages=False),
|
self.guild.default_role: discord.PermissionOverwrite(read_messages=False),
|
||||||
self.guild.me: discord.PermissionOverwrite(read_messages=True)
|
self.guild.me: discord.PermissionOverwrite(read_messages=True)
|
||||||
}
|
}
|
||||||
|
|
||||||
for player in self.p_channels[channel_id]["players"]:
|
for player in self.p_channels[channel_id]["players"]:
|
||||||
overwrite[player.member] = discord.PermissionOverwrite(read_messages=True)
|
overwrite[player.member] = discord.PermissionOverwrite(read_messages=True)
|
||||||
@ -126,7 +126,7 @@ class Game:
|
|||||||
|
|
||||||
print("Pre-cycle")
|
print("Pre-cycle")
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
asyncio.ensure_future(self._cycle()) # Start the loop
|
asyncio.ensure_future(self._cycle()) # Start the loop
|
||||||
|
|
||||||
############START Notify structure############
|
############START Notify structure############
|
||||||
async def _cycle(self):
|
async def _cycle(self):
|
||||||
@ -165,7 +165,7 @@ class Game:
|
|||||||
return not self.can_vote or not self.day_time or self.game_over
|
return not self.can_vote or not self.day_time or self.game_over
|
||||||
|
|
||||||
self.day_count += 1
|
self.day_count += 1
|
||||||
embed=discord.Embed(title=random.choice(self.morning_messages).format(self.day_count))
|
embed = discord.Embed(title=random.choice(self.morning_messages).format(self.day_count))
|
||||||
for result in self.night_results:
|
for result in self.night_results:
|
||||||
embed.add_field(name=result, value="________", inline=False)
|
embed.add_field(name=result, value="________", inline=False)
|
||||||
|
|
||||||
@ -231,9 +231,9 @@ class Game:
|
|||||||
down_votes = sum(p.emoji == "👎" and not p.me for p in reaction_list)
|
down_votes = sum(p.emoji == "👎" and not p.me for p in reaction_list)
|
||||||
|
|
||||||
if len(down_votes) > len(up_votes):
|
if len(down_votes) > len(up_votes):
|
||||||
embed=discord.Embed(title="Vote Results", color=0xff0000)
|
embed = discord.Embed(title="Vote Results", color=0xff0000)
|
||||||
else:
|
else:
|
||||||
embed=discord.Embed(title="Vote Results", color=0x80ff80)
|
embed = discord.Embed(title="Vote Results", color=0x80ff80)
|
||||||
|
|
||||||
embed.add_field(name="👎", value="**{}**".format(len(up_votes)), inline=True)
|
embed.add_field(name="👎", value="**{}**".format(len(up_votes)), inline=True)
|
||||||
embed.add_field(name="👍", value="**{}**".format(len(down_votes)), inline=True)
|
embed.add_field(name="👍", value="**{}**".format(len(down_votes)), inline=True)
|
||||||
@ -295,7 +295,7 @@ class Game:
|
|||||||
|
|
||||||
await asyncio.sleep(120) # 2 minutes
|
await asyncio.sleep(120) # 2 minutes
|
||||||
await self.village_channel.send(embed=discord.Embed(title="**Two minutes of night remain...**"))
|
await self.village_channel.send(embed=discord.Embed(title="**Two minutes of night remain...**"))
|
||||||
await asyncio.sleep(90) # 1.5 minutes
|
await asyncio.sleep(90) # 1.5 minutes
|
||||||
await self.village_channel.send(embed=discord.Embed(title="**Thirty seconds until sunrise...**"))
|
await self.village_channel.send(embed=discord.Embed(title="**Thirty seconds until sunrise...**"))
|
||||||
await asyncio.sleep(30) # .5 minutes
|
await asyncio.sleep(30) # .5 minutes
|
||||||
|
|
||||||
@ -316,14 +316,14 @@ class Game:
|
|||||||
await self._notify(8, data)
|
await self._notify(8, data)
|
||||||
|
|
||||||
async def _notify(self, event, data=None):
|
async def _notify(self, event, data=None):
|
||||||
for i in range(1,7): # action guide 1-6 (0 is no action)
|
for i in range(1, 7): # action guide 1-6 (0 is no action)
|
||||||
tasks = []
|
tasks = []
|
||||||
# Role priorities
|
# Role priorities
|
||||||
role_order = [role for role in self.roles if role.action_list[event][1]==i]
|
role_order = [role for role in self.roles if role.action_list[event][1] == i]
|
||||||
for role in role_order:
|
for role in role_order:
|
||||||
tasks.append(asyncio.ensure_future(role.on_event(event, data), loop=self.loop))
|
tasks.append(asyncio.ensure_future(role.on_event(event, data), loop=self.loop))
|
||||||
# VoteGroup priorities
|
# VoteGroup priorities
|
||||||
vote_order = [vg for vg in self.vote_groups.values() if vg.action_list[event][1]==i]
|
vote_order = [vg for vg in self.vote_groups.values() if vg.action_list[event][1] == i]
|
||||||
for vote_group in vote_order:
|
for vote_group in vote_order:
|
||||||
tasks.append(asyncio.ensure_future(vote_group.on_event(event, data), loop=self.loop))
|
tasks.append(asyncio.ensure_future(vote_group.on_event(event, data), loop=self.loop))
|
||||||
if tasks:
|
if tasks:
|
||||||
@ -333,7 +333,7 @@ class Game:
|
|||||||
############END Notify structure############
|
############END Notify structure############
|
||||||
|
|
||||||
async def generate_targets(self, channel):
|
async def generate_targets(self, channel):
|
||||||
embed=discord.Embed(title="Remaining Players")
|
embed = discord.Embed(title="Remaining Players")
|
||||||
for i in range(len(self.players)):
|
for i in range(len(self.players)):
|
||||||
player = self.players[i]
|
player = self.players[i]
|
||||||
if player.alive:
|
if player.alive:
|
||||||
@ -517,7 +517,7 @@ class Game:
|
|||||||
await self.dead_perms(self.village_channel, player.member)
|
await self.dead_perms(self.village_channel, player.member)
|
||||||
# Add a punishment system for quitting games later
|
# Add a punishment system for quitting games later
|
||||||
|
|
||||||
async def kill(self, target_id, source=None, method: str=None, novisit=False):
|
async def kill(self, target_id, source=None, method: str = None, novisit=False):
|
||||||
"""
|
"""
|
||||||
Attempt to kill a target
|
Attempt to kill a target
|
||||||
Source allows admin override
|
Source allows admin override
|
||||||
|
@ -1,10 +1,23 @@
|
|||||||
{
|
{
|
||||||
"author" : ["Bobloy"],
|
"author": [
|
||||||
"bot_version" : [3,0,0],
|
"Bobloy"
|
||||||
"description" : "Customizable Werewolf Game",
|
],
|
||||||
"hidden" : false,
|
"bot_version": [
|
||||||
"install_msg" : "Thank you for installing Werewolf! Use [p]wwset to run inital setup",
|
3,
|
||||||
"requirements" : [],
|
0,
|
||||||
"short" : "Werewolf Game",
|
0
|
||||||
"tags" : ["mafia", "werewolf", "party", "fun", "game", "bobloy"]
|
],
|
||||||
|
"description": "Customizable Werewolf Game",
|
||||||
|
"hidden": false,
|
||||||
|
"install_msg": "Thank you for installing Werewolf! Use [p]wwset to run inital setup",
|
||||||
|
"requirements": [],
|
||||||
|
"short": "Werewolf Game",
|
||||||
|
"tags": [
|
||||||
|
"mafia",
|
||||||
|
"werewolf",
|
||||||
|
"party",
|
||||||
|
"fun",
|
||||||
|
"game",
|
||||||
|
"bobloy"
|
||||||
|
]
|
||||||
}
|
}
|
@ -27,4 +27,4 @@ class Player:
|
|||||||
self.id = target_id
|
self.id = target_id
|
||||||
|
|
||||||
async def send_dm(self, message):
|
async def send_dm(self, message):
|
||||||
await self.member.send(message) # Lets do embeds later
|
await self.member.send(message) # Lets do embeds later
|
||||||
|
@ -37,15 +37,15 @@ class Role:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
rand_choice = False # Determines if it can be picked as a random role (False for unusually disruptive roles)
|
rand_choice = False # Determines if it can be picked as a random role (False for unusually disruptive roles)
|
||||||
category = [0] # List of enrolled categories (listed above)
|
category = [0] # List of enrolled categories (listed above)
|
||||||
alignment = 0 # 1: Town, 2: Werewolf, 3: Neutral
|
alignment = 0 # 1: Town, 2: Werewolf, 3: Neutral
|
||||||
channel_id = "" # Empty for no private channel
|
channel_id = "" # Empty for no private channel
|
||||||
unique = False # Only one of this role per game
|
unique = False # Only one of this role per game
|
||||||
game_start_message = (
|
game_start_message = (
|
||||||
"Your role is **Default**\n"
|
"Your role is **Default**\n"
|
||||||
"You win by testing the game\n"
|
"You win by testing the game\n"
|
||||||
"Lynch players during the day with `[p]ww vote <ID>`"
|
"Lynch players during the day with `[p]ww vote <ID>`"
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, game):
|
def __init__(self, game):
|
||||||
self.game = game
|
self.game = game
|
||||||
@ -63,7 +63,7 @@ class Role:
|
|||||||
(self._at_night_start, 0),
|
(self._at_night_start, 0),
|
||||||
(self._at_night_end, 0),
|
(self._at_night_end, 0),
|
||||||
(self._at_visit, 0)
|
(self._at_visit, 0)
|
||||||
]
|
]
|
||||||
|
|
||||||
async def on_event(self, event, data):
|
async def on_event(self, event, data):
|
||||||
"""
|
"""
|
||||||
@ -114,7 +114,7 @@ class Role:
|
|||||||
if self.channel_id:
|
if self.channel_id:
|
||||||
await self.game.register_channel(self.channel_id, self)
|
await self.game.register_channel(self.channel_id, self)
|
||||||
|
|
||||||
await self.player.send_dm(self.game_start_message) #Maybe embeds eventually
|
await self.player.send_dm(self.game_start_message) # Maybe embeds eventually
|
||||||
|
|
||||||
async def _at_day_start(self, data=None):
|
async def _at_day_start(self, data=None):
|
||||||
pass
|
pass
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
from werewolf.role import Role
|
from werewolf.role import Role
|
||||||
|
|
||||||
class Seer(Role):
|
|
||||||
|
|
||||||
|
class Seer(Role):
|
||||||
rand_choice = False # Determines if it can be picked as a random role (False for unusually disruptive roles)
|
rand_choice = False # Determines if it can be picked as a random role (False for unusually disruptive roles)
|
||||||
category = [1,2] # List of enrolled categories (listed above)
|
category = [1, 2] # List of enrolled categories (listed above)
|
||||||
alignment = 1 # 1: Town, 2: Werewolf, 3: Neutral
|
alignment = 1 # 1: Town, 2: Werewolf, 3: Neutral
|
||||||
channel_id = "" # Empty for no private channel
|
channel_id = "" # Empty for no private channel
|
||||||
unique = False # Only one of this role per game
|
unique = False # Only one of this role per game
|
||||||
game_start_message=(
|
game_start_message = (
|
||||||
"Your role is **Seer**\n"
|
"Your role is **Seer**\n"
|
||||||
"You win by lynching all evil in the town\n"
|
"You win by lynching all evil in the town\n"
|
||||||
"Lynch players during the day with `[p]ww vote <ID>`\n"
|
"Lynch players during the day with `[p]ww vote <ID>`\n"
|
||||||
"Check for werewolves at night with `[p]ww choose <ID>`"
|
"Check for werewolves at night with `[p]ww choose <ID>`"
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, game):
|
def __init__(self, game):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
@ -30,31 +30,31 @@ class Seer(Role):
|
|||||||
(self._at_day_end, 0),
|
(self._at_day_end, 0),
|
||||||
(self._at_night_start, 2),
|
(self._at_night_start, 2),
|
||||||
(self._at_night_end, 4)
|
(self._at_night_end, 4)
|
||||||
]
|
]
|
||||||
|
|
||||||
# async def on_event(self, event, data):
|
# async def on_event(self, event, data):
|
||||||
# """
|
# """
|
||||||
# See Game class for event guide
|
# See Game class for event guide
|
||||||
# """
|
# """
|
||||||
|
#
|
||||||
# await self.action_list[event][0](data)
|
# await self.action_list[event][0](data)
|
||||||
|
#
|
||||||
|
#
|
||||||
# async def assign_player(self, player):
|
# async def assign_player(self, player):
|
||||||
# """
|
# """
|
||||||
# Give this role a player
|
# Give this role a player
|
||||||
# Can be used after the game has started (Cult, Mason, other role swap)
|
# Can be used after the game has started (Cult, Mason, other role swap)
|
||||||
# """
|
# """
|
||||||
|
#
|
||||||
# player.role = self
|
# player.role = self
|
||||||
# self.player = player
|
# self.player = player
|
||||||
|
#
|
||||||
# async def get_alignment(self, source=None):
|
# async def get_alignment(self, source=None):
|
||||||
# """
|
# """
|
||||||
# Interaction for power access of team (Village, Werewolf, Other)
|
# Interaction for power access of team (Village, Werewolf, Other)
|
||||||
# Unlikely to be able to deceive this
|
# Unlikely to be able to deceive this
|
||||||
# """
|
# """
|
||||||
# return self.alignment
|
# return self.alignment
|
||||||
|
|
||||||
async def see_alignment(self, source=None):
|
async def see_alignment(self, source=None):
|
||||||
"""
|
"""
|
||||||
@ -78,28 +78,27 @@ class Seer(Role):
|
|||||||
return "Villager"
|
return "Villager"
|
||||||
|
|
||||||
# async def _at_game_start(self, data=None):
|
# async def _at_game_start(self, data=None):
|
||||||
# pass
|
# pass
|
||||||
|
#
|
||||||
# async def _at_day_start(self, data=None):
|
# async def _at_day_start(self, data=None):
|
||||||
# pass
|
# pass
|
||||||
|
#
|
||||||
# async def _at_voted(self, target=None):
|
# async def _at_voted(self, target=None):
|
||||||
# pass
|
# pass
|
||||||
|
#
|
||||||
# async def _at_kill(self, target=None):
|
# async def _at_kill(self, target=None):
|
||||||
# pass
|
# pass
|
||||||
|
#
|
||||||
# async def _at_hang(self, target=None):
|
# async def _at_hang(self, target=None):
|
||||||
# pass
|
# pass
|
||||||
|
#
|
||||||
# async def _at_day_end(self):
|
# async def _at_day_end(self):
|
||||||
# pass
|
# pass
|
||||||
|
|
||||||
async def _at_night_start(self, data=None):
|
async def _at_night_start(self, data=None):
|
||||||
await self.game.generate_targets(self.player.member)
|
await self.game.generate_targets(self.player.member)
|
||||||
await self.player.send_dm("{}\n**Pick a target to see tonight**\n")
|
await self.player.send_dm("{}\n**Pick a target to see tonight**\n")
|
||||||
|
|
||||||
|
|
||||||
async def _at_night_end(self, data=None):
|
async def _at_night_end(self, data=None):
|
||||||
target = await self.game.visit(self.see_target)
|
target = await self.game.visit(self.see_target)
|
||||||
|
|
||||||
@ -115,22 +114,22 @@ class Seer(Role):
|
|||||||
await self.player.send_dm(out)
|
await self.player.send_dm(out)
|
||||||
|
|
||||||
# async def _at_visit(self, data=None):
|
# async def _at_visit(self, data=None):
|
||||||
# pass
|
# pass
|
||||||
|
#
|
||||||
# async def kill(self, source):
|
# async def kill(self, source):
|
||||||
# """
|
# """
|
||||||
# Called when someone is trying to kill you!
|
# Called when someone is trying to kill you!
|
||||||
# Can you do anything about it?
|
# Can you do anything about it?
|
||||||
# self.alive is now set to False, set to True to stay alive
|
# self.alive is now set to False, set to True to stay alive
|
||||||
# """
|
# """
|
||||||
# pass
|
# pass
|
||||||
|
#
|
||||||
# async def visit(self, source):
|
# async def visit(self, source):
|
||||||
# """
|
# """
|
||||||
# Called whenever a night action targets you
|
# Called whenever a night action targets you
|
||||||
# Source is the player who visited you
|
# Source is the player who visited you
|
||||||
# """
|
# """
|
||||||
# pass
|
# pass
|
||||||
|
|
||||||
async def choose(self, ctx, data):
|
async def choose(self, ctx, data):
|
||||||
"""Handle night actions"""
|
"""Handle night actions"""
|
||||||
|
@ -4,10 +4,9 @@ from werewolf.votegroups.wolfvote import WolfVote
|
|||||||
|
|
||||||
|
|
||||||
class VanillaWerewolf(Role):
|
class VanillaWerewolf(Role):
|
||||||
|
|
||||||
rand_choice = True
|
rand_choice = True
|
||||||
category = [11, 15]
|
category = [11, 15]
|
||||||
alignment = 2 # 1: Town, 2: Werewolf, 3: Neutral
|
alignment = 2 # 1: Town, 2: Werewolf, 3: Neutral
|
||||||
channel_id = "werewolves"
|
channel_id = "werewolves"
|
||||||
unique = False
|
unique = False
|
||||||
game_start_message = (
|
game_start_message = (
|
||||||
@ -15,9 +14,7 @@ class VanillaWerewolf(Role):
|
|||||||
"You win by killing everyone else in the village\n"
|
"You win by killing everyone else in the village\n"
|
||||||
"Lynch players during the day with `[p]ww vote <ID>`\n"
|
"Lynch players during the day with `[p]ww vote <ID>`\n"
|
||||||
"Vote to kill players at night with `[p]ww vote <ID>`"
|
"Vote to kill players at night with `[p]ww vote <ID>`"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, game):
|
def __init__(self, game):
|
||||||
super().__init__(game)
|
super().__init__(game)
|
||||||
@ -32,30 +29,30 @@ class VanillaWerewolf(Role):
|
|||||||
(self._at_night_start, 0),
|
(self._at_night_start, 0),
|
||||||
(self._at_night_end, 0),
|
(self._at_night_end, 0),
|
||||||
(self._at_visit, 0)
|
(self._at_visit, 0)
|
||||||
]
|
]
|
||||||
|
|
||||||
# async def on_event(self, event, data):
|
# async def on_event(self, event, data):
|
||||||
# """
|
# """
|
||||||
# See Game class for event guide
|
# See Game class for event guide
|
||||||
# """
|
# """
|
||||||
|
|
||||||
# await self.action_list[event][0](data)
|
# await self.action_list[event][0](data)
|
||||||
|
|
||||||
# async def assign_player(self, player):
|
# async def assign_player(self, player):
|
||||||
# """
|
# """
|
||||||
# Give this role a player
|
# Give this role a player
|
||||||
# Can be used after the game has started (Cult, Mason, role swap)
|
# Can be used after the game has started (Cult, Mason, role swap)
|
||||||
# """
|
# """
|
||||||
|
|
||||||
# player.role = self
|
# player.role = self
|
||||||
# self.player = player
|
# self.player = player
|
||||||
|
|
||||||
# async def get_alignment(self, source=None):
|
# async def get_alignment(self, source=None):
|
||||||
# """
|
# """
|
||||||
# Interaction for power access of team (Village, Werewolf, Other)
|
# Interaction for power access of team (Village, Werewolf, Other)
|
||||||
# Unlikely to be able to deceive this
|
# Unlikely to be able to deceive this
|
||||||
# """
|
# """
|
||||||
# return self.alignment
|
# return self.alignment
|
||||||
|
|
||||||
async def see_alignment(self, source=None):
|
async def see_alignment(self, source=None):
|
||||||
"""
|
"""
|
||||||
@ -80,50 +77,49 @@ class VanillaWerewolf(Role):
|
|||||||
|
|
||||||
async def _at_game_start(self, data=None):
|
async def _at_game_start(self, data=None):
|
||||||
if self.channel_id:
|
if self.channel_id:
|
||||||
print("Wolf has channel_id: "+self.channel_id)
|
print("Wolf has channel_id: " + self.channel_id)
|
||||||
await self.game.register_channel(self.channel_id, self, WolfVote) # Add VoteGroup WolfVote
|
await self.game.register_channel(self.channel_id, self, WolfVote) # Add VoteGroup WolfVote
|
||||||
|
|
||||||
await self.player.send_dm(self.game_start_message)
|
await self.player.send_dm(self.game_start_message)
|
||||||
|
|
||||||
|
|
||||||
# async def _at_day_start(self, data=None):
|
# async def _at_day_start(self, data=None):
|
||||||
# super()._at_day_start(data)
|
# super()._at_day_start(data)
|
||||||
|
|
||||||
# async def _at_voted(self, data=None):
|
# async def _at_voted(self, data=None):
|
||||||
# super()._at_voted(data)
|
# super()._at_voted(data)
|
||||||
|
|
||||||
# async def _at_kill(self, data=None):
|
# async def _at_kill(self, data=None):
|
||||||
# super()._at_kill(data)
|
# super()._at_kill(data)
|
||||||
|
|
||||||
# async def _at_hang(self, data=None):
|
# async def _at_hang(self, data=None):
|
||||||
# super()._at_hang(data)
|
# super()._at_hang(data)
|
||||||
|
|
||||||
# async def _at_day_end(self, data=None):
|
# async def _at_day_end(self, data=None):
|
||||||
# super()._at_day_end(data)
|
# super()._at_day_end(data)
|
||||||
|
|
||||||
# async def _at_night_start(self, data=None):
|
# async def _at_night_start(self, data=None):
|
||||||
# super()._at_night_start(data)
|
# super()._at_night_start(data)
|
||||||
|
|
||||||
# async def _at_night_end(self, data=None):
|
# async def _at_night_end(self, data=None):
|
||||||
# super()._at_night_end(data)
|
# super()._at_night_end(data)
|
||||||
|
|
||||||
# async def _at_visit(self, data=None):
|
# async def _at_visit(self, data=None):
|
||||||
# pass
|
# pass
|
||||||
|
|
||||||
# async def kill(self, source):
|
# async def kill(self, source):
|
||||||
# """
|
# """
|
||||||
# Called when someone is trying to kill you!
|
# Called when someone is trying to kill you!
|
||||||
# Can you do anything about it?
|
# Can you do anything about it?
|
||||||
# self.alive is now set to False, set to True to stay alive
|
# self.alive is now set to False, set to True to stay alive
|
||||||
# """
|
# """
|
||||||
# pass
|
# pass
|
||||||
|
|
||||||
# async def visit(self, source):
|
# async def visit(self, source):
|
||||||
# """
|
# """
|
||||||
# Called whenever a night action targets you
|
# Called whenever a night action targets you
|
||||||
# Source is the player who visited you
|
# Source is the player who visited you
|
||||||
# """
|
# """
|
||||||
# pass
|
# pass
|
||||||
|
|
||||||
async def choose(self, ctx, data):
|
async def choose(self, ctx, data):
|
||||||
"""Handle night actions"""
|
"""Handle night actions"""
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
from werewolf.role import Role
|
from werewolf.role import Role
|
||||||
|
|
||||||
class Villager(Role):
|
|
||||||
|
|
||||||
|
class Villager(Role):
|
||||||
rand_choice = False # Determines if it can be picked as a random role (False for unusually disruptive roles)
|
rand_choice = False # Determines if it can be picked as a random role (False for unusually disruptive roles)
|
||||||
category = [1] # List of enrolled categories (listed above)
|
category = [1] # List of enrolled categories (listed above)
|
||||||
alignment = 1 # 1: Town, 2: Werewolf, 3: Neutral
|
alignment = 1 # 1: Town, 2: Werewolf, 3: Neutral
|
||||||
channel_id = "" # Empty for no private channel
|
channel_id = "" # Empty for no private channel
|
||||||
unique = False # Only one of this role per game
|
unique = False # Only one of this role per game
|
||||||
game_start_message=(
|
game_start_message = (
|
||||||
"Your role is **Villager**\n"
|
"Your role is **Villager**\n"
|
||||||
"You win by lynching all evil in the town\n"
|
"You win by lynching all evil in the town\n"
|
||||||
"Lynch players during the day with `[p]ww vote <ID>`"
|
"Lynch players during the day with `[p]ww vote <ID>`"
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, game):
|
def __init__(self, game):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
@ -19,42 +19,42 @@ class Villager(Role):
|
|||||||
# self.player = None
|
# self.player = None
|
||||||
# self.blocked = False
|
# self.blocked = False
|
||||||
# self.properties = {} # Extra data for other roles (i.e. arsonist)
|
# self.properties = {} # Extra data for other roles (i.e. arsonist)
|
||||||
|
#
|
||||||
# self.action_list = [
|
# self.action_list = [
|
||||||
# (self._at_game_start, 0), # (Action, Priority)
|
# (self._at_game_start, 0), # (Action, Priority)
|
||||||
# (self._at_day_start, 0),
|
# (self._at_day_start, 0),
|
||||||
# (self._at_voted, 0),
|
# (self._at_voted, 0),
|
||||||
# (self._at_kill, 0),
|
# (self._at_kill, 0),
|
||||||
# (self._at_hang, 0),
|
# (self._at_hang, 0),
|
||||||
# (self._at_day_end, 0),
|
# (self._at_day_end, 0),
|
||||||
# (self._at_night_start, 0),
|
# (self._at_night_start, 0),
|
||||||
# (self._at_night_end, 0),
|
# (self._at_night_end, 0),
|
||||||
# (self._at_visit, 0)
|
# (self._at_visit, 0)
|
||||||
# ]
|
# ]
|
||||||
|
|
||||||
# async def on_event(self, event, data):
|
# async def on_event(self, event, data):
|
||||||
# """
|
# """
|
||||||
# See Game class for event guide
|
# See Game class for event guide
|
||||||
# """
|
# """
|
||||||
|
#
|
||||||
# await self.action_list[event][0](data)
|
# await self.action_list[event][0](data)
|
||||||
|
#
|
||||||
|
#
|
||||||
# async def assign_player(self, player):
|
# async def assign_player(self, player):
|
||||||
# """
|
# """
|
||||||
# Give this role a player
|
# Give this role a player
|
||||||
# Can be used after the game has started (Cult, Mason, other role swap)
|
# Can be used after the game has started (Cult, Mason, other role swap)
|
||||||
# """
|
# """
|
||||||
|
#
|
||||||
# player.role = self
|
# player.role = self
|
||||||
# self.player = player
|
# self.player = player
|
||||||
|
#
|
||||||
# async def get_alignment(self, source=None):
|
# async def get_alignment(self, source=None):
|
||||||
# """
|
# """
|
||||||
# Interaction for power access of team (Village, Werewolf, Other)
|
# Interaction for power access of team (Village, Werewolf, Other)
|
||||||
# Unlikely to be able to deceive this
|
# Unlikely to be able to deceive this
|
||||||
# """
|
# """
|
||||||
# return self.alignment
|
# return self.alignment
|
||||||
|
|
||||||
async def see_alignment(self, source=None):
|
async def see_alignment(self, source=None):
|
||||||
"""
|
"""
|
||||||
@ -78,47 +78,47 @@ class Villager(Role):
|
|||||||
return "Villager"
|
return "Villager"
|
||||||
|
|
||||||
# async def _at_game_start(self, data=None):
|
# async def _at_game_start(self, data=None):
|
||||||
# pass
|
# pass
|
||||||
|
#
|
||||||
# async def _at_day_start(self, data=None):
|
# async def _at_day_start(self, data=None):
|
||||||
# pass
|
# pass
|
||||||
|
#
|
||||||
# async def _at_voted(self, target=None):
|
# async def _at_voted(self, target=None):
|
||||||
# pass
|
# pass
|
||||||
|
#
|
||||||
# async def _at_kill(self, target=None):
|
# async def _at_kill(self, target=None):
|
||||||
# pass
|
# pass
|
||||||
|
#
|
||||||
# async def _at_hang(self, target=None):
|
# async def _at_hang(self, target=None):
|
||||||
# pass
|
# pass
|
||||||
|
#
|
||||||
# async def _at_day_end(self):
|
# async def _at_day_end(self):
|
||||||
# pass
|
# pass
|
||||||
|
#
|
||||||
# async def _at_night_start(self):
|
# async def _at_night_start(self):
|
||||||
# pass
|
# pass
|
||||||
|
#
|
||||||
# async def _at_night_end(self):
|
# async def _at_night_end(self):
|
||||||
# pass
|
# pass
|
||||||
|
#
|
||||||
# async def _at_visit(self, data=None):
|
# async def _at_visit(self, data=None):
|
||||||
# pass
|
# pass
|
||||||
|
#
|
||||||
# async def kill(self, source):
|
# async def kill(self, source):
|
||||||
# """
|
# """
|
||||||
# Called when someone is trying to kill you!
|
# Called when someone is trying to kill you!
|
||||||
# Can you do anything about it?
|
# Can you do anything about it?
|
||||||
# self.alive is now set to False, set to True to stay alive
|
# self.alive is now set to False, set to True to stay alive
|
||||||
# """
|
# """
|
||||||
# pass
|
# pass
|
||||||
|
#
|
||||||
# async def visit(self, source):
|
# async def visit(self, source):
|
||||||
# """
|
# """
|
||||||
# Called whenever a night action targets you
|
# Called whenever a night action targets you
|
||||||
# Source is the player who visited you
|
# Source is the player who visited you
|
||||||
# """
|
# """
|
||||||
# pass
|
# pass
|
||||||
|
#
|
||||||
# async def choose(self, ctx, data):
|
# async def choose(self, ctx, data):
|
||||||
# """Handle night actions"""
|
# """Handle night actions"""
|
||||||
# pass
|
# pass
|
||||||
|
@ -4,7 +4,7 @@ class VoteGroup:
|
|||||||
Handles secret channels and group decisions
|
Handles secret channels and group decisions
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alignment = 0 # 1: Town, 2: Werewolf, 3: Neutral
|
alignment = 0 # 1: Town, 2: Werewolf, 3: Neutral
|
||||||
channel_id = ""
|
channel_id = ""
|
||||||
|
|
||||||
def __init__(self, game, channel):
|
def __init__(self, game, channel):
|
||||||
@ -24,7 +24,7 @@ class VoteGroup:
|
|||||||
(self._at_night_start, 2),
|
(self._at_night_start, 2),
|
||||||
(self._at_night_end, 0),
|
(self._at_night_end, 0),
|
||||||
(self._at_visit, 0)
|
(self._at_visit, 0)
|
||||||
]
|
]
|
||||||
|
|
||||||
async def on_event(self, event, data):
|
async def on_event(self, event, data):
|
||||||
"""
|
"""
|
||||||
|
@ -8,7 +8,7 @@ class WolfVote(VoteGroup):
|
|||||||
Werewolf implementation of base VoteGroup class
|
Werewolf implementation of base VoteGroup class
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alignment = 2 # 1: Town, 2: Werewolf, 3: Neutral
|
alignment = 2 # 1: Town, 2: Werewolf, 3: Neutral
|
||||||
channel_id = "werewolves"
|
channel_id = "werewolves"
|
||||||
|
|
||||||
kill_messages = [
|
kill_messages = [
|
||||||
@ -35,9 +35,10 @@ class WolfVote(VoteGroup):
|
|||||||
(self._at_night_start, 2),
|
(self._at_night_start, 2),
|
||||||
(self._at_night_end, 5), # Kill priority
|
(self._at_night_end, 5), # Kill priority
|
||||||
(self._at_visit, 0)
|
(self._at_visit, 0)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# async def on_event(self, event, data):
|
||||||
|
|
||||||
# async def on_event(self, event, data):
|
|
||||||
# """
|
# """
|
||||||
# See Game class for event guide
|
# See Game class for event guide
|
||||||
# """
|
# """
|
||||||
|
@ -16,7 +16,7 @@ class Werewolf:
|
|||||||
default_global = {}
|
default_global = {}
|
||||||
default_guild = {
|
default_guild = {
|
||||||
"role": None
|
"role": None
|
||||||
}
|
}
|
||||||
|
|
||||||
self.config.register_global(**default_global)
|
self.config.register_global(**default_global)
|
||||||
self.config.register_guild(**default_guild)
|
self.config.register_guild(**default_guild)
|
||||||
@ -129,14 +129,14 @@ class Werewolf:
|
|||||||
return
|
return
|
||||||
|
|
||||||
# if ctx.guild is None:
|
# if ctx.guild is None:
|
||||||
# # DM nonsense, find their game
|
# # DM nonsense, find their game
|
||||||
# # If multiple games, panic
|
# # If multiple games, panic
|
||||||
# for game in self.games.values():
|
# for game in self.games.values():
|
||||||
# if await game.get_player_by_member(ctx.author):
|
# if await game.get_player_by_member(ctx.author):
|
||||||
# break #game = game
|
# break #game = game
|
||||||
# else:
|
# else:
|
||||||
# await ctx.send("You're not part of any werewolf game")
|
# await ctx.send("You're not part of any werewolf game")
|
||||||
# return
|
# return
|
||||||
# else:
|
# else:
|
||||||
|
|
||||||
game = self._get_game(ctx.guild)
|
game = self._get_game(ctx.guild)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user