Giter Club home page Giter Club logo

foundryvtt-better-roll-formulas's Introduction

FoundryVTT Better Roll Formulas

This module aims to enhance roll formula capabilities in Foundry VTT. It provides a set of new functions and operators that can be used in roll formulas to make them more powerful and flexible. Users familiar with coding languages will find many familiar constructs, such as ternaries and logic operations.

List of available functions

Math Functions

Exponential a ** b exp(a, b) pow(a, b)

Exponential term of the form aᵇ.

Modulo a % b mod(a, b)

Remainder of the division of a by b.

Logic Functions

And a && b and(a, b)

Returns b if both a and b are truthy.

Or a || b a ?: b or(a, b)

Returns a, if a is truthy, otherwise returns b.

Not !a not(a)

Inverts a into a negated boolean value. Returns false if a is truthy, otherwise returns true.

Conditionals

Ternary a ? b : c ifThenElse(a, b, c)

Returns b if a is truthy, otherwise returns c.

IfNull a ?? b ifNull(a, b)

Returns b if a is null or undefined, otherwise returns a.

Comparison Operators

Equal a = b a == b a === b eq(a, b)

Returns true if a is equal to b, otherwise returns false.

Not Equal a != b a !== b neq(a, b)

Returns true if a is not equal to b, otherwise returns false.

Greater Than a > b gt(a, b)

Returns true if a is greater than b, otherwise returns false.

Greater Than or Equal a >= b gte(a, b)

Returns true if a is greater than or equal to b, otherwise returns false.

Less Than a < b lt(a, b)

Returns true if a is less than b, otherwise returns false.

Less Than or Equal a <= b lte(a, b)

Returns true if a is less than or equal to b, otherwise returns false.

Bitwise Operators

Bitwise And a & b bitAnd(a, b)

Bitwise AND operation between a and b.

Bitwise Or a | b bitOr(a, b)

Bitwise OR operation between a and b.

Bitwise Xor a ^ b bitXor(a, b)

Bitwise XOR operation between a and b.

Bitwise Not ~a bitFlip(a)

Bitwise NOT operation on a.

Bitwise Left Shift a << b leftShift(a, b)

Bitwise left shift operation on a by b bits.

Bitwise Right Shift a >> b rightShift(a, b)

Bitwise right shift operation on a by b bits.

Bitwise Unsigned Right Shift a >>> b unsignedBitShift(a, b)

Bitwise zero-fill right shift operation on a by b bits.

Utility Functions

Lookup lookup(index, fallback, a, b, ...)

Returns the value at position index, or fallback if index is out of bounds.

foundryvtt-better-roll-formulas's People

Contributors

kitcat420 avatar

Watchers

 avatar

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.