models

package
v0.0.0-...-be570d4 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Armor

type Armor struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description"`
}

Armor is a simple armor

type CharMap

type CharMap map[string]Character

CharMap is a map holding Characters based on the name of the yaml file they are stored in

func NewCharMapFromGlob

func NewCharMapFromGlob(pattern string) (CharMap, error)

NewCharMapFromGlob creates a new CharMap and loads all the characters that matches the unix shell pattern inside it

func (CharMap) LoadGlob

func (cm CharMap) LoadGlob(pattern string) error

LoadGlob will load all the characters that matches the given unix shell pattern

type Character

type Character struct {
	PortraitURL  string  `yaml:"portrait_url"`
	Name         string  `yaml:"name"`
	Age          int     `yaml:"age"`
	FakeID       string  `yaml:"fake_id"`
	Race         string  `yaml:"race"`
	Height       float64 `yaml:"height"`
	Weight       float64 `yaml:"weight"`
	Origin       string  `yaml:"origin"`
	PreferedHand string  `yaml:"prefered_hand"`
	XPs          int     `yaml:"xps"`
	SpentXPs     int     `yaml:"spent_xps"`

	HitPoints    int `yaml:"hit_points"`
	Fatigue      int `yaml:"fatigue"`
	ForcePoints  int `yaml:"force_points"`
	BaseMovement int `yaml:"base_movement"`

	Wealth Wealth `yaml:"wealth"`

	Formations []Formation `yaml:"formations"`
	Talents    []Talent    `yaml:"talents"`
	Stats      []Stat      `yaml:"stats"`
	Skills     []Stat      `yaml:"skills"`
	Spells     []Spell     `yaml:"spells"`

	Equipment Equipment        `yaml:"equipment"`
	Inventory []QuantifiedItem `yaml:"inventory"`
}

Character represents a single player character

func (*Character) Enrich

func (c *Character) Enrich()

Enrich will execute many operations to try and enrich the character will computable data

func (*Character) Load

func (c *Character) Load(fp string) error

Load loads a character with the given yaml file

type DiceThrow

type DiceThrow struct {
	Throws         int  `yaml:"throws"`
	Type           int  `yaml:"type"`
	Ranked         bool `yaml:"ranked"`
	Modifier       int  `yaml:"modifier"`
	RankedModifier bool `yaml:"ranked_modifier"`
	FmtModifier    string
}

DiceThrow defines the way dice throws are represented For exemple 10D10 → Throws: 10, Type: 10

func (*DiceThrow) Format

func (d *DiceThrow) Format()

Format formats the dice throw

type Equipment

type Equipment struct {
	// Weapons
	Weapons       []Weapon       `yaml:"weapons"`
	RangedWeapons []RangedWeapon `yaml:"ranged_weapons"`

	// Armors
	Head          []Armor `yaml:"head"`
	ShoulderStrap []Armor `yaml:"shoulder_strap"`
	Jacket        []Armor `yaml:"jacket"`
	Holster       []Armor `yaml:"holster"`
	Trouser       []Armor `yaml:"trouser"`
	Belt          []Armor `yaml:"belt"`
	Boots         []Armor `yaml:"boots"`
	Other         []Armor `yaml:"other"`
}

Equipment groups all the stuff the player has equipped or can equip

type Formation

type Formation struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description"`
	Modifier    int    `yaml:"modifier"`
}

Formation represent a single formation (and what it does)

type Item

type Item struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description"`
	Effect      string `yaml:"effect"`
	Unit        string `yaml:"unit"`
}

Item represents a single item

type QuantifiedItem

type QuantifiedItem struct {
	Item     `yaml:",inline"`
	Quantity int `yaml:"quantity"`
}

QuantifiedItem adds a single quantity field to an item (for storage purpose)

type RangedWeapon

type RangedWeapon struct {
	Weapon `yaml:",inline"`
	Scope  int `yaml:"scope"` // In meters
}

RangedWeapon describes a ranged weapon

type Spell

type Spell struct {
	Talent      `yaml:",inline"`
	Scope       int      `yaml:"scope"`
	Ingredients []string `yaml:"ingredients"`
	Duration    string   `yaml:"duration"`
	Size        string   `yaml:"size"`
}

Spell is a talent with an associated test and a score

func (*Spell) Enrich

func (s *Spell) Enrich()

Enrich adds some formatted fields

type Stat

type Stat struct {
	Name     string `yaml:"name"`
	Base     int    `yaml:"base"`
	Rank     string `yaml:"rank"`
	Modifier int    `yaml:"modifier"`
	Icon     string `yaml:"icon"`
}

Stat can be a main stat or an extra stat (in which case, rank and base are not taken into account)

func (*Stat) MatchIcon

func (s *Stat) MatchIcon()

MatchIcon will assign a default icon if none is given

type Talent

type Talent struct {
	Name        string     `yaml:"name"`
	Description string     `yaml:"description"`
	Effect      string     `yaml:"effect"`
	Score       *DiceThrow `yaml:"score"`
	Test        string     `yaml:"test"`
	Rank        int        `yaml:"rank"`
}

Talent represent a single talent and what it does

type Wealth

type Wealth struct {
	Bank    WealthStorage `yaml:"bank"`
	Carried WealthStorage `yaml:"carried"`
}

Wealth is the money carried and in bank of the player

type WealthStorage

type WealthStorage struct {
	Platinum int `yaml:"platinum"`
	Gold     int `yaml:"gold"`
	Silver   int `yaml:"silver"`
	Bronze   int `yaml:"bronze"`
}

WealthStorage is a single place where wealth can be stored

type Weapon

type Weapon struct {
	Type        string    `yaml:"type"`
	Icon        string    `yaml:"icon"`
	Name        string    `yaml:"name"`
	Notes       []string  `yaml:"notes"`
	Modifiers   []string  `yaml:"modifiers"`
	Damage      DiceThrow `yaml:"damage"`
	Description string    `yaml:"description"`
}

Weapon describes a weapon (not ranged)

func (*Weapon) MatchIcon

func (w *Weapon) MatchIcon()

MatchIcon will assign a default icon if none is set

Jump to

Keyboard shortcuts

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