dndapi

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionUsage

type ActionUsage struct {
	Type     string `json:"type"`
	Dice     string `json:"dice"`
	MinValue int    `json:"min_value"`
}

type Actions

type Actions struct {
	Name            string    `json:"name"`
	MultiattackType string    `json:"multiattack_type,omitempty"`
	Desc            string    `json:"desc"`
	Actions         []Actions `json:"actions"`
	AttackBonus     int       `json:"attack_bonus,omitempty"`
	Damage          []Damage  `json:"damage,omitempty"`
	Dc              Dc        `json:"dc,omitempty"`
	Usage           Usage     `json:"usage,omitempty"`
}

type ArmorClass

type ArmorClass struct {
	Type  string `json:"type"`
	Value int    `json:"value"`
}

type Attack

type Attack struct {
	Name        string
	AttackBonus int
	Damage      []Damage
}

I don't entirely think this section should be here? It seems slightly out of place to me. TODO: Move to a more logical place in the codebase.

type AttackDamage

type AttackDamage struct {
	Name        string
	Type        string
	Damage      int
	AttackBonus int
}

func UseRandomAttack

func UseRandomAttack(attacks []*Attack) *AttackDamage

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(timeout time.Duration) Client

func (*Client) GetAllMonsters

func (c *Client) GetAllMonsters() ([]MonsterSearchResult, error)

func (*Client) GetMonster

func (c *Client) GetMonster(monster string) (Monster, error)

type Damage

type Damage struct {
	DamageType DamageType `json:"damage_type"`
	DamageDice string     `json:"damage_dice"`
}

type DamageType

type DamageType struct {
	Index string `json:"index"`
	Name  string `json:"name"`
	URL   string `json:"url"`
}

type Dc

type Dc struct {
	DcType      DcType `json:"dc_type"`
	DcValue     int    `json:"dc_value"`
	SuccessType string `json:"success_type"`
}

type DcType

type DcType struct {
	Index string `json:"index"`
	Name  string `json:"name"`
	URL   string `json:"url"`
}

type LegendaryActions

type LegendaryActions struct {
	Name   string   `json:"name"`
	Desc   string   `json:"desc"`
	Dc     Dc       `json:"dc,omitempty"`
	Damage []Damage `json:"damage,omitempty"`
}

type Monster

type Monster struct {
	Index                 string             `json:"index"`
	Name                  string             `json:"name"`
	Size                  string             `json:"size"`
	Type                  string             `json:"type"`
	Alignment             string             `json:"alignment"`
	ArmorClass            []ArmorClass       `json:"armor_class"`
	HitPoints             int                `json:"hit_points"`
	HitDice               string             `json:"hit_dice"`
	HitPointsRoll         string             `json:"hit_points_roll"`
	Speed                 Speed              `json:"speed"`
	Strength              int                `json:"strength"`
	Dexterity             int                `json:"dexterity"`
	Constitution          int                `json:"constitution"`
	Intelligence          int                `json:"intelligence"`
	Wisdom                int                `json:"wisdom"`
	Charisma              int                `json:"charisma"`
	Proficiencies         []Proficiencies    `json:"proficiencies"`
	DamageVulnerabilities []string           `json:"damage_vulnerabilities"`
	DamageResistances     []string           `json:"damage_resistances"`
	DamageImmunities      []string           `json:"damage_immunities"`
	Senses                Senses             `json:"senses"`
	Languages             string             `json:"languages"`
	ChallengeRating       float32            `json:"challenge_rating"`
	ProficiencyBonus      int                `json:"proficiency_bonus"`
	Xp                    int                `json:"xp"`
	SpecialAbilities      []SpecialAbilities `json:"special_abilities"`
	Actions               []Actions          `json:"actions"`
	LegendaryActions      []LegendaryActions `json:"legendary_actions"`
	URL                   string             `json:"url"`
}

func (*Monster) ParseAttacks

func (m *Monster) ParseAttacks() []*Attack

type MonsterSearchResp

type MonsterSearchResp struct {
	Count   int                   `json:"count"`
	Results []MonsterSearchResult `json:"results"`
}

type MonsterSearchResult

type MonsterSearchResult struct {
	Index string `json:"index"`
	Name  string `json:"name"`
}

type Proficiencies

type Proficiencies struct {
	Value       int         `json:"value"`
	Proficiency Proficiency `json:"proficiency"`
}

type Proficiency

type Proficiency struct {
	Index string `json:"index"`
	Name  string `json:"name"`
	URL   string `json:"url"`
}

type Senses

type Senses struct {
	Blindsight        string `json:"blindsight"`
	Darkvision        string `json:"darkvision"`
	PassivePerception int    `json:"passive_perception"`
}

type SpecialAbilities

type SpecialAbilities struct {
	Name  string `json:"name"`
	Desc  string `json:"desc"`
	Usage Usage  `json:"usage,omitempty"`
}

type Speed

type Speed struct {
	Walk string `json:"walk"`
	Fly  string `json:"fly"`
	Swim string `json:"swim"`
}

type SubActions

type SubActions struct {
	ActionName string `json:"action_name"`
	Count      int    `json:"count"`
	Type       string `json:"type"`
}

type Usage

type Usage struct {
	Type      string `json:"type"`
	Times     int    `json:"times"`
	RestTypes []any  `json:"rest_types"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL