From 56787319fa1f32e477067090069016892a2a5f4c Mon Sep 17 00:00:00 2001 From: tiltowait <208040+tiltowait@users.noreply.github.com> Date: Fri, 4 Oct 2024 16:46:58 -0700 Subject: [PATCH] Add Fluent X option --- inconnu/vr/rolldisplay.py | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/inconnu/vr/rolldisplay.py b/inconnu/vr/rolldisplay.py index b70dbf2..554e35b 100644 --- a/inconnu/vr/rolldisplay.py +++ b/inconnu/vr/rolldisplay.py @@ -68,9 +68,11 @@ async def button_pressed(self, interaction): button_id = interaction.data["custom_id"].split()[0] # Remove the unique ID if inconnu.common.contains_digit(button_id): - # This was the surge button, which is always last. Let's disable it + # This was a surge button, which are always last. Let's disable them self.children[-1].disabled = True self.children[-1].style = discord.ButtonStyle.secondary + self.children[-2].disabled = True + self.children[-2].style = discord.ButtonStyle.secondary await interaction.response.edit_message(view=self) elif button_id == _ButtonID.WILLPOWER: # Mark WP is always the first button @@ -197,10 +199,16 @@ async def respond_to_button(self, btn): fields=[("New WP", inconnu.character.DisplayField.WILLPOWER)], ) - elif inconnu.common.contains_digit(button_id): # Surge buttons are just charids + elif button_id == self.character.id: + # elif inconnu.common.contains_digit(button_id): # Surge buttons are just charids self.surged = True await inconnu.misc.rouse(btn, self.character, 1, "Surge", False) + elif button_id == self.character.id + "-rr": + # Fluent X + self.surged = True + await inconnu.misc.rouse(btn, self.character, 1, "Surge", True) + else: # We're rerolling strategy = button_id @@ -332,7 +340,7 @@ async def get_embed(self) -> discord.Embed: ) embed.add_field(name="Dice", value=str(self.outcome.pool)) - embed.add_field(name="Hunger", value=self.hunger) + embed.add_field(name="Hunger", value=str(self.hunger)) embed.add_field(name="Difficulty", value=str(self.outcome.difficulty)) if self.outcome.pool_str: @@ -371,7 +379,7 @@ def surging(self) -> bool: return match is not None @property - def buttons(self) -> list: + def buttons(self) -> list | None: """Generate the buttons for Willpower re-rolls and surging.""" buttons = [] @@ -392,6 +400,13 @@ def buttons(self) -> list: style=discord.ButtonStyle.danger, ) ) + buttons.append( + Button( + label="Rouse w/ Reroll", + custom_id=self.character.id + "-rr", + style=discord.ButtonStyle.danger, + ) + ) return buttons or None # We haven't re-rolled @@ -453,5 +468,13 @@ def buttons(self) -> list: row=1, ) ) + buttons.append( + Button( + label="Rouse w/ Reroll", + custom_id=self.character.id + "-rr", + style=discord.ButtonStyle.danger, + row=1, + ) + ) return buttons or None