Code Monkey home page Code Monkey logo

diceroller's Introduction

DiceRoller

This library consists of a .NET dice roller written in C# compatible with .NET Framework 4.6+ and .NET Core 3.1+.

To download DiceRoller, it is recommended that you install it via NuGet: PM> Install-Package DiceRoller

To view the documentation on DiceRoller, including how to format dice expressions and the API documentation, see here.

diceroller's People

Contributors

raschmi4 avatar skizzerz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

diceroller's Issues

Generic step up/step down

From Discord:

There are systems that use dice chain exploding like Dungeon Crawl Classics (d3 to d4 to d5 ... yeah I know wonky dice) or Spellbound Kingdoms (which does something similar with the more traditional dice set where a max result lets you roll the next die size up and take the higher result.) but I have not found a system that does the Exploding/Cascading down. It is something I've been using in my system for over a couple of years and the players love it. Also there is a more or less recent reddit post on this feature which I think is great: https://www.reddit.com/r/RPGdesign/comments/ne975k/cascading_dice_a_more_stable_version_of_exploding/
Is this something you would be able to implement at some point? Whether is Chain Exploding (step up) or Cascade Exploding (step down)? I think it would be make the explosion options very versatile and many people I know house-rule something like this for damage rolls in D&D.

In theory this is doable. In practice I have no idea what a good, readable syntax for this would be. This is important in order to keep dice expressions comprehensible.

Coin Flips?

I know coin flips can be emulated using a 1d2 and assigning heads or tails, but is there room for coins in this library?

If using coins, what systems use coin flips, and how do they use them?

The ones I can think of off the top of my head(small indie stuff), use them rather ad-hoc so not sure how they would interact with dice or each other, and use them more for dramatic effect.

min-max

In my game I would like to present weapon damage in a classic D&D format, that is if the weapon damage is say 2d6+2 i would like to present that as (4-14). But I cannot find any functions that returns the minimum and the maximum result a die roll could yield. Have I missed something, or is this not implemented?

Alter Function Timing of explosion when used with the keephighest

Hello! I am really loving this library. It is making my dice roller so much more robust.

I am having a bit of an issue when I use .explode() with .keephighest()

2d10.keephighest(1).explode(>9) Result = 10 +8* +6* = 10
What I am trying to get is

2d10.keephighest(1).explode(>9) Result = 10 +8 +6* = 18

The exploded dice is being lumped in to the keephighest(1). Is there anyway to make it so that the highest is kept first, then the exploded dice is added?

Tab Completion?

I'm aware as a C# library, that tab completion is more of a front end concern.

That said, do you have any thoughts on how best to implement syntax suggestions to users?

I notice you have grammar support of some kind, how hard would it be to generate a file that some Javascript library (or otherwise) could consume and suggest syntax completion?

Incorrect Parse

When using syntax similar to "1d20-1", it parses it to 1d20.success-1, instead of parsing to math as would be expected, checked the dice expression documentation and it seems to be an issue.

3.2.0 / .NET Standard 2.0 support

Hi there,

I'm hoping to use your library in a Xamarin.Forms app, but it doesn't seem to be compatible with monoandroid81 due to targeting .NET Framework 4.6.1. I see on your documentation website that you've created a 3.2.0 version ( https://skizzerz.net/DiceRoller/Changelog#3.2.0 ) that targets .NET Standard 2.0, but that doesn't seem to be reflected on Github or NuGet.org, as I only see version 3.1.0.

Is there some way I could get my hands on the 3.2.0 version? Thanks for your help!

EDIT: I see now the Dice.csproj is targetting .NET Standard 2.0. I will pull the code down and build it, but I'll leave this here as a reminder that NuGet is still on the previous version. :)

Bugs in D&D Beyond's implementation - 2: "Dice rolls not yet available for this section"

Here's an example of a bug that surfaces on occasion in D&D Beyond's implementation of DiceRoller:

https://www.dndbeyond.com/forums/d-d-beyond-general/play-by-post/54005-ghosts-of-saltmarsh-cbaer8-campaign-thread?comment=8565

As you can see, "Gerrard" makes a basic 1d20+5 initiative roll, but he gets a "Dice rolls not yet available for this section" result.

Two posts (and two hours) later, he's still not sure what the result is. He writes in post #8567, "Not available, then showed a 6, now not available again." So he rolls again.

Thanks again for any insights!

Possibility of parsing Roll20, DiceParser, RPGDiceRoller or other expression into a function

The most common expression is Roll20 at https://wiki.roll20.net/Dice_Reference
And the source code is at https://app.roll20.net/assets/dengine.js?v=123
Question: is it possible to input a dice notation and output a function in DiceRoller?

Side note: there are open source options like:

It might be good to standardize a FOSS notation between repos in order to replace Roll20.

Java Port?

Hello! Apologies to create an issue for this question, but wasn't sure how else to get in contact.

I am curious if you are aware of any Java implementations or work-in-progress of your DiceRoller library? I was a dotnet man, which was how I initially found your library, but a career shift put me in the Java camp, so I am switching gears on personal projects as well and could use a Java version of this!

I haven't put much thought into converting it myself yet, but I'm sure the ANTLR grammar and a good chunk of the code would transfer over without much fuss, but I'm sure the devil is in the details (and in the dependencies).

Thanks!

The type initializer for 'Dice.Roller' threw an exception.

Hello! I'm trying out DiceRoller and can't seem to get it to work.
Framework: 4.6.1
Version: 3.0.1

This is how I'm using it:

try
{
var result = Roller.Roll("1d6");
await message.Channel.SendMessageAsync("You rolled an:" + result + "");
}
catch (Exception ex)
{
await message.Channel.SendMessageAsync(ex.Message);
}

However I get a generic exception with the message "The type initializer for 'Dice.Roller' threw an exception."

Bugs in D&D Beyond's implementation of DiceRoller (Part one)

D&D Beyond uses DiceRoller in their forums (for play-by-post D&D, etc.) But, for years, the forum has been plagued by intermittent dice roller bugs. We'd love your help in trying to figure out what's going on!

The bugs appear in a number of different flavors, but here's perhaps the most common one:
Mouseovers give nonsensical and contradictory results, or just an endlessly spinning ball.

Here's one example: https://www.dndbeyond.com/forums/d-d-beyond-general/play-by-post/54005-ghosts-of-saltmarsh-cbaer8-campaign-thread?comment=8589

The first roll in that post was a simple 1d20+x roll resulting in an 18, but the mouseover suggests a pretty complex syntax roll resulting in a 9.

Screenshot 2023-08-20 at 11 34 15 AM

Also, on the same page, you can see just how many "potentially manipulated dice roll results" banners there are. While occasionally one can expect to accidentally trigger a banner by editing a post too close to a roll, most of these posts were never edited at all.

Can you make anything of this?
Thanks so much!

Cyberpunk Red Style Explode Once, Implode Once rolls. (or Compound Once/Collapse Once)

I use a VTT that uses this library (Mythic Table). So far, I have not found in the documentation for this library any method for triggering this type of roll.
I've also tried using my own "if()" syntax, but the Mythic Table incorporation of this library doesn't seem to support it, or I just haven't gotten my "if()" right yet.

This might be 2 or more Feature requests:

  1. Please include a "once" option to existing methods for explode() and compound() (and implode/collapse)
  2. Please include an implode() method (and a collapse() method?)

Thank you!

Dice expression for 1D6 where 6 -> 2 successes, 3 or 4 -> 1 success?

Greetings! This dice roller library looks amazingly versatile, so I suspect the reason I can't figure out how to compose the expression I want is due to my own shortcomings rather than the library itself.

I'm trying to build an autoresolver for the Full Thrust tabletop game, in which (for example) beam weapons fire is resolved as follows: would you be able to describe what the dice expression should be for this? E.g. 4D6 > 3 does the job of counting successes for 4 / 5 correctly, but doesn't double-count the 6s as necessary.

I'm contemplating coding in a For loop over the result list and adding an extra success to the total for each 6, but I'd love to know if the library itself can handle this in some way I don't see yet?

Thanks in advance!

Citation from Full Thrust Continuum, p.29 Section 4.5 "Beam Fire":

For every die rolled, damage is inflicted on an unscreened target ship as follows:
• Every 1, 2, or 3 rolled = no effect. (A miss or insignificant surface damage).
• Every 4 or 5 rolled = 1 damage point to the target.
• Every 6 rolled = 2 damage points to the target.

https://emeraldcoastskunkworks.files.wordpress.com/2014/12/full-thrust-project-continuum-version-1-1-1-april-2015.pdf

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.