Title: | Dungeons & Dragons Functions for Players and Dungeon Masters |
---|---|
Description: | The goal of 'dndR' is to provide a suite of Dungeons & Dragons related functions. This package is meant to be useful both to players and Dungeon Masters (DMs). All functions currently focus on Fifth Edition (a.k.a. "5e") but once the next edition is published functions will likely be expanded to include any rule changes. |
Authors: | Nicholas Lyon [aut, cre, cph] (<https://orcid.org/0000-0003-3905-1078>, https://njlyon0.github.io/), Tim Schatto-Eckrodt [aut] (https://kudusch.de/), Humberto Nappo [ctb] |
Maintainer: | Nicholas Lyon <[email protected]> |
License: | MIT + file LICENSE |
Version: | 2.0.0.900 |
Built: | 2024-11-02 04:27:36 UTC |
Source: | https://github.com/njlyon0/dndr |
Rolls for six ability scores using the desired method of rolling (4d6 drop lowest, 3d6, or 1d20). Doesn't assign abilities to facilitate player selection of which score should be each ability for a given character. Prints a warning if the total of all abilities is less than 70 or if any one ability is less than 8.
ability_scores(method = "4d6", quiet = FALSE)
ability_scores(method = "4d6", quiet = FALSE)
method |
(character) string of "4d6", "3d6", or "1d20" ("d20" also accepted). Enter your preferred method of rolling for each ability score ("4d6" drops lowest before summing) |
quiet |
(logical) whether to print warnings if the total score is very low or one ability score is very low |
(dataframe) two columns and six rows for ability score for each ability
# Roll ability scores using four d6 and dropping the lowest ability_scores(method = "4d6") # Roll using 3d6 and dropping nothing ability_scores("3d6") # Or if you're truly wild, just roll a d20 for each ability ability_scores('d20')
# Roll ability scores using four d6 and dropping the lowest ability_scores(method = "4d6") # Roll using 3d6 and dropping nothing ability_scores("3d6") # Or if you're truly wild, just roll a d20 for each ability ability_scores('d20')
Rolls for a single ability score using the specified method of dice rolling.
ability_singular(method = "4d6")
ability_singular(method = "4d6")
method |
(character) string of "4d6", "3d6", or "1d20" ("d20" also accepted). Enter your preferred method of rolling for each ability score ("4d6" drops lowest before summing) |
(numeric) vector of roll outcomes (not summed)
Assign rolled ability scores based on the recommendations for quick class building given in the Player's Handbook (PHB).
class_block( class = NULL, score_method = "4d6", scores_rolled = FALSE, scores_df = NULL, quiet = FALSE )
class_block( class = NULL, score_method = "4d6", scores_rolled = FALSE, scores_df = NULL, quiet = FALSE )
class |
(character) name of character class (supported classes returned by 'dnd_classes()'). Also supports "random" and will randomly select a supported class |
score_method |
(character) preferred method of rolling for ability scores "4d6", "3d6", or "1d20" ("d20" also accepted synonym of "1d20"). Only values accepted by 'ability_scores()' are accepted here |
scores_rolled |
(logical) whether ability scores have previously been rolled (via 'ability_scores()'). Defaults to FALSE |
scores_df |
(dataframe) if 'scores_rolled' is TRUE, the name of the dataframe object returned by 'ability_scores()' |
quiet |
(logical) whether to print warnings if the total score is very low or one ability score is very low |
(dataframe) two columns and six rows
# Can roll up a new character of the desired class from scratch class_block(class = "wizard", score_method = "4d6") # Or you can roll separately and then create a character with that dataframe my_scores <- ability_scores(method = "4d6") class_block(class = "fighter", scores_rolled = TRUE, scores_df = my_scores)
# Can roll up a new character of the desired class from scratch class_block(class = "wizard", score_method = "4d6") # Or you can roll separately and then create a character with that dataframe my_scores <- ability_scores(method = "4d6") class_block(class = "fighter", scores_rolled = TRUE, scores_df = my_scores)
Picks a random number from 1-2. Essentially a "d2".
coin()
coin()
(numeric) result of coin flip (either 1 or 2)
Converts challenge rating (CR) into experience points (XP) using two formulas for a parabola (one for CR less than/equal to 20 and one for greater than 20). The relationship between CR and XP in the Dungeon Master's Guide (DMG) is disjointed in this way so this is a reasonable move. Accepts '1/8', '1/4, and '1/2' in addition to numbers between 1 and 30.
cr_convert(cr = NULL)
cr_convert(cr = NULL)
cr |
(numeric) Challenge rating for which you want to calculate experience points |
(numeric) value of XP equivalent to the user-supplied challenge rating
Query list of Dungeons & Dragons creatures based on partial string matches between user inputs and the relevant column of the creature information data table. Currently supports users querying the creature list by creature name, size, type, source document, experience point (XP), and challenge rating (CR). All characters arguments are case-insensitive. XP and CR may be specified as either characters or numbers but match to creature must be exact in either case (rather than partial). Any argument set to 'NULL' (the default) will not be used to include/exclude creatures from the returned set of creatures
creature_list( name = NULL, size = NULL, type = NULL, source = NULL, xp = NULL, cr = NULL )
creature_list( name = NULL, size = NULL, type = NULL, source = NULL, xp = NULL, cr = NULL )
name |
(character) text to look for in creature names |
size |
(character) size(s) of creature |
type |
(character) creature 'type' (e.g., "undead", "elemental", etc.) |
source |
(character) source book/document of creature |
xp |
(character/numeric) experience point (XP) value of creature (note this must be an exact match as opposed to partial matches tolerated by other arguments) |
cr |
(character/numeric) challenge rating (CR) value of creature (note this must be an exact match as opposed to partial matches tolerated by other arguments) |
(dataframe) Up to 23 columns of information with one row per creature(s) that fit(s) the user-specified criteria. Fewer columns are returned when no creatures that fit the criteria have information for a particular category (e.g., if no queried creatures have damage vulnerabilities, that column will be excluded from the results). If no creatures fit the criteria, returns a message to that effect instead of a data object
# Identify medium undead creatures from the Monster Manual worth 450 XP creature_list(type = "undead", size = "medium", source = "monster manual", xp = 450)
# Identify medium undead creatures from the Monster Manual worth 450 XP creature_list(type = "undead", size = "medium", source = "monster manual", xp = 450)
Accepts user-provided Dungeons & Dragons creature name(s) and returns the full set of creature information and the complete description text. Unlike 'dndR::creature_list', this function requires an exact match between the user-provided creature name(s) and how they appear in the main creature data object. The argument in this function is not case-sensitive.
creature_text(name = NULL)
creature_text(name = NULL)
name |
(character) exact creature name(s) for which to gather description information |
(dataframe) one column per creature specified by the user. Creature name is stored as the column name for that creature's information. Returns all fields for which there are data for at least one of the specified creatures so row number will vary with query (maximum 26 rows if all fields have information).
creature_text(name = c("hill giant", "goblin"))
creature_text(name = c("hill giant", "goblin"))
Creatures in Dungeons and Dragons all fall into certain, well-documented categories. This table summarizes all of that information into a long format dataframe for easy navigation. Unless otherwise noted, all creature querying functions in 'dndR' use this table as their starting point.
creatures
creatures
Dataframe with 26 columns and 1721 rows
Name of the creature
Source book for the creature
Strength ability score of creature with roll modifier indicated parenthetically
Dexterity ability score of creature with roll modifier indicated parenthetically
Constitution ability score of creature with roll modifier indicated parenthetically
Intelligence ability score of creature with roll modifier indicated parenthetically
Wisdom ability score of creature with roll modifier indicated parenthetically
Charisma ability score of creature with roll modifier indicated parenthetically
Size category of the creature (one of 'tiny', 'small', 'medium', 'large', 'huge', or 'gargantuan')
Type of the creature (e.g., undead, elemental, etc.)
The creature's alignment (e.g., chaotic evil, etc.)
Experience point (XP) value of the creature
Challenge rating (CR) of the creature
Any languages understood or spoken by the creature
Any skills in which the creature is proficient and the roll modifiers for each
Movement speed of the creature
Number of hit points (HP) of the creature (and the dice to roll if rolling for HP is desired)
Armor class of the creature
Any special senses of the creature
Any saving throws in which the creature is proficient and the roll modifiers for each
Damage types to which the creature is immune (i.e., no damage)
Damage types to which the creature is resistant (i.e., half damage)
Damage types to which the creature is vulnerable (i.e., double damage)
Conditions to which the creature is immune
Description of all abilities the creature has as well as any bonus actions or reactions it can take. Each item name is surrounded by triple asterisks
Description of all actions the creature can take. Each item name is surrounded by triple asterisks
Crawford, J., Hickman, L., Hickman, T., Lee, A., Perkins, C., Whitters, R. Curse of Strahd. Wizards of the Coast 2015.
Waterdeep: Dungeon of the Mad Mage. Wizards of the Coast 2018.
Elemental Evil. Wizards of the Coast 2015.
Explorer's Guide to Wildemount. Wizards of the Coast 2020.
Guildmasters’ Guide to Ravnica. Wizards of the Coast 2018.
Lost Mine of Phandelver. Wizards of the Coast 2014.
Mearls, M. and Crawford, J. Dungeons & Dragons Monster Manual (Fifth Edition). Wizards of the Coast 2014
Morenkainen's Tome of Foes. Wizards of the Coast 2018.
Out of the Abyss. Wizards of the Coast 2015.
Storm King's Thunder. Wizards of the Coast 2016.
Tales from the Yawning Portal. Wizards of the Coast 2017.
Tomb of Annihilation. Wizards of the Coast 2017.
Baur, W. Tome of Beasts. Paizo Inc. 2016.
Tome of Horrors. Frog God Games 2019.
Tyranny of Dragons. Wizards of the Coast 2015.
Volo's Guide to Monsters. Wizards of the Coast 2016.
Picks a random number from 1-10
d10()
d10()
(numeric) result of "roll" of specified dice type
Picks a random number from 1-100
d100()
d100()
(numeric) result of "roll" of specified dice type
Picks a random number from 1-12
d12()
d12()
(numeric) result of "roll" of specified dice type
Picks a random number from 1-2. Essentially flips a coin.
d2()
d2()
(numeric) result of "roll" of specified dice type
Picks a random number from 1-20
d20()
d20()
(numeric) result of "roll" of specified dice type
Picks a random number from 1-3
d3()
d3()
(numeric) result of "roll" of specified dice type
Picks a random number from 1-4
d4()
d4()
(numeric) result of "roll" of specified dice type
Picks a random number from 1-6
d6()
d6()
(numeric) result of "roll" of specified dice type
Picks a random number from 1-8
d8()
d8()
(numeric) result of "roll" of specified dice type
Simply returns a vector of classes that 'class_block()' accepts currently. Submit an issue on the GitHub repository if you want a class added.
dnd_classes()
dnd_classes()
(character) vector of accepted class names
# Want to check which classes this package supports? dnd_classes()
# Want to check which classes this package supports? dnd_classes()
Simply returns a vector of damage types in DnD
dnd_damage_types()
dnd_damage_types()
character vector of damage types
# Full set of damage types included in DnD Fifth Edition (5e) dnd_damage_types()
# Full set of damage types included in DnD Fifth Edition (5e) dnd_damage_types()
Simply returns a vector of races that 'race_mods()' accepts currently. Submit an issue on the GitHub repository if you want a race added.
dnd_races()
dnd_races()
(character) vector of supported race designations
# Want to check which races this package supports? dnd_races()
# Want to check which races this package supports? dnd_races()
Identifies set of creature XP values that constitute a balanced encounter of specified difficulty for given party composition information (i.e., average player character level and number of party members). Creature selection is semi-random so re-running this function will return similar but not necessarily identical results. It is not always possible to exactly spend all available XP so the true maximum XP and the realized XP (see '?dndR::xp_pool' and '?dndR::xp_cost') are both returned in the output for context. This function _will not_ exceed the allowed XP so you may need to alter the party information and/or difficulty arguments in order to return an encounter that meets your needs.
encounter_creator( party_level = NULL, party_size = NULL, difficulty = NULL, try = 5 )
encounter_creator( party_level = NULL, party_size = NULL, difficulty = NULL, try = 5 )
party_level |
(numeric) integer indicating the average party level. If all players are the same level, that level is the average party level |
party_size |
(numeric) integer indicating how many player characters (PCs) are in the party |
difficulty |
(character) one of "easy", "medium", "hard", or "deadly" for the desired difficulty of the encounter |
try |
(numeric) integer indicating the number of attempts to make to maximize encounter XP while remaining beneath the threshold defined by the other parameters |
(dataframe) creature experience point (XP) values as well as the maximum XP for an encounter of the specified difficulty and the realized XP cost of the returned creatures
# Create a hard encounter for a 2-person, 9th level party encounter_creator(party_level = 9, party_size = 2, difficulty = "hard")
# Create a hard encounter for a 2-person, 9th level party encounter_creator(party_level = 9, party_size = 2, difficulty = "hard")
Ability scores (typically 0-20 for most creatures) relate to roll modifiers. These values are what a player or DM actually adds to a given skill or ability check. This function performs the simple calculation to identify the roll modifier that relates to the supplied ability score.
mod_calc(score = 10)
mod_calc(score = 10)
score |
(numeric) ability score value for which to identify the roll modifier |
(character) roll modifier for a given ability score. If positive, includes a plus sign to make the addition explicit. Negative values are also returned as characters for consistency with positive modifiers
# Calculate roll modifier for an ability score of 17 mod_calc(score = 17)
# Calculate roll modifier for an ability score of 17 mod_calc(score = 17)
Returns the vital statistics of a randomized monster based on a the average player level and number of players in the party. This function follows the advice of [Zee Bashew](https://twitter.com/Zeebashew) on how to build interesting, challenging monsters for your party. These monsters are built somewhat according to the Dungeon Master's Guide for creating monsters, partly Zee's [YouTube video on homebrewing monsters based on The Witcher videogame](https://www.youtube.com/watch?v=GhjkPv4qo5w), and partly on my own sensibilities about scaling the difficulty of a creature. Creatures are spawned randomly so you may need to re-run the function several times (or mentally modify one or more parts of the output) to get a monster that fits your campaign and players, but the vulnerabilities and resistances should allow for cool quest building around what this function provides. Happy DMing!
monster_creator(party_level = NULL, party_size = NULL)
monster_creator(party_level = NULL, party_size = NULL)
party_level |
(numeric) indicating the average party level. If all players are the same level, that level is the average party level |
party_size |
(numeric) indicating how many player characters (PCs) are in the party |
(dataframe) two columns and 15 rows
# Creates a monster from the specified average party level monster_creator(party_level = 4, party_size = 3)
# Creates a monster from the specified average party level monster_creator(party_level = 4, party_size = 3)
Quickly identify the vital statistics of a single creature worth the provided experience points (XP) or Challenge Rating (CR). Uses the table provided in p. 274-275 of the Dungeon Master's Guide. Accepts Challenge Ratings of 0, '1/8', '1/4, and '1/2' in addition to numbers between 1 and 30. CR is *not necessary* to provide **if** XP is provided.
monster_stats(xp = NULL, cr = NULL)
monster_stats(xp = NULL, cr = NULL)
xp |
(numeric) experience point (XP) value of the monster |
cr |
(numeric) challenge rating (CR) of the monster. Note that this is NOT necessary if XP is provided |
(dataframe) two columns and eight rows
On pages 274 and 275 in the Dungeon Master's Guide (Fifth Edition) there are two tables that relate creature Challenge Rating (CR) to various vital statistics (armor, hit points, etc.) and to Experience Points (XP). These tables have been transcribed into this data object for ease of reference.
monster_table
monster_table
Dataframe with 8 columns and 34 rows
Challenge Rating (CR) expressed as a number
Experience Points (XP) for that CR as dictated by the DMG
Modifier to add to rolls where the creature is proficient
Armor class of the creature
Range of hit points (HP) for the creature
Average of minimum and maximum HP of range for the creature
Modifier to add to the creature's attack rolls
Save Difficulty Class (DC) for rolls against the creature's spells / certain abilities
Mearls, M., Crawford, J., Perkins, C., Wyatt, J. et al. Dungeon Master's Guide (Fifth Edition). Wizards of the Coast 2014
Randomly selects a race and job for a user-specified number of NPCs
npc_creator(npc_count = 1)
npc_creator(npc_count = 1)
npc_count |
(numeric) number of NPCs for which to choose race/positions |
(dataframe) dataframe with two columns (one for race and one for job) and a number of rows equal to 'npc_count'
# Create some information for an NPC npc_creator(npc_count = 1)
# Create some information for an NPC npc_creator(npc_count = 1)
Input a party's ability scores and visualize either by ability or player character. Includes dashed line for average of ability scores within chosen 'by' parameter. Huge shout out to Tim Schatto-Eckrodt for contributing this function!
party_diagram(by = "player", pc_stats = NULL, quiet = FALSE)
party_diagram(by = "player", pc_stats = NULL, quiet = FALSE)
by |
(character) either "player" (default) or "ability". Defines the facets of the party diagram |
pc_stats |
(null / list) either 'NULL' (default) or named list of ability scores for each character. If 'NULL', player names and scores are requested interactively in the console |
quiet |
(logical) if FALSE (default), prints interactively assembled PC list for ease of subsequent use |
(ggplot object) party diagram as a ggplot object
# Create named list of PCs and their scores party_list <- list( Vax = list( STR = "10", DEX = "13", CON = "14", INT = "15", WIS = "16", CHA = "12"), Beldra = list( STR = "20", DEX = "15", CON = "10", INT = "10", WIS = "11", CHA = "12"), Rook = list( STR = "10", DEX = "10", CON = "18", INT = "9", WIS = "11", CHA = "16")) # Create a party diagram using that list (by player) party_diagram(by = "player", pc_stats = party_list, quiet = TRUE) # Can easily group by ability with the same list! party_diagram(by = "ability", pc_stats = party_list, quiet = FALSE)
# Create named list of PCs and their scores party_list <- list( Vax = list( STR = "10", DEX = "13", CON = "14", INT = "15", WIS = "16", CHA = "12"), Beldra = list( STR = "20", DEX = "15", CON = "10", INT = "10", WIS = "11", CHA = "12"), Rook = list( STR = "10", DEX = "10", CON = "18", INT = "9", WIS = "11", CHA = "16")) # Create a party diagram using that list (by player) party_diagram(by = "player", pc_stats = party_list, quiet = TRUE) # Can easily group by ability with the same list! party_diagram(by = "ability", pc_stats = party_list, quiet = FALSE)
Stat out a player character (PC) of specified race and class using your preferred method for rolling ability scores.
pc_creator( class = NULL, race = NULL, score_method = "4d6", scores_rolled = FALSE, scores_df = NULL, quiet = FALSE )
pc_creator( class = NULL, race = NULL, score_method = "4d6", scores_rolled = FALSE, scores_df = NULL, quiet = FALSE )
class |
(character) name of character class (supported classes returned by 'dnd_classes()'). Also supports "random" and will randomly select a supported class. Random class returned as message |
race |
(character) name of character race (supported classes returned by 'dnd_races()'). Also supports "random" and will randomly select a supported race. Random race returned as message |
score_method |
(character) preferred method of rolling for ability scores "4d6", "3d6", or "1d20" ("d20" also accepted synonym of "1d20"). Only values accepted by 'ability_scores()' are accepted here |
scores_rolled |
(logical) whether ability scores have previously been rolled (via 'ability_scores()'). Defaults to FALSE |
scores_df |
(dataframe) if 'scores_rolled' is TRUE, the name of the dataframe object returned by 'ability_scores()' |
quiet |
(logical) whether to print warnings if the total score is very low or one ability score is very low |
(dataframe) raw ability score, race modifier, total ability score, and the roll modifier for each of the six abilities
# Create a PC's base statistics from scratch pc_creator(class = 'barbarian', race = 'half orc', score_method = "4d6", quiet = TRUE) # Or you can roll separately and then create a character with that dataframe my_scores <- ability_scores(method = "4d6", quiet = TRUE) pc_creator(class = 'sorcerer', race = 'dragonborn', scores_rolled = TRUE, scores_df = my_scores)
# Create a PC's base statistics from scratch pc_creator(class = 'barbarian', race = 'half orc', score_method = "4d6", quiet = TRUE) # Or you can roll separately and then create a character with that dataframe my_scores <- ability_scores(method = "4d6", quiet = TRUE) pc_creator(class = 'sorcerer', race = 'dragonborn', scores_rolled = TRUE, scores_df = my_scores)
Uses total player experience points (XP) to identify player character (PC) level and proficiency modifier. Only works for a single PC at a time (though this is unlikely to be an issue if all party members have the same amount of XP). Big thanks to Humberto Nappo for contributing this function!
pc_level_calc(player_xp = NULL)
pc_level_calc(player_xp = NULL)
player_xp |
(numeric) total value of experience points earned by one player |
(dataframe) current player level, XP threshold for that level, and the proficiency modifier used at that level
# Calculate player level from XP earned pc_level_calc(player_xp = 950)
# Calculate player level from XP earned pc_level_calc(player_xp = 950)
Input the number and type of dice to roll and the number of times to roll the dice. This is used to generate a plot of the real distribution of dice outcomes and create a ggplot2 plot of that result. A vertical dashed line is included at the median roll result. Note that low numbers of rolls may not generate realistic frequencies of outcomes
probability_plot(dice = "2d20", roll_num = 999)
probability_plot(dice = "2d20", roll_num = 999)
dice |
(character) specifying the number of dice and which type (e.g., "2d4" for two, four-sided dice). Defaults to two, six-sided dice |
roll_num |
(integer) number of times to roll the specified dice to generate the data fro the probability plot. Defaults to 999 |
(ggplot object) roll outcome frequency as a ggplot2 object
# Generate a probability plot of 3d8 probability_plot(dice = "3d8", roll_num = 99)
# Generate a probability plot of 3d8 probability_plot(dice = "3d8", roll_num = 99)
Identify the race-based ability modifiers identified in the Player's Handbook (PHB).
race_mods(race = NULL)
race_mods(race = NULL)
race |
(character) string of race (supported classes returned by 'dnd_races()'). Also supports "random" and will randomly select a supported race |
(dataframe) two columns and as many rows as there are abilities modified by the race
# Identifies race modifiers of provided race race_mods(race = "mountain dwarf")
# Identifies race modifiers of provided race race_mods(race = "mountain dwarf")
Re-rolls only the dice that "landed on" 1 from a prior use of 'roll'. Retains other dice results from the first roll but replaces the ones.
reroll(dice_faces, first_result = NULL)
reroll(dice_faces, first_result = NULL)
dice_faces |
(numeric) number of sides on the die to be rerolled (i.e., type of dice without the "d" found in the 'roll' function) |
first_result |
(numeric) vector of original dice results (including 1s to reroll) |
(numeric) vector of non-1 original dice results with re-rolled dice results appended
# Re-roll ones from a prior result reroll(dice_faces = 8, first_result = c(1, 3, 1))
# Re-roll ones from a prior result reroll(dice_faces = 8, first_result = c(1, 3, 1))
Rolls the specified number and type of dice. Dice are specified in the shorthand common to Dungeons & Dragons (i.e., number of dice, "d", number of faces of those dice). Includes an argument for whether each die's value should be returned as a message (rather than just the total of all dice in the roll). Rolling two twenty-sided dice (i.e., "2d20") is assumed to be rolling with advantage/disadvantage so both numbers are returned.
roll(dice = "d20", show_dice = FALSE, re_roll = FALSE)
roll(dice = "d20", show_dice = FALSE, re_roll = FALSE)
dice |
(character) number and type of dice to roll specified in Dungeons & Dragons shorthand (e.g., "2d4" to roll two four-sided dice). Defaults to a single twenty-sided die (i.e., "1d20") |
show_dice |
(logical) whether to print the values of each individual die included in the total. Defaults to FALSE |
re_roll |
(logical) whether to re-roll 1s from the initial roll result. Defaults to FALSE |
(numeric) sum of specified dice outcomes
# Roll your desired dice roll(dice = "4d6", show_dice = TRUE) # Returned as a number so you can add rolls together or integers roll(dice = '1d20') + 5 # Can also re-roll ones if desired roll(dice = '4d4', re_roll = TRUE)
# Roll your desired dice roll(dice = "4d6", show_dice = TRUE) # Returned as a number so you can add rolls together or integers roll(dice = '1d20') + 5 # Can also re-roll ones if desired roll(dice = '4d4', re_roll = TRUE)
Query list of all Dungeons & Dragons spells based on partial string matches between user inputs and the relevant column of the spell information data table. Currently supports users querying the spell list by spell name, which class lists allow the spell, spell's level, the school of magic the spell belongs in, whether or not the spell can be cast as a ritual, and the time it takes to cast the spell. All character arguments are case-insensitive (note that the ritual argument expects a logical). Any argument set to 'NULL' (the default) will not be used to include/exclude spells from the returned set of spells
spell_list( name = NULL, class = NULL, level = NULL, school = NULL, ritual = NULL, cast_time = NULL )
spell_list( name = NULL, class = NULL, level = NULL, school = NULL, ritual = NULL, cast_time = NULL )
name |
(character) text to look for in spell names |
class |
(character) character class(es) with the spell(s) on their list |
level |
(character) "cantrip" and/or the minimum required spell slot level |
school |
(character) school(s) of magic within which the spell belongs (e.g., 'evocation', 'necromancy', etc.) |
ritual |
(logical) whether the spell can be cast as a ritual |
cast_time |
(character) either the phase of a turn needed to cast the spell or the in-game time required (e.g., "reaction", "1 minute", etc.) |
(dataframe) 10 columns of information with one row per spell(s) that fit(s) the user-specified criteria. If no spells fit the criteria, returns a message to that effect instead of a data object
# Search for evocation spells with 'fire' in the name that a wizard can cast spell_list(name = "fire", class = "wizard", school = "evocation")
# Search for evocation spells with 'fire' in the name that a wizard can cast spell_list(name = "fire", class = "wizard", school = "evocation")
Accepts user-provided Dungeons & Dragons spell name(s) and returns the full set of spell information and the complete description text. Unlike ‘dndR::spell_list', this function requires an exact match between the user-provided spell name(s) and how they appear in the main spell data object. The argument in this function is not sensitive. This function’s output differs from 'dndR::spell_list' only in that it returns the additional spell description text.
spell_text(name = NULL)
spell_text(name = NULL)
name |
(character) exact spell name(s) for which to gather description information |
(dataframe) 11 columns of spell information with one row per spell specified by the user. Returns 12 columns if the spell is a damage-dealing cantrip that deals increased damage as player level increases or if spell can be cast with a higher level spell slot (i.e., "upcast") for an increased effect.
spell_text(name = "chill touch")
spell_text(name = "chill touch")
Spells in Dungeons and Dragons fit within several categories and their effects are well-documented. This table summarizes all of that information into a long format dataframe for easy navigation. Unless otherwise noted, all spell querying functions in 'dndR' use this table as their starting point.
spells
spells
Dataframe with 12 columns and 513 rows
Name of the spell
Source book(s) for that spell with page numbers
Player Character (PC) class(es) that have access to this spell. If multiple classes, each is separated by commas. If a class has a colon and another word next to it (e.g., "cleric: grave") that indicates that only a specific sub-class of that class has access to the spell
Either "cantrip" or the level of spell slot required to cast the spell
School of the spell (e.g., "necromancy", "divination", etc.)
Whether the spell can be cast as a ritual expressed as a logical
Time required to cast the spell. Expressed as either the phase of a turn in which the spell can be cast (e.g., "1 action", "bonus action", etc.) or the actual in-game time required
Range at which the spell can be cast
Whether the spell has verbal ("V"), somatic ("S"), and/or material ("M") components required for casting. If material components are required they are described parenthetically
How long the spell lasts once cast
Full description of the spell. Spells that require the player or Dungeon Master (DM) to roll on a table for an effect have those tables excluded for brevity. Similarly, spells that summon creatures have those creatures' statistics excluded.
Some spells can be cast using a higher level spell slot for an increased effect. Similarly, damage-dealing cantrips tend to deal more damage as PCs gain levels. This text describes how a spell's effects change with higher spell slot levels or PC levels or is NA for spells that remain constant
Mearls, M. and Crawford, J. Dungeons & Dragons Player's Handbook (Fifth Edition). Wizards of the Coast 2014
System Reference Document (Fifth Edition). Wizards of the Coast 2014
Elemental Evil. Wizards of the Coast 2015
Sword Coast Adventurer’s Guide. Wizards of the Coast 2015
Xanathar’s Guide to Everything. Wizards of the Coast 2017
Guildmasters’ Guide to Ravnica. Wizards of the Coast 2018
Lost Laboratory of Kwalish. Wizards of the Coast 2018
Explorer's Guide to Wildemount. Wizards of the Coast 2020
Icewind Dale: Rime of the Frostmaiden. Wizards of the Coast 2020
Tasha’s Cauldron of Everything. Wizards of the Coast 2020
Fizban's Treasury of Dragons. Wizards of the Coast 2021
From Cyan Depths. Wizards of the Coast 2021
Strixhaven: A Curriculum of Chaos. Wizards of the Coast 2021
A Verdant Tomb. Wizards of the Coast 2021
Astral Adventurer's Guide. Wizards of the Coast 2022
Encounters are more difficult than the total of the monsters' experience points (XP). Both the number of monsters making attacks and the number of players attacking those creatures can affect the difficulty of an encounter. The Dungeon Master's Guide (DMG) accounts for this by providing an XP multiplier for given party sizes and numbers of monsters. This function accepts the unmodified total of the monsters' XP and adjusts this as specified in the DMG without the pain of the tables in that book.
xp_cost(monster_xp = NULL, monster_count = NULL, party_size = NULL)
xp_cost(monster_xp = NULL, monster_count = NULL, party_size = NULL)
monster_xp |
(numeric) XP total across all monsters |
monster_count |
(numeric) count for the number of monsters in the encounter |
party_size |
(numeric) value for the number of PCs in the party |
(numeric) value for "realized" XP
# Calculate the realized XP from the raw XP, number of monsters, and number of PCs xp_cost(monster_xp = 100, monster_count = 3, party_size = 2)
# Calculate the realized XP from the raw XP, number of monsters, and number of PCs xp_cost(monster_xp = 100, monster_count = 3, party_size = 2)
Returns the total XP (experience points) of all creatures that would make an encounter the specified level of difficulty for a party of the supplied level. This 'pool' can be used by a GM (game master) to "purchase" monsters to identify how many a party is likely to be able to handle given their average level. NOTE: this does not take into account creature-specific abilities or traits so care should be taken if a monster has many such traits that modify its difficulty beyond its experience point value.
xp_pool(party_level = NULL, party_size = NULL, difficulty = NULL)
xp_pool(party_level = NULL, party_size = NULL, difficulty = NULL)
party_level |
(numeric) integer indicating the average party level. If all players are the same level, that level is the average party level. Non-integer values are supported but results will be slightly affected |
party_size |
(numeric) integer indicating how many player characters (PCs) are in the party |
difficulty |
(character) one of "easy", "medium", "hard", or "deadly" for the desired difficulty of the encounter. |
(numeric) total encounter XP as an integer
# Supply a party level and difficulty and get the total XP of such an encounter xp_pool(party_level = 3, party_size = 2, difficulty = 'medium')
# Supply a party level and difficulty and get the total XP of such an encounter xp_pool(party_level = 3, party_size = 2, difficulty = 'medium')