Skip to content

Commit

Permalink
Calculate impact.
Browse files Browse the repository at this point in the history
And minor formatting tweaks
  • Loading branch information
freiheit committed Oct 30, 2023
1 parent cf67f32 commit a24da04
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions mvkdicebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,21 @@ async def roll(ctx, *, dicestr: str):
flatdicerolls.sort(reverse=True)

if len(dicerolls) > 0:
answer = "Dice: "
answer = "**Dice:** "

for size in dicerolls:
answer += f"**{len(dicerolls[size])}d{size}**{ str(dicerolls[size])} "
answer += f"{len(dicerolls[size])}d{size}{ str(dicerolls[size])} "
answer += "\n"

action_dice = flatdicerolls[:2]
action_total = sum(action_dice)
answer += f"Action Total: {str(action_total)} {str(action_dice)}\n"
answer += f"**Action Total:** {str(action_total)} {str(action_dice)}\n"

impact = sum(1 for p in flatdicerolls if p >=4)
if impact < 1:
impact = 1
answer += f"**Impact:** {impact}"

await ctx.send(answer)
else:
await ctx.send(f"No valid NdNs found in '{dicestr}'")
Expand Down

0 comments on commit a24da04

Please sign in to comment.