Skip to content

Commit

Permalink
Add Fluent X option
Browse files Browse the repository at this point in the history
  • Loading branch information
tiltowait committed Oct 4, 2024
1 parent c6e0372 commit 5678731
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions inconnu/vr/rolldisplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 = []

Expand All @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 5678731

Please sign in to comment.