model

package
v0.0.0-...-e57939f Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MageJob          = "mage"
	ClericJob        = "cleric"
	WarriorJob       = "warrior"
	ThiefJob         = "thief"
	UninitializedJob = "uninitialized"
)
View Source
const (
	DeadDisposition          Disposition = "dead"
	IncapacitatedDisposition             = "incapacitated"
	StunnedDisposition                   = "stunned"
	SleepingDisposition                  = "sleeping"
	SittingDisposition                   = "sitting"
	FightingDisposition                  = "fighting"
	StandingDisposition                  = "standing"
)
View Source
const (
	ElfRace     = "elf"
	DwarfRace   = "dwarf"
	HumanRace   = "human"
	CritterRace = "critter"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute string
const (
	HpAttr     Attribute = "Hp"
	ManaAttr   Attribute = "mana"
	MvAttr     Attribute = "mv"
	StrAttr    Attribute = "str"
	IntAttr    Attribute = "int"
	WisAttr    Attribute = "wis"
	DexAttr    Attribute = "dex"
	ConAttr    Attribute = "con"
	HitAttr    Attribute = "hit"
	DamAttr    Attribute = "dam"
	BashAttr   Attribute = "acBash"
	SlashAttr  Attribute = "acSlash"
	PierceAttr Attribute = "acPierce"
	MagicAttr  Attribute = "acMagic"
)

type Attributes

type Attributes struct {
	gorm.Model
	Values map[Attribute]int
}

func NewStartingAttrs

func NewStartingAttrs() *Attributes

func NewStats

func NewStats(str int, _int int, wis int, dex int, con int) *Attributes

func (*Attributes) Value

func (a *Attributes) Value(attr Attribute) int

type Direction

type Direction string
const (
	NorthDirection Direction = "north"
	SouthDirection Direction = "south"
	EastDirection  Direction = "east"
	WestDirection  Direction = "west"
	UpDirection    Direction = "up"
	DownDirection  Direction = "down"
)

type Disposition

type Disposition string

type Exit

type Exit struct {
	gorm.Model
	Room      *Room
	Direction Direction
}

func NewExit

func NewExit(r *Room, d Direction) *Exit

type Gender

type Gender string
const (
	AnyGender    Gender = "any"
	NoGender     Gender = "none"
	AllGenders   Gender = "all"
	FemaleGender Gender = "female"
	MaleGender   Gender = "male"
)

type Item

type Item struct {
	gorm.Model

	Position    Position
	Value       int
	Level       int
	IsStoreItem bool
	// contains filtered or unexported fields
}

func NewEquipment

func NewEquipment(name string, description string, identifiers []string, position Position) *Item

func NewItem

func NewItem(name string, description string, identifiers []string) *Item

func (*Item) String

func (i *Item) String() string

type Job

type Job struct {
	gorm.Model
	Name       JobName
	Attributes *Attributes
}

func NewJob

func NewJob(name JobName, attr *Attributes) *Job

type JobName

type JobName string

type Mob

type Mob struct {
	gorm.Model
	Name string

	Identifiers []string

	Disposition Disposition

	Hp   int
	Mana int
	Mv   int
	Gold int

	Items    []*Item
	Equipped []*Item
	Gender   Gender
	// contains filtered or unexported fields
}

func NewMob

func NewMob(n string, d string) *Mob

func (*Mob) Attr

func (m *Mob) Attr(a Attribute) int

func (*Mob) CanContinueFighting

func (m *Mob) CanContinueFighting() bool

func (*Mob) FindEquipped

func (m *Mob) FindEquipped(b *io.Buffer) (*Item, error)

func (*Mob) FindItem

func (m *Mob) FindItem(b *io.Buffer) (*Item, error)

func (*Mob) GetGenderPronoun

func (m *Mob) GetGenderPronoun() string

func (*Mob) HasDisposition

func (m *Mob) HasDisposition(disposition Disposition) bool

func (*Mob) IsDead

func (m *Mob) IsDead() bool

func (*Mob) IsFighting

func (m *Mob) IsFighting() bool

func (*Mob) IsMerchant

func (m *Mob) IsMerchant() bool

func (*Mob) IsSleeping

func (m *Mob) IsSleeping() bool

func (*Mob) MakeMerchant

func (m *Mob) MakeMerchant()

func (*Mob) SetDeadDisposition

func (m *Mob) SetDeadDisposition()

func (*Mob) SetFightDisposition

func (m *Mob) SetFightDisposition()

func (*Mob) SetIncapacitatedDisposition

func (m *Mob) SetIncapacitatedDisposition()

func (*Mob) SetSittingDisposition

func (m *Mob) SetSittingDisposition()

func (*Mob) SetSleepingDisposition

func (m *Mob) SetSleepingDisposition()

func (*Mob) SetStandingDisposition

func (m *Mob) SetStandingDisposition()

func (*Mob) String

func (m *Mob) String() string

type MobReset

type MobReset struct {
	Mob       *Mob
	Room      *Room
	MaxInRoom int
	MaxInGame int
}

func NewMobReset

func NewMobReset(mob *Mob, room *Room, maxInRoom int, maxInGame int) *MobReset

type Position

type Position string
const (
	LightPosition     Position = "light"
	Finger1Position   Position = "finger"
	Finger2Position   Position = "finger"
	Neck1Position     Position = "neck"
	Neck2Position     Position = "neck"
	TorsoPosition     Position = "torso"
	HeadPosition      Position = "head"
	LegsPosition      Position = "legs"
	FeetPosition      Position = "feet"
	HandsPosition     Position = "hands"
	ArmsPosition      Position = "arms"
	ShieldPosition    Position = "shield"
	BodyPosition      Position = "body"
	WaistPosition     Position = "waist"
	Wrist1Position    Position = "wrist"
	Wrist2Position    Position = "wrist"
	WieldPosition     Position = "wield"
	HeldPosition      Position = "held"
	FloatingPosition  Position = "floating"
	SecondaryPosition Position = "secondary"
)

type Race

type Race struct {
	gorm.Model
	Name       RaceName
	Attributes *Attributes
}

func NewRace

func NewRace(name RaceName, attrs *Attributes) *Race

type RaceName

type RaceName string

type Role

type Role string
const (
	Scavenger Role = "scavenger"
	Mobile    Role = "mobile"
	Merchant  Role = "merchant"
)

type Room

type Room struct {
	gorm.Model
	Name        string
	Description string
	Exits       []*Exit
	Items       []*Item
}

func NewRoom

func NewRoom(n string, d string) *Room

func (*Room) FindItem

func (r *Room) FindItem(b *io.Buffer) (*Item, error)

func (*Room) GetExitFromDirection

func (r *Room) GetExitFromDirection(direction string) (*Exit, error)

func (*Room) String

func (r *Room) String() string

Jump to

Keyboard shortcuts

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