beholder

package
v0.0.0-...-1459c67 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "1.8.0"

Version is the current version of the app

Variables

View Source
var ConditionsDataSource = rulesDataSource(ConditionEntity,
	rule("Conditions",
		"Conditions alter a creature's capabilities in a variety of ways and can arise as a result of a spell, a class feature, a monster's attack, or other effect. Most conditions, such as blinded, are impairments, but a few, such as invisible, can be advantageous.",
		"A condition lasts either until it is countered (the prone condition is countered by standing up, for example) or for a duration specified by the effect that imposed the condition.",
		"If multiple effects impose the same condition on a creature, each instance of the condition has its own duration, but the condition's effects don't get worse. A creature either has a condition or doesn't.",
		"The following definitions specify what happens to a creature while it is subjected to a condition.",

		section("Blinded",
			"• A blinded creature can't see and automatically fails any ability check that requires sight.",
			"• Attack rolls against the creature have advantage, and the creature's attack rolls have disadvantage.",
		),

		section("Charmed",
			"• A charmed creature can't attack the charmer or target the charmer with harmful abilities or magical effects.",
			"• The charmer has advantage on any ability check to interact socially with the creature.",
		),

		section("Deafened",
			"• A deafened creature can't hear and automatically fails any ability check that requires hearing.",
		),

		section("Exhaustion",
			"Some special abilities and environmental hazards, such as starvation and the long-term effects of freezing or scorching temperatures, can lead to a special condition called exhaustion. Exhaustion is measured in six levels. An effect can give a creature one or more levels of exhaustion, as specified in the effect's description.",
			"",
			"<h2>Level  Effect</h2>",
			"  1    Disadvantage on ability checks",
			"  2    Speed halved",
			"  3    Disadvantage on attack rolls and saving throws",
			"  4    Hit point maximum halved",
			"  5    Speed reduced to 0",
			"  6    Death",
			"",
			"	If an already exhausted creature suffers another effect that causes exhaustion, its current level of exhaustion increases by the amount specified in the effect's description.",
			"	A creature suffers the effect of its current level of exhaustion as well as all lower levels. For example, a creature suffering level 2 exhaustion has its speed halved and has disadvantage on ability checks.",
			"	An effect that removes exhaustion reduces its level as specified in the effect's description, with all exhaustion effects ending if a creature's exhaustion level is reduced below 1.",
			"	Finishing a long rest reduces a creature's exhaustion level by 1, provided that the creature has also ingested some food and drink.",
		),

		section("Frightened",
			"• A frightened creature has disadvantage on ability checks and attack rolls while the source of its fear is within line of sight.",
			"• The creature can't willingly move closer to the source of its fear.",
		),

		section("Grappled",
			"• A grappled creature's speed becomes 0, and it can't benefit from any bonus to its speed.",
			"• The condition ends if the grappler is incapacitated (see the condition).",
			"• The condition also ends if an effect removes the grappled creature from the reach of the grappler or grappling effect, such as when a creature is hurled away by the <b>thunder wave</b> spell.",
		),

		section("Incapacitated",
			"• An incapacitated creature can't take actions or reactions.",
		),

		section("Invisible",
			"• An invisible creature is impossible to see without the aid of magic or a special sense. For the purpose of hiding, the creature is heavily obscured. The creature's location can be detected by any noise it makes or any tracks it leaves.",
			"• Attack rolls against the creature have disadvantage, and the creature's attack rolls have advantage.",
		),

		section("Paralyzed",
			"• A paralyzed creature is incapacitated (see the condition) and can't move or speak.",
			"• The creature automatically fails Strength and Dexterity saving throws. Attack rolls against the creature have advantage.",
			"• Any attack that hits the creature is a critical hit if the attacker is within 5 feet of the creature.",
		),

		section("Petrified",
			"• A petrified creature is transformed, along with any nonmagical object it is wearing or carrying, into a solid inanimate substance (usually stone). Its weight increases by a factor of ten, and it ceases aging.",
			"• The creature is incapacitated (see the condition), can't move or speak, and is unaware of its surroundings.",
			"• Attack rolls against the creature have advantage.",
			"• The creature automatically fails Strength and Dexterity saving throws.",
			"• The creature has resistance to all damage.",
			"• The creature is immune to poison and disease, although a poison or disease already in its system is suspended, not neutralized.",
		),

		section("Poisoned",
			"• A poisoned creature has disadvantage on attack rolls and ability checks.",
		),

		section("Prone",
			"• A prone creature's only movement option is to crawl, unless it stands up and thereby ends the condition.",
			"• The creature has disadvantage on attack rolls.",
			"• An attack roll against the creature has advantage if the attacker is within 5 feet of the creature. Otherwise, the attack roll has disadvantage.",
		),

		section("Restrained",
			"• A restrained creature's speed becomes 0, and it can't benefit from any bonus to its speed.",
			"• Attack rolls against the creature have advantage, and the creature's attack rolls have disadvantage.",
			"• The creature has disadvantage on Dexterity saving throws.",
		),

		section("Stunned",
			"• A stunned creature is incapacitated (see the condition), can't move, and can speak only falteringly.",
			"• The creature automatically fails Strength and Dexterity saving throws.",
			"• Attack rolls against the creature have advantage.",
		),

		section("Unconscious",
			"• An unconscious creature is incapacitated (see the condition), can't move or speak, and is unaware of its surroundings",
			"• The creature drops whatever it's holding and falls prone.",
			"• The creature automatically fails Strength and Dexterity saving throws.",
			"• Attack rolls against the creature have advantage.",
			"• Any attack that hits the creature is a critical hit if the attacker is within 5 feet of the creature.",
		),
	),
)

ConditionsDataSource .

Functions

func CheckForUpdates

func CheckForUpdates() string

CheckForUpdates returns the version string of the latest update, or an empty string if there is no update

func LaunchUpdateDownload

func LaunchUpdateDownload()

LaunchUpdateDownload .

Types

type App

type App struct {
	// Callbacks provided by NewApp()
	OnQueryChanged QueryListener

	// required callbacks:
	OnUpdateAvailable func(newVersion string)
	OnResults         ResultsListener
	Quit              func()

	// optional callbacks:
	OnError func(err error)
	// contains filtered or unexported fields
}

App represents the main app state

func NewApp

func NewApp(dataSource DataSource) (*App, error)

NewApp creates a new App using the given DataSource

func NewAppWithEntities

func NewAppWithEntities(entities []Entity) *App

NewAppWithEntities is a Factory that's convenient for testing

func (*App) Query

func (a *App) Query(query string) []SearchResult

Query attempts to find Entities that match the query

type CategorizedEntity

type CategorizedEntity interface {
	GetCategory() string
}

A CategorizedEntity belongs to a category. This is primarily used in conjunction with ReferenceList

type Class

type Class struct {
	Named

	HitDice      int    `xml:"hd"`
	Proficiency  string `xml:"proficiency"`
	SpellAbility string `xml:"spellAbility"`

	Levels []Level `xml:"autolevel"`
}

Class .

type ClassFeature

type ClassFeature struct {
	*Trait
	Classes []string
}

ClassFeature is basically a Trait for one or more classes

func (ClassFeature) GetKind

func (t ClassFeature) GetKind() EntityKind

GetKind from Entity interface

func (ClassFeature) GetText

func (t ClassFeature) GetText() []string

GetText implements the Textual interface

type ClassSpell

type ClassSpell struct {
	Spell        *Spell
	Variants     []string
	VariantsOnly bool
}

ClassSpell collects all the Variants of a given Class that can use the provided Spell

func (ClassSpell) GetCategory

func (c ClassSpell) GetCategory() string

GetCategory from CategorizedEntity interface

func (ClassSpell) GetKind

func (c ClassSpell) GetKind() EntityKind

GetKind from Entity interface

func (ClassSpell) GetName

func (c ClassSpell) GetName() string

GetName from Entity interface

type DataSource

type DataSource interface {
	GetEntities() ([]Entity, error)
}

DataSource abstracts fetching and loading Entities

func MergeDataSources

func MergeDataSources(sources ...DataSource) DataSource

MergeDataSources creates a DataSource that combines the results of all the provided DataSource instances

func NewDataSource

func NewDataSource() (DataSource, error)

NewDataSource creates a new default DataSource

func NewJSONRulesSource

func NewJSONRulesSource() (DataSource, error)

NewJSONRulesSource constructs a DataSource that generates rules from JSON downloaded externally

func NewSpellListsSource

func NewSpellListsSource(delegate DataSource) DataSource

NewSpellListsSource creates a dynamic DataSource that augments the one provided with extra entities containing the list of spells available for each known class

func NewStaticDataSource

func NewStaticDataSource(entities []Entity) DataSource

NewStaticDataSource .

type Entity

type Entity interface {
	GetName() string
	GetKind() EntityKind
}

Entity is some renderable datum

func ParseXML

func ParseXML(reader io.Reader) ([]Entity, error)

ParseXML extracts Entity instances from the Reader

type EntityKind

type EntityKind int

EntityKind is the kind of entity

const (
	ActionEntity EntityKind = iota + 1
	ConditionEntity
	FeatEntity
	FeatureEntity
	ItemEntity
	MonsterEntity
	ReferenceListEntity
	RuleEntity
	SpellEntity
	TraitEntity
)

EntityKinds

type Feat

type Feat struct {
	Named
	// contains filtered or unexported fields
}

Feat .

func (Feat) GetKind

func (t Feat) GetKind() EntityKind

GetKind from Entity interface

func (Feat) GetText

func (t Feat) GetText() []string

GetText implements the Textual interface

type Item

type Item struct {
	Named

	Type     string `xml:"type"`
	Magic    int    `xml:"magic"`
	Value    string `xml:"value"`
	Weight   string `xml:"weight"`
	Property string `xml:"property"`
	Rarity   string `xml:"rarity"`
	// contains filtered or unexported fields
}

Item .

func (Item) GetKind

func (i Item) GetKind() EntityKind

GetKind from Entity interface

func (Item) GetText

func (t Item) GetText() []string

GetText implements the Textual interface

type Level

type Level struct {
	Level    int      `xml:"level,attr"`
	Features []*Trait `xml:"feature"`
}

Level represents features, etc. granted at a given level

type MatchResult

type MatchResult struct {
	Matched   bool
	Score     float32
	Sequences []*MatchedSequence
}

MatchResult is the result of

type MatchedSequence

type MatchedSequence struct {
	Start int
	End   int
	// contains filtered or unexported fields
}

MatchedSequence represents a range of an Entity's name that matched the query string

type Monster

type Monster struct {
	Named
	Stats

	Size      string   `xml:"size"`
	Type      string   `xml:"type"`
	Alignment string   `xml:"alignment"`
	Challenge string   `xml:"cr"`
	Languages string   `xml:"languages"`
	Actions   []*Trait `xml:"action"`
	Legendary []*Trait `xml:"legendary"`
	// contains filtered or unexported fields
}

Monster .

func (Monster) GetKind

func (m Monster) GetKind() EntityKind

GetKind from Entity interface

func (Monster) GetTraits

func (t Monster) GetTraits() []*Trait

type Named

type Named struct {
	Name string `xml:"name"`
}

Named is a mixin for anything with a name.

func (Named) GetName

func (n Named) GetName() string

GetName helps implement the Entity interface

type QueryListener

type QueryListener func(query string)

QueryListener .

type QueryMatcher

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

QueryMatcher .

func NewQueryMatcher

func NewQueryMatcher(query string) *QueryMatcher

NewQueryMatcher .

func (*QueryMatcher) Match

func (q *QueryMatcher) Match(value string) MatchResult

Match .

type Race

type Race struct {
	Named
	// contains filtered or unexported fields
}

Race .

func (Race) GetTraits

func (t Race) GetTraits() []*Trait

type RaceTrait

type RaceTrait struct {
	*Trait
	Races []string
}

RaceTrait is a Trait for one or more races

func (RaceTrait) GetKind

func (t RaceTrait) GetKind() EntityKind

GetKind from Entity interface

func (RaceTrait) GetText

func (t RaceTrait) GetText() []string

GetText implements the Textual interface

type ReferenceList

type ReferenceList struct {
	Named
	References []Entity
}

ReferenceList is a dynamic entity that points to other Entities

func (ReferenceList) GetKind

func (s ReferenceList) GetKind() EntityKind

GetKind from Entity interface

type ResultsListener

type ResultsListener func([]SearchResult)

ResultsListener .

type SearchResult

type SearchResult interface {
	GetEntity() Entity
	GetSequences() []*MatchedSequence
}

SearchResult .

type Spell

type Spell struct {
	Named

	Level      int     `xml:"level"`
	School     string  `xml:"school"`
	Time       string  `xml:"time"`
	Range      string  `xml:"range"`
	Ritual     *string `xml:"ritual"`
	Components string  `xml:"components"`
	Duration   string  `xml:"duration"`
	Classes    string  `xml:"classes"`
	SpellUsers []SpellUser
	// contains filtered or unexported fields
}

Spell .

func (Spell) GetKind

func (s Spell) GetKind() EntityKind

GetKind from Entity interface

func (Spell) GetText

func (t Spell) GetText() []string

GetText implements the Textual interface

type SpellUser

type SpellUser struct {
	Named
	Variant string
}

SpellUser describes a Class that can use a Spell

type Stats

type Stats struct {
	ArmorClass            string `xml:"ac"`
	HP                    string `xml:"hp"`
	Speed                 string `xml:"speed"`
	Str                   int    `xml:"str"`
	Dex                   int    `xml:"dex"`
	Con                   int    `xml:"con"`
	Int                   int    `xml:"int"`
	Wis                   int    `xml:"wis"`
	Cha                   int    `xml:"cha"`
	PassivePerception     int    `xml:"passive"`
	SavingThrows          string `xml:"saving"`
	SkillModifiers        string `xml:"skill"`
	Senses                string `xml:"senses"`
	DamageImmunities      string `xml:"immune"`
	DamageResistances     string `xml:"resist"`
	DamageVulnerabilities string `xml:"vulnerable"`
	ConditionImmunities   string `xml:"conditionImmune"`
}

Stats is a stat block for a creature

type Textual

type Textual interface {
	GetText() []string
}

Textual .

type Trait

type Trait struct {
	Named
	// contains filtered or unexported fields
}

Trait is a simple container for a Name and Text

func (Trait) GetText

func (t Trait) GetText() []string

GetText implements the Textual interface

type Traitor

type Traitor interface {
	GetTraits() []*Trait
}

Traitor has Traits (bad pun, I know)

Directories

Path Synopsis
ui
tui

Jump to

Keyboard shortcuts

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