item

package
v0.0.0-...-47a16e8 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Class

type Class int

Class is a low-specificity delineation of item. Within each Class is a collection of more specific types of that class captured as a Code. BowClass might contain a long bow and a short bow. The SwordClass might contain a fast sword and a slow sword.

const (
	UnarmedClass Class = iota // FIXME?
	SwordClass
	AxeClass
	ClubClass
	DaggerClass
	SlingClass
	BowClass
	SpearClass
	PolearmClass
	StaffClass
	WandClass

	HatClass
	BodyArmorClass
	AmuletClass
	RingClass
	GloveClass
	BootClass
	BeltClass
)

func (Class) IsWeapon

func (c Class) IsWeapon() bool

func (Class) String

func (i Class) String() string

type Equipment

type Equipment struct {
	Weapon *Instance

	Helm   *Instance
	Amulet *Instance
	Armor  *Instance
	Ring1  *Instance
	Ring2  *Instance
	Belt   *Instance
	Gloves *Instance
	Boots  *Instance
}

Equipment is a Component that stores the equipped items of a Character.

func (*Equipment) SumModifiers

func (equip *Equipment) SumModifiers() map[Modifier]float64

SumModifiers returns the sum of all modifiers present on all items in this Equipment.

func (*Equipment) Type

func (*Equipment) Type() string

Type of this Component.

func (*Equipment) WeaponActionPoints

func (equip *Equipment) WeaponActionPoints() int

func (*Equipment) WeaponBaseChanceToHit

func (equip *Equipment) WeaponBaseChanceToHit() float64

func (*Equipment) WeaponClass

func (equip *Equipment) WeaponClass() Class

WeaponClass returns the inferred ItemClass of the Weapon that is equipped (if one is equipped), otherwise it returns Unarmed.

func (*Equipment) WeaponPreparation

func (equip *Equipment) WeaponPreparation() int

type Instance

type Instance struct {
	Class Class

	// Code represents a more specific implementation of the ItemClass. If an item's
	// name in English is Short Sword, the Code might be "short_sword". Codes
	// should be configured in separate game data, and loaded into the game at
	// runtime.
	Code string

	// Name is rendered at recipe execution time and might be something like "Deadly
	// Axe of Iciness"
	Name            string
	BaseChanceToHit float64
	Modifiers       map[Modifier]float64 // base damage, or base armor, or any other modifier

	Skills []skill.ID
}

Instance is a rolled item that can be equipped.

type Modifier

type Modifier int

Modifier enumerates the stat modifiers that appear on items and effects in the game.

const (
	// BaseMinDamageModifier should typically appear only on weapons. It is a
	// value, not a multiplier
	BaseMinDamageModifier Modifier = iota
	// BaseMaxDamageModifier should typically appear only on weapons. It is a
	// value, not a multiplier
	BaseMaxDamageModifier

	// BaseDamageModifier multiplies the base damage before it is multiplied by
	// DamageMultiplierModifier. Should typically only appear on Weapons. Maybe
	// should never go past 99%?
	BaseDamageModifier

	// DamageMultiplierModifier is accumulated from modifiers present on
	// non-weapon items and also core stats.
	DamageMultiplierModifier

	// PreparationModifier is added to the Character's PreparationThreshold.
	PreparationModifier
	//ActionPointModifier is added to the Character's ActionPoint maximum.
	ActionPointModifier

	// ChanceToHitModifier multiplies the base chance to hit of Attacks.
	// A value of zero does not modify the chance to hit. A value of 0.1
	// improves the chance to hit by 10%. A value of -0.5 halves the chance to
	// hit.
	ChanceToHitModifier
)

func (Modifier) String

func (i Modifier) String() string

Jump to

Keyboard shortcuts

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