BernhardPosselt / foundryvtt-special-dice-roller

A FoundryVTT module that supports rolling L5R, VtM 5e, Genesys and SWTTRP dice in chat
GNU Affero General Public License v3.0
13 stars 17 forks source link

Special Dice Roller

Supports rolling dice in your chat window for various non-regular dice systems:

L5R, Genesys and Star Wars images are taken from SkyJedi's Discord Roller

Descent 2nd Edition images are token from j0ran

Vampire the Masquerade images are taken from Lumi#5953's Thirst Discord bot.

HeXXen 1733 images a taken from the physical dice with permission from Ulisses Spiele.

Warhammer 3rd images created by Alex Valiushko

OVA images are used with permission from Clay Gardner

Installation

Go to your setup page and click on the Add-on Modules Tab.

Hit the button Install Module at the bottom.

Insert the module URL https://github.com/BernhardPosselt/foundryvtt-special-dice-roller/raw/master/module.json and click Install.

After you've launched your game, go to the Game Settings page and click on Manage Modules. Enable the Special Dice Roller app and hit Save Module Settings.

Usage

You can roll a system by starting your message with the following string:

Then supply a dice formula separated with a space. The formula consists of dice letters that are optionally prefixed with a number.

The roll can also contain an optional flavour text by adding a #. Everything behind the first # will be treated as flavour text.

A full roll example would be /l5r rrs or /l5r 2rs.

An example with flavour text would be /l5r rss # comment.

Usage L5R

Roll Legend of the 5 Rings 5th edition dice in the chat window. Auto rolls exploding successes and let's you keep/re-roll selected dice.

Use the /l5r command using the following dice letters:

roller usage

You can choose to either keep or re-roll certain dice. To do that, click on the dice to select them and hit either button. Re-rolled dice are removed from the roll and new rolls are attached at the end.

Usage Genesys/Star Wars

Usage is similar to L5R but re-rolls and keeping dice is unsupported. Use the /gen or /sw commands using the following dice letters:

roller usage

Usage HeroQuest

Use /hq to roll dice using the following dice letters:

roller usage

Usage Vampire the Masquerade

Usage is similar to L5R but keeping dice is unsupported. Use the /v5 command using the following dice letters:

You can choose to re-roll certain dice. To do that, click on the dice to select them and hit the re-roll button. Re-rolled dice are highlighted with a green border.

roller usage

Usage HexXen 1733

Use /hex to roll dice using the following dice letters:

Bonus and malus are automatically calculated according to the rules.

roller usage

Usage Warhammer Fantasy Role Play 3rd

Use /wfrp3 to roll dice using the following dice letters:

roller usage

Usage The One Ring

Use /tor to roll dice using the following dice letters:

roller usage

Usage Descent 2nd Edition

Use /desc2 to roll dice using the following dice letters:

roller usage

Usage OVA

Use /ova x to roll x amount of dice. Use 0 or a negative number to roll negative dice (result will be in red). You can click the result to expand to view the related die face.

roller usage

roller usage

roller usage

Building the Project

Install yarn and run:

yarn install
yarn build

Tests use Jest and are run via:

yarn test

TSLint is used to lint files on build. You can run it separately via

yarn run lint

and fix simple errors automatically via:

yarn run fix

The relevant files and folders that need to be included in your (local) FoundryVTT module folder are:

Further development documentation is included in the docs/ folder.

Rolling Dice Programmatically

You can access the dice roller API via the game object:

game.specialDiceRoller.l5r
game.specialDiceRoller.v5
game.specialDiceRoller.genesys
game.specialDiceRoller.starWars
game.specialDiceRoller.heroQuest
game.specialDiceRoller.heXXen
game.specialDiceRoller.warhammer3
game.specialDiceRoller.tor
game.specialDiceRoller.desc2
game.specialDiceRoller.ova

Each roller object has a rollFormula method:

class Roller {
    /**
     * @param fomula essentially the command without the roller prefix (e.g. wwbb instead of /l5r wwbb)
     * @param flavorText? flavor text to display above the roll
     * @return the HTML for the chat window
     */
    rollFormula(formula: string, flavorText?: string): string {
        // etc
    }
}

This method returns the formatted HTML for a roll. You can insert that into the chat log content.