Skip to content

YellowCoat1/dnd_lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

210 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DnD Lib

A rust library for creating and managing Dungeons & Dragons characters.

The main goal of this library is to model D&D characters, and have an easy interface for using those characters.

Installation

Just add the latest version through cargo add:

cargo add dnd_lib

Features

  • Multiclasing
  • Homebrew classes, races, items, and more
  • Open-ended api trait
  • Serializable datastructures for easy caching

Usage

Creating a simple level 1 character. Do note this takes ~20 seconds, since the api gets are sequential.

use dnd_lib::prelude::*;
#[tokio::main]
async fn main() {
	let provider = Dnd5eapigetter::new();
	
	let rogue = provider.get_class("rogue").await.unwrap();
	let human = provider.get_race("human").await.unwrap();
	let acolyte = provider.get_background("acolyte").await.unwrap();

	let john = CharacterBuilder::new("John")
		.race(&human)
		.background(&acolyte)
		.class(&rogue)
		.stats(Stats::default())
		.build().unwrap();
		
	println!("John's ac is {}", john.ac());
	println!("John has {} strength", john.stats().strength);
}

About

A rust library for creating dungeons and dragons characters

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages