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 definitions
|
||||||
GENESYS_DICE = {
|
GENESYS_DICE = {
|
||||||
'g': [ # Green (Ability)
|
'g': [ # Green (Ability)
|
||||||
('', ''),
|
('n', ''),
|
||||||
('s', ''),
|
('s', ''),
|
||||||
('s', ''),
|
('s', ''),
|
||||||
('ss', ''),
|
('ss', ''),
|
||||||
@@ -34,7 +34,7 @@ GENESYS_DICE = {
|
|||||||
('aa', ''),
|
('aa', ''),
|
||||||
],
|
],
|
||||||
'y': [ # Yellow (Proficiency)
|
'y': [ # Yellow (Proficiency)
|
||||||
('', ''),
|
('n', ''),
|
||||||
('s', ''),
|
('s', ''),
|
||||||
('s', ''),
|
('s', ''),
|
||||||
('ss', ''),
|
('ss', ''),
|
||||||
@@ -48,7 +48,7 @@ GENESYS_DICE = {
|
|||||||
('t', ''), # Triumph counts as success
|
('t', ''), # Triumph counts as success
|
||||||
],
|
],
|
||||||
'p': [ # Purple (Difficulty)
|
'p': [ # Purple (Difficulty)
|
||||||
('', ''),
|
('n', ''),
|
||||||
('f', ''),
|
('f', ''),
|
||||||
('f,d', ''),
|
('f,d', ''),
|
||||||
('d', ''),
|
('d', ''),
|
||||||
@@ -58,7 +58,7 @@ GENESYS_DICE = {
|
|||||||
('f', ''),
|
('f', ''),
|
||||||
],
|
],
|
||||||
'r': [ # Red (Challenge)
|
'r': [ # Red (Challenge)
|
||||||
('', ''),
|
('n', ''),
|
||||||
('f', ''),
|
('f', ''),
|
||||||
('f', ''),
|
('f', ''),
|
||||||
('f,d', ''),
|
('f,d', ''),
|
||||||
@@ -69,11 +69,11 @@ GENESYS_DICE = {
|
|||||||
('dd', ''),
|
('dd', ''),
|
||||||
('d,f', ''),
|
('d,f', ''),
|
||||||
('d,f', ''),
|
('d,f', ''),
|
||||||
('d', ''), # Despair counts as failure
|
('x', ''), # Despair counts as failure
|
||||||
],
|
],
|
||||||
'b': [ # Blue (Boost)
|
'b': [ # Blue (Boost)
|
||||||
('', ''),
|
('n', ''),
|
||||||
('', ''),
|
('n', ''),
|
||||||
('s', ''),
|
('s', ''),
|
||||||
('s,a', ''),
|
('s,a', ''),
|
||||||
('aa', ''),
|
('aa', ''),
|
||||||
@@ -117,6 +117,7 @@ def calculate_genesys_results(results: List[Tuple[str, str]]) -> Dict[str, int]:
|
|||||||
advantage = 0
|
advantage = 0
|
||||||
triumph = 0
|
triumph = 0
|
||||||
despair = 0
|
despair = 0
|
||||||
|
blank = 0
|
||||||
|
|
||||||
for result, _ in results:
|
for result, _ in results:
|
||||||
for symbol in result.split(','):
|
for symbol in result.split(','):
|
||||||
@@ -134,12 +135,15 @@ def calculate_genesys_results(results: List[Tuple[str, str]]) -> Dict[str, int]:
|
|||||||
elif symbol == 'x':
|
elif symbol == 'x':
|
||||||
despair += 1
|
despair += 1
|
||||||
success -= 1
|
success -= 1
|
||||||
|
elif symbol == 'n':
|
||||||
|
blank += 1
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'success': success,
|
'success': success,
|
||||||
'advantage': advantage,
|
'advantage': advantage,
|
||||||
'triumph': triumph,
|
'triumph': triumph,
|
||||||
'despair': despair
|
'despair': despair,
|
||||||
|
'blank': blank
|
||||||
}
|
}
|
||||||
|
|
||||||
@client.tree.command(name="roll", description="Roll traditional dice (e.g., 2d6 + 1d8)")
|
@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 ''}")
|
response.append(f"{net_results['triumph']} Triumph{'s' if net_results['triumph'] > 1 else ''}")
|
||||||
if net_results['despair'] > 0:
|
if net_results['despair'] > 0:
|
||||||
response.append(f"{net_results['despair']} Despair{'s' if net_results['despair'] > 1 else ''}")
|
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:
|
except Exception as e:
|
||||||
await interaction.response.send_message(f"Error: {str(e)}")
|
await interaction.response.send_message(f"Error: {str(e)}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user