data

package
v0.0.0-...-8b058bf Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompanyTerminalSettings

func CompanyTerminalSettings(options ...terminal.Option) terminal.Settings

func DisplayGroupTerminal

func DisplayGroupTerminal(groups []Group) string

func GroupMarkdownTable

func GroupMarkdownTable(groups ...Group) string

func GroupTerminalSettings

func GroupTerminalSettings(options ...pterm.Option) (settings *pterm.Settings)

func TraitMarkdownTable

func TraitMarkdownTable(traits ...Trait)

func TraitTerminalSettings

func TraitTerminalSettings(options ...terminal.Option) terminal.Settings

Types

type ApplicableRequirement

type ApplicableRequirement func(group Group, trait Trait) bool

func WithCompanyMaxPoints

func WithCompanyMaxPoints(max int, current int) ApplicableRequirement

func WithGroupMaxPoints

func WithGroupMaxPoints(max int) ApplicableRequirement

type Company

type Company struct {
	Name        string
	Description string
	Groups      []Group
	Source      string
}

func GetCompany

func GetCompany(name string, companyList []Company) (Company, error)

func (*Company) Initialize

func (company *Company) Initialize(availableProfiles []Profile, availableTraits []Trait) error

func (Company) Points

func (company Company) Points() (points int)

func (*Company) ToJson

func (company *Company) ToJson(options ...json.Option) string

func (*Company) ToMarkdown

func (company *Company) ToMarkdown()

func (*Company) ToTerminal

func (company *Company) ToTerminal()

func (Company) WithSource

func (company Company) WithSource(source string) Company

type FightingStrength

type FightingStrength struct {
	Current int
	Maximum int
}

func (*FightingStrength) String

func (fightingStrength *FightingStrength) String() string

type Group

type Group struct {
	Name             string
	Id               string
	ProfileName      string
	Melee            Melee
	Move             Move
	Missile          Missile
	FightingStrength FightingStrength `mapstructure:"fighting_strength"`
	Resolve          int
	Toughness        int
	Traits           []string
	Points           int
	Captain          Trait
	Addenda          map[string]any
}

func NewGroup

func NewGroup(name string, profileName string, availableProfiles []Profile) (Group, error)

func (*Group) DemoteFromCaptain

func (group *Group) DemoteFromCaptain()

func (*Group) Initialize

func (group *Group) Initialize(availableProfiles []Profile) error

func (*Group) MarkdownHeader

func (group *Group) MarkdownHeader() string

func (*Group) PromoteToCaptain

func (group *Group) PromoteToCaptain(trait *Trait, availableTraits ...Trait) error

func (*Group) TableHeaderTerminal

func (group *Group) TableHeaderTerminal(options ...pterm.Option) string

func (*Group) ToJson

func (group *Group) ToJson(options ...pjson.Option) string

func (*Group) ToMarkdownTableEntry

func (group *Group) ToMarkdownTableEntry() string

func (Group) ToSlice

func (group Group) ToSlice() (groups []Group)

func (*Group) ToTerminalTableEntry

func (group *Group) ToTerminalTableEntry(options ...pterm.Option) string

type Grouper

type Grouper interface {
	Initialize(availableProfiles []Profile) error
}

type Melee

type Melee struct {
	Activation     int
	ToHitAttacking int `mapstructure:"to_hit_attacking"`
	ToHitDefending int `mapstructure:"to_hit_defending"`
}

func (*Melee) String

func (melee *Melee) String() string

type Missile

type Missile struct {
	Activation int
	ToHit      int `mapstructure:"to_hit"`
	Range      int
}

func (*Missile) String

func (missile *Missile) String() string

type Move

type Move struct {
	Activation int
	Distance   int
}

func (*Move) String

func (move *Move) String() string

type Profile

type Profile struct {
	Source           string
	Type             string
	Category         string
	Melee            Melee
	Move             Move
	Missile          Missile
	FightingStrength FightingStrength `mapstructure:"fighting_strength"`
	Resolve          int
	Toughness        int
	Traits           []string
	Points           int
}

func GetProfile

func GetProfile(name string, profileList []Profile) (Profile, error)

func (*Profile) Name

func (profile *Profile) Name() string

func (Profile) WithSource

func (profile Profile) WithSource(source string) Profile

type Profiler

type Profiler interface {
	Name() string
}

type Spell

type Spell struct {
	Source   string
	Name     string
	Check    int
	Range    int
	Target   string
	Duration string
	Effect   string
}

func (Spell) WithSource

func (spell Spell) WithSource(source string) Spell

type Trait

type Trait struct {
	Name      string
	Type      string
	Source    string
	Roll      int
	Effect    string
	Points    int
	Scripting TraitScripting
	Choices   []*TraitChoice
}

func FilterTraitsBySource

func FilterTraitsBySource(sourceName string, traitList []Trait) []Trait

func FilterTraitsByType

func FilterTraitsByType(typeName string, traitList []Trait) []Trait

func GetProfileTraits

func GetProfileTraits(profile Profile, traitList []Trait) []Trait

func GetTraitByName

func GetTraitByName(name string, traitList []Trait) Trait

func RollForCaptainTrait

func RollForCaptainTrait(availableTraits []Trait) (captainsTrait Trait, err error)

func (Trait) AddToGroup

func (trait Trait) AddToGroup(group *Group, engine *scripting.Engine) (updatedGroup *Group, err error)

func (Trait) Applicable

func (trait Trait) Applicable(group Group, baseProfile Group, engine *scripting.Engine, requirements ...ApplicableRequirement) (bool, error)

func (Trait) DisplayEffectBlock

func (trait Trait) DisplayEffectBlock(style lipgloss.Style, width int) string

func (*Trait) MarkdownHeader

func (trait *Trait) MarkdownHeader()

func (Trait) OnAddScriptBody

func (trait Trait) OnAddScriptBody() string

func (Trait) OnRemoveScriptBody

func (trait Trait) OnRemoveScriptBody() string

func (Trait) RemoveFromGroup

func (trait Trait) RemoveFromGroup(group *Group, engine *scripting.Engine) (updatedGroup *Group, err error)

func (Trait) RequirementsScriptBody

func (trait Trait) RequirementsScriptBody() string

func (*Trait) ToJson

func (trait *Trait) ToJson(options ...json.Option) string

func (*Trait) ToMarkdownTableEntry

func (trait *Trait) ToMarkdownTableEntry()

func (*Trait) ToTerminalChoice

func (trait *Trait) ToTerminalChoice(selected bool, leadWidth int, options ...terminal.Option) string

func (Trait) TraitWithChoiceUpdatedName

func (trait Trait) TraitWithChoiceUpdatedName() *Trait

func (Trait) WithSource

func (trait Trait) WithSource(source string) Trait

func (Trait) WithSubtype

func (trait Trait) WithSubtype(subtype string) Trait

type TraitChoice

type TraitChoice struct {
	Name   string
	Value  any
	Prompt dynamic.Info // TODO: support serial prompt, nested prompts
}

type TraitScripting

type TraitScripting struct {
	Requirements []string
	OnAdd        []string               `mapstructure:"on_add"`
	OnRemove     []string               `mapstructure:"on_remove"`
	InPlay       []TraitScriptingInPlay `mapstructure:"in_play"`
}

type TraitScriptingInPlay

type TraitScriptingInPlay struct {
	RegisterFor []string `mapstructure:"register_for"`
	AppliesTo   string   `mapstructure:"applies_to"`
	Uses        []TraitUses
	When        []string
	Then        []string
}

type TraitUses

type TraitUses struct {
	PerTurn       int `mapstructure:"per_turn"`
	GlobalPerTurn int `mapstructure:"global_per_turn"`
}

Jump to

Keyboard shortcuts

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