Skip to content

Latest commit

 

History

History
125 lines (78 loc) · 2.48 KB

api.rst

File metadata and controls

125 lines (78 loc) · 2.48 KB

Class Reference

Looking for information on d20.Expression or d20.ast.Node? Check out Expression Tree for information on the Expression returned by a roll, or Abstract Syntax Tree for the AST returned by a parse.

Dice

d20.Roller

context

The class used to track roll limits.

d20.RollResult

ast

The abstract syntax tree of the dice expression that was rolled.

expr

The Expression representation of the result of the roll.

total

The integer result of the roll (rounded towards 0).

result

The string result of the roll. Equivalent to stringifier.stringify(self.expr).

comment

If allow_comments was True and a comment was found, the comment. Otherwise, None.

d20.RollContext

d20.AdvType

NONE

Equivalent to 0. Represents no advantage.

ADV

Equivalent to 1. Represents advantage.

DIS

Equivalent to -1. Represents disadvantage.

d20.CritType

NONE

Equivalent to 0. Represents no crit.

CRIT

Equivalent to 1. Represents a critical hit (a natural 20 on a d20).

FAIL

Equivalent to 2. Represents a critical fail (a natural 1 on a d20).

Stringifiers

d20.Stringifier

stringify

_stringify

_str_expression

_str_literal

_str_unop

_str_binop

_str_parenthetical

_str_set

_str_dice

_str_die

d20.SimpleStringifier

d20.MarkdownStringifier

Errors

d20.RollError

d20.RollSyntaxError

d20.RollValueError

d20.TooManyRolls