How to use the d20.ast.OperatedDice function in d20

To help you get started, we’ve selected a few d20 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github avrae / avrae / cogs5e / models / automation.py View on Github external
def mapper(node):
        if isinstance(node, d20.ast.Dice):
            miX = d20.ast.SetOperator('mi', [d20.ast.SetSelector(None, int(minimum))])
            return d20.ast.OperatedDice(node, miX)
        return node
github avrae / avrae / cogs5e / models / automation.py View on Github external
def _max_mapper(node):
    """A function that maps Dice AST objects to OperatedDice that set their values to their maximum."""
    if isinstance(node, d20.ast.Dice):
        miX = d20.ast.SetOperator('mi', [d20.ast.SetSelector(None, node.size)])
        return d20.ast.OperatedDice(node, miX)
    return node