Documentation
¶
Index ¶
- Variables
- type Board
- func (b *Board) CurrentTag(c *Combatant) string
- func (b *Board) DuplicateCombatant(who *Combatant) *Combatant
- func (b *Board) IsCurrent(c *Combatant) bool
- func (b *Board) Load(path string) error
- func (b *Board) Lookup(id int) *Combatant
- func (b *Board) NewCombatant(genID bool, entity *data.Entity) *Combatant
- func (b *Board) NextID() int
- func (b *Board) Save(path string) error
- func (b *Board) SetLibrarySelection(e *data.Entity)
- func (b *Board) SuggestName(nameHint string) string
- type Combatant
- func (c *Combatant) BasedOn() string
- func (c *Combatant) Clone(newID int) *Combatant
- func (c *Combatant) CurrentHP() int
- func (c *Combatant) FormattedHP() string
- func (c *Combatant) Harm(round, amount int)
- func (c *Combatant) Heal(round, amount int)
- func (c *Combatant) Out() bool
- func (c *Combatant) PossessiveName() string
- func (c *Combatant) RecordHPChange(round, delta int)
- func (c *Combatant) Status() string
- func (c *Combatant) StatusTag() string
- func (c *Combatant) Type() string
- func (c *Combatant) TypeDescription() string
- type HPMethod
- func (hpm HPMethod) AllMethods() []HPMethod
- func (hpm HPMethod) HP(e *data.Entity) int
- func (hpm HPMethod) Key() string
- func (hpm HPMethod) Lookup(key string) HPMethod
- func (hpm HPMethod) MarshalText() (text []byte, err error)
- func (hpm HPMethod) String() string
- func (hpm *HPMethod) UnmarshalText(text []byte) error
- type Note
Constants ¶
This section is empty.
Variables ¶
var ( // AllHPMethods holds all possible HPMethods. AllHPMethods []HPMethod )
Functions ¶
This section is empty.
Types ¶
type Board ¶
type Board struct { Round int `json:"round"` Current int `json:"current"` Combatants []*Combatant `json:"combatants,omitempty"` InitiativeDice *dice.Dice `json:"initiative_dice,omitempty"` HPMethod HPMethod `json:"hp_method,omitempty"` LibrarySelection int `json:"library_selection,omitempty"` LibraryEntity *data.Entity `json:"-"` LastID int64 `json:"-"` }
Board holds the initiative board data.
func (*Board) CurrentTag ¶
CurrentTag returns the current tag to use for the combatant, if any.
func (*Board) DuplicateCombatant ¶
DuplicateCombatant duplicates an existing combatant and add them to the board.
func (*Board) NewCombatant ¶
NewCombatant creates a new combatant.
func (*Board) SetLibrarySelection ¶
SetLibrarySelection sets the current library selection.
func (*Board) SuggestName ¶
SuggestName suggests a name for a combatant.
type Combatant ¶
type Combatant struct { ID int `json:"id"` Name string `json:"name,omitempty"` Initiative int `json:"initiative,omitempty"` InitiativeBase int `json:"initiative_base,omitempty"` RandomTieBreaker int `json:"random_tie_breaker,omitempty"` HPFull int `json:"hp_full,omitempty"` HPTemporary int `json:"hp_temp,omitempty"` HPDamage int `json:"hp_damage,omitempty"` HPChanges []string `json:"hp_changes,omitempty"` EntityID int `json:"entity_id,omitempty"` Notes []Note `json:"notes,omitempty"` Enemy bool `json:"enemy,omitempty"` }
Combatant holds information for a single entity in combat.
func (*Combatant) FormattedHP ¶
FormattedHP returns the HP formatted for display.
func (*Combatant) PossessiveName ¶
PossessiveName returns the possessive form of the combatant's name.
func (*Combatant) RecordHPChange ¶
RecordHPChange records a hit point change. 'round' indicates what round the change occurred.
func (*Combatant) TypeDescription ¶
TypeDescription returns a human-readable type for the combatant.
type HPMethod ¶
type HPMethod byte
HPMethod is an enum of possible ways to determine HP for an entity.
const ( RolledHPMethod HPMethod = iota MinimumHPMethod AverageHPMethod MaximumHPMethod ThreeQuartersHPMethod )
Possible HPMethods.
func (HPMethod) AllMethods ¶
AllMethods returns all possible methods.
func (HPMethod) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*HPMethod) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Note ¶
type Note struct { Description string `json:"description,omitempty"` Timed bool `json:"timed,omitempty"` UntilEnd bool `json:"until_end,omitempty"` Who int `json:"who,omitempty"` Round int `json:"round,omitempty"` }
Note holds a note about a combatant, which may be set to expire at a given point in time.