colonist

package
v0.0.0-...-37a0012 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bag

type Bag struct {
	Size  uint
	Items []interface{}
}

func (*Bag) Add

func (b *Bag) Add(elem interface{}, count uint) error

func (*Bag) GetAvailableSpace

func (b *Bag) GetAvailableSpace() uint

func (*Bag) GetItemCount

func (b *Bag) GetItemCount() uint

func (*Bag) Has

func (b *Bag) Has(elem interface{}, count uint) bool

func (*Bag) IsEmpty

func (b *Bag) IsEmpty() bool

func (*Bag) IsFull

func (b *Bag) IsFull() bool

func (*Bag) MarshalJSON

func (b *Bag) MarshalJSON() ([]byte, error)

MarshalJSON will marshal needs into it's attributes

func (*Bag) Remove

func (b *Bag) Remove(elem interface{}, count uint) error

func (*Bag) UnmarshalJSON

func (b *Bag) UnmarshalJSON(bytes []byte) error

UnmarshalJSON fills in the attributes of needs

type Colonist

type Colonist struct {
	Key    string `json:"key"`
	Name   string `json:"name"`
	Status string `json:"status"`
	Age    uint   `json:"age"`

	Bag       *storage.Storage `json:"bag"`
	Equipment *Equipment       `json:"equipment"`

	Desires Desires `json:"desires"`
	Needs   Needs   `json:"needs"`

	Skills Skills `json:"skills"`
}

Colonist struct

func NewColonist

func NewColonist() *Colonist

GenerateColonist returns a new colonist with the given name and a random set of skills and stats.

func (*Colonist) EquipArmor

func (c *Colonist) EquipArmor(e Equippable) (Equippable, error)

EquipArmor equips the armor if the requirements are met. Returns the currently equipped armor or nil if no armor is equipped.

func (*Colonist) EquipHelmet

func (c *Colonist) EquipHelmet(e Equippable) (Equippable, error)

EquipHelmet equips the helmet if the requirements are met. Returns the currently equipped helmet or nil if no helmet is equipped.

func (*Colonist) EquipWeapon

func (c *Colonist) EquipWeapon(e Equippable) (Equippable, error)

EquipWeapon equips the weapon if the requirements are met. Returns the currently equipped weapon or nil if no weapon is equipped.

func (*Colonist) SetStatus

func (c *Colonist) SetStatus(s string)

type Counter

type Counter interface {
	GetCount() uint
}

type DesireType

type DesireType string
const (
	Fulfillment DesireType = "Fulfillment"
	Belonging   DesireType = "Belonging"
	Esteem      DesireType = "Esteem"
)

type Desires

type Desires map[DesireType]float64

func (Desires) Decrease

func (d Desires) Decrease(t DesireType, amount float64)

func (Desires) Increase

func (d Desires) Increase(t DesireType, amount float64)

type Equipment

type Equipment struct {
	Head   Equippable `json:"head"`
	Weapon Equippable `json:"weapon"`
	Body   Equippable `json:"body"`
}

Equipment for the Colonist

type Equippable

type Equippable interface {
}

Equippable items can be assigned to the head, weapon or body slot of a colonist's equipment.

type NeedType

type NeedType string
const (
	Hunger     NeedType = "Hunger"
	Thirst     NeedType = "Thirst"
	Stress     NeedType = "Stress"
	Exhaustion NeedType = "Exhaustion"
	Fear       NeedType = "Fear"
	Pain       NeedType = "Pain"
)

type Needs

type Needs map[NeedType]float64

func (Needs) Decrease

func (n Needs) Decrease(t NeedType, amount float64)

func (Needs) Increase

func (n Needs) Increase(t NeedType, amount float64)

type SkillType

type SkillType string
const (
	Hunting     SkillType = "Hunting"
	Crafting    SkillType = "Crafting"
	Cooking     SkillType = "Cooking"
	Building    SkillType = "Building"
	Gathering   SkillType = "Gathering"
	Mining      SkillType = "Mining"
	Woodcutting SkillType = "Woodcutting"
	Science     SkillType = "Science"
	Combat      SkillType = "Combat"
	Charisma    SkillType = "Charisma"
	Medicine    SkillType = "Medicine"
	Tinkering   SkillType = "Tinkering"
)

type Skills

type Skills map[SkillType]float64

func (Skills) Decrease

func (n Skills) Decrease(t SkillType, amount float64)

func (Skills) Increase

func (n Skills) Increase(t SkillType, amount float64)

type Stackable

type Stackable interface {
	IsStackable() bool
}

Jump to

Keyboard shortcuts

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