Skip to content

Commit

Permalink
Add Lasombra alt bane option
Browse files Browse the repository at this point in the history
  • Loading branch information
tiltowait committed Oct 4, 2024
1 parent 69aa88b commit c6e0372
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
24 changes: 17 additions & 7 deletions inconnu/misc/remorse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from types import SimpleNamespace as SN

import discord

import inconnu
from inconnu.utils.haven import haven

Expand All @@ -17,13 +15,13 @@ def _can_remorse(character):


@haven(__HELP_URL, _can_remorse, "None of your characters have any stains!")
async def remorse(ctx, character, minimum=1):
async def remorse(ctx, character, minimum=1, lasombra_alt=False):
"""Perform a remorse check on a given character."""
if character.stains == 0:
await ctx.respond(f"{character.name} has no stains! No remorse necessary.", ephemeral=True)
return

outcome = __remorse_roll(character, minimum)
outcome = __remorse_roll(character, minimum, lasombra_alt)
inter = await __display_outcome(ctx, character, outcome)
await __report(ctx, inter, character, outcome.remorseful)
await character.commit()
Expand All @@ -39,12 +37,15 @@ async def __display_outcome(ctx, character: "VChar", outcome):
footer = "The downward spiral continues ..."
color = 0x5C0700

footer += "\nDice: " + ", ".join(map(str, outcome.dice))
if outcome.lasombra_alt:
footer += f"\nLasombra alt bane: -{character.bane_severity} dice"

if outcome.overrode:
dice = inconnu.common.pluralize(outcome.minimum, "die")
footer += f"\nOverride: Rolled {dice} instead of {outcome.nominal}"

footer += "\nDice: " + ", ".join(map(str, outcome.dice))

return await inconnu.character.display(
ctx,
character,
Expand All @@ -55,10 +56,12 @@ async def __display_outcome(ctx, character: "VChar", outcome):
)


def __remorse_roll(character: "VChar", minimum: int) -> SN:
def __remorse_roll(character: "VChar", minimum: int, lasombra_alt: bool) -> SN:
"""Perform a remorse roll."""
unfilled = 10 - character.humanity - character.stains
rolls = max(unfilled, minimum)
if lasombra_alt:
rolls = max(1, rolls - character.bane_severity)
overrode = unfilled < minimum and minimum > 1
nominal = unfilled if unfilled > 0 else 1
successful = False
Expand All @@ -78,7 +81,14 @@ def __remorse_roll(character: "VChar", minimum: int) -> SN:

character.log("remorse")

return SN(remorseful=successful, minimum=minimum, dice=dice, overrode=overrode, nominal=nominal)
return SN(
remorseful=successful,
minimum=minimum,
dice=dice,
overrode=overrode,
nominal=nominal,
lasombra_alt=lasombra_alt,
)


async def __report(ctx, inter, character, remorseful):
Expand Down
20 changes: 12 additions & 8 deletions interface/gameplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,20 +150,24 @@ async def mend(self, ctx, character: inconnu.options.character("The character to
await inconnu.misc.mend(ctx, character)

@slash_command()
@option(
"min_override",
description="Override the minimum dice to roll (you probably don't want this)",
choices=inconnu.options.ratings(1, 5),
default=1,
)
@option("lasombra_alt", description="Whether to use Lasombra alt bane", default=False)
@inconnu.options.char_option("The character undergoing remorse")
@commands.guild_only()
async def remorse(
self,
ctx: discord.ApplicationContext,
min_override: Option(
int,
"Override the minimum dice to roll (you probably don't want this)",
choices=inconnu.options.ratings(1, 5),
default=1,
),
character: inconnu.options.character("The character undergoing remorse"),
min_override: int,
lasombra_alt: bool,
character: str,
):
"""Perform a Remorse check."""
await inconnu.misc.remorse(ctx, character, min_override)
await inconnu.misc.remorse(ctx, character, min_override, lasombra_alt)

@slash_command()
@commands.guild_only()
Expand Down

0 comments on commit c6e0372

Please sign in to comment.