check: Work with skill checks' probabilities and DCs

Description Usage Arguments Details Value See Also Examples

Description

These are simple functions that manipulate probabilities and DCs for skill checks. check_prob() calculates the success/failure probability of a check with the given DC. check_dc() calculates the required difficulty class so that a skill check has the given success/failure probability. See below for more details.

Usage

1
2
3
check_dc(roll, p, success = TRUE)

check_prob(roll, dc, success = TRUE)

Arguments

roll

A roll expression (e.g., 2 * d6 + 5) or a data frame returned by r().

p

The probability of success/failure of the check (or attack).

success

Whether to aim for success (the default) or for failure on the check (or attack).

dc

The difficulty class to beat for a skill check (or the armor class to beat for an attack).

Details

These functions hide the complexities of the roll family so users unfamiliar with R's d/p/q/r notation can get quickly up and running with the package. Since attacks and checks work in the same way (i.e., success means rolling a value higher than or equal to a certain threshold), there are no attack_*() functions.

For more details on roll expressions, see r() and the Dice S4 class.

Value

A numeric scalar.

See Also

roll, r(), Dice.

Examples

1
2
3
4
5
# Probability of d20 + 8 passing a DC 15 skill check
check_prob(d20 + 8, 15)

# Probability of d20 + 8 missing an AC 15 attack
check_prob(d20 + 8, 15, success = FALSE)

droll documentation built on Aug. 7, 2021, 1:05 a.m.