API Reference
Basic rolls
Checks
- pathfinder2e_stats.sum_bonuses(*args: tuple[Literal['untyped', 'ability', 'circumstance', 'proficiency', 'status', 'item'], int | DataArray]) DataArray
- pathfinder2e_stats.check(bonus: int | DataArray = 0, *, DC: int | DataArray, keen: bool | DataArray = False, fortune: bool | DataArray = False, misfortune: bool | DataArray = False, hero_point: DoS | int | Literal[False] | DataArray = False, dims: Mapping[Hashable, int] | None = None, **kwargs: Any) Dataset
- class pathfinder2e_stats.DoS(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Enum for all possible check outcomes. In order to improve readability and reduce human error, you should not use the numeric values directly.
value
code
-2
no_roll
-1
critical_failure
0
failure
1
success
2
critical_success
Disequality comparisons work as expected. For example,
mycheck.outcome >= DoS.success
returns True for success and critical success.
- pathfinder2e_stats.map_outcome(outcome: DataArray | Dataset, map_: Mapping[DoS | int | DataArray, object] | Iterable[tuple[DoS | int | DataArray, object]] | None = None, /, *, evasion: bool | DataArray = False, juggernaut: bool | DataArray = False, resolve: bool | DataArray = False, risky_surgery: bool | DataArray = False, incapacitation: bool | int | DataArray = 0, allow_critical_failure: bool | DataArray = True, allow_failure: bool | DataArray = True, allow_critical_success: bool | DataArray = True) DataArray | Dataset
Damage rolls
- class pathfinder2e_stats.Damage(type: 'str', dice: 'int', faces: 'int', bonus: 'int' = 0, multiplier: 'float' = 1, persistent: 'bool' = False, splash: 'bool' = False, deadly: 'int' = 0, fatal: 'int' = 0, basic_save: 'bool' = False)
-
- expand() ExpandedDamage
- class pathfinder2e_stats.DamageList(initlist=None)
-
- expand() ExpandedDamage
- simplify() DamageList
- class pathfinder2e_stats.ExpandedDamage(data: Damage | Iterable[Damage] | ExpandedDamage | Mapping[int, Collection[Damage]] | Mapping[DoS, Collection[Damage]] | None = None, /)
- filter(persistent: bool = False, splash: bool = False) ExpandedDamage
- static sum(items: Iterable[Damage | Iterable[Damage] | ExpandedDamage | Mapping[int, Collection[Damage]] | Mapping[DoS, Collection[Damage]]]) ExpandedDamage
- pathfinder2e_stats.damage(check_outcome: Dataset, damage_spec: Damage | Iterable[Damage] | ExpandedDamage | Mapping[int, Collection[Damage]] | Mapping[DoS, Collection[Damage]], *, weaknesses: Mapping[str, int] | DataArray | None = None, resistances: Mapping[str, int] | DataArray | None = None, immunities: Mapping[str, bool] | Collection[str] | DataArray | None = None, persistent_damage_rounds: int = 3, persistent_damage_DC: int | Mapping[str, int] | DataArray = 15, splash_damage_targets: int = 2) Dataset
Utilities
- pathfinder2e_stats.level2rank(level: int | DataArray | Dataset) int | DataArray | Dataset
Convert a creature’s level to their rank, e.g. to determine if they’re affected by the incapacitation trait or to counteract their abilities
Xarray extensions
When you import pathfinder2e_stats
, all DataArray and Dataset objects gain these
new methods:
- xarray.DataArray.value_counts(dim, *, new_dim='unique_value', normalize=False)
Return the count of unique values for every point along dim, individually for each other dimension.
This is conceptually the same as calling
pandas.Series.value_counts()
individually for every series of apandas.DataFrame
and then merging the output.- Parameters:
dim – Name of the dimension to count the values along. It will be removed in the output array.
new_dim – Name of the new dimension in the output array; defaults to
unique_value
normalize – Return proportions rather than frequencies; defaults to False
- Returns:
xarray.DataArray
with the same dimensions as the input array, minus dim, plus new_dim.