Documentation ¶
Index ¶
- Constants
- Variables
- func CheckForUpdates() string
- func LaunchUpdateDownload()
- type App
- type CategorizedEntity
- type Class
- type ClassFeature
- type ClassSpell
- type DataSource
- type Entity
- type EntityKind
- type Feat
- type Item
- type Level
- type MatchResult
- type MatchedSequence
- type Monster
- type Named
- type QueryListener
- type QueryMatcher
- type Race
- type RaceTrait
- type ReferenceList
- type ResultsListener
- type SearchResult
- type Spell
- type SpellUser
- type Stats
- type Textual
- type Trait
- type Traitor
Constants ¶
const Version = "1.8.0"
Version is the current version of the app
Variables ¶
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
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 ¶
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 ¶
ClassFeature is basically a Trait for one or more classes
func (ClassFeature) GetKind ¶
func (t ClassFeature) GetKind() EntityKind
GetKind from Entity interface
type ClassSpell ¶
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
type DataSource ¶
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
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 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 .
type MatchResult ¶
type MatchResult struct { Matched bool Score float32 Sequences []*MatchedSequence }
MatchResult is the result of
type MatchedSequence ¶
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 .
type Named ¶
type Named struct {
Name string `xml:"name"`
}
Named is a mixin for anything with a name.
type QueryMatcher ¶
type QueryMatcher struct {
// contains filtered or unexported fields
}
QueryMatcher .
type ReferenceList ¶
ReferenceList is a dynamic entity that points to other Entities
func (ReferenceList) GetKind ¶
func (s ReferenceList) GetKind() EntityKind
GetKind from Entity interface
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 .
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