Fix despair, add blank to result
This commit is contained in:
24
bot.py
24
bot.py
@@ -24,7 +24,7 @@ client = DiceBot()
|
||||
# Genesys dice definitions
|
||||
GENESYS_DICE = {
|
||||
'g': [ # Green (Ability)
|
||||
('', ''),
|
||||
('n', ''),
|
||||
('s', ''),
|
||||
('s', ''),
|
||||
('ss', ''),
|
||||
@@ -34,7 +34,7 @@ GENESYS_DICE = {
|
||||
('aa', ''),
|
||||
],
|
||||
'y': [ # Yellow (Proficiency)
|
||||
('', ''),
|
||||
('n', ''),
|
||||
('s', ''),
|
||||
('s', ''),
|
||||
('ss', ''),
|
||||
@@ -48,7 +48,7 @@ GENESYS_DICE = {
|
||||
('t', ''), # Triumph counts as success
|
||||
],
|
||||
'p': [ # Purple (Difficulty)
|
||||
('', ''),
|
||||
('n', ''),
|
||||
('f', ''),
|
||||
('f,d', ''),
|
||||
('d', ''),
|
||||
@@ -58,7 +58,7 @@ GENESYS_DICE = {
|
||||
('f', ''),
|
||||
],
|
||||
'r': [ # Red (Challenge)
|
||||
('', ''),
|
||||
('n', ''),
|
||||
('f', ''),
|
||||
('f', ''),
|
||||
('f,d', ''),
|
||||
@@ -69,11 +69,11 @@ GENESYS_DICE = {
|
||||
('dd', ''),
|
||||
('d,f', ''),
|
||||
('d,f', ''),
|
||||
('d', ''), # Despair counts as failure
|
||||
('x', ''), # Despair counts as failure
|
||||
],
|
||||
'b': [ # Blue (Boost)
|
||||
('', ''),
|
||||
('', ''),
|
||||
('n', ''),
|
||||
('n', ''),
|
||||
('s', ''),
|
||||
('s,a', ''),
|
||||
('aa', ''),
|
||||
@@ -117,6 +117,7 @@ def calculate_genesys_results(results: List[Tuple[str, str]]) -> Dict[str, int]:
|
||||
advantage = 0
|
||||
triumph = 0
|
||||
despair = 0
|
||||
blank = 0
|
||||
|
||||
for result, _ in results:
|
||||
for symbol in result.split(','):
|
||||
@@ -134,12 +135,15 @@ def calculate_genesys_results(results: List[Tuple[str, str]]) -> Dict[str, int]:
|
||||
elif symbol == 'x':
|
||||
despair += 1
|
||||
success -= 1
|
||||
elif symbol == 'n':
|
||||
blank += 1
|
||||
|
||||
return {
|
||||
'success': success,
|
||||
'advantage': advantage,
|
||||
'triumph': triumph,
|
||||
'despair': despair
|
||||
'despair': despair,
|
||||
'blank': blank
|
||||
}
|
||||
|
||||
@client.tree.command(name="roll", description="Roll traditional dice (e.g., 2d6 + 1d8)")
|
||||
@@ -205,8 +209,10 @@ async def genesys(interaction: discord.Interaction, dice: str):
|
||||
response.append(f"{net_results['triumph']} Triumph{'s' if net_results['triumph'] > 1 else ''}")
|
||||
if net_results['despair'] > 0:
|
||||
response.append(f"{net_results['despair']} Despair{'s' if net_results['despair'] > 1 else ''}")
|
||||
if net_results['blank'] > 0:
|
||||
response.append(f"{net_results['blank']} Blank")
|
||||
|
||||
await interaction.response.send_message(" | ".join(response) if response else "No symbols rolled")
|
||||
await interaction.response.send_message(" | ".join(response) if response else "Neutral Result, No Blanks")
|
||||
except Exception as e:
|
||||
await interaction.response.send_message(f"Error: {str(e)}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user