buffs

package
v0.9.2-migration.2 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2025 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TriggersLeftExpired   = 0 // When it hits this number it will be pruned ASAP
	TriggersLeftUnlimited = 1000000000
)

Variables

This section is empty.

Functions

func GetAllBuffIds

func GetAllBuffIds() []int

func GetDurations

func GetDurations(buff *Buff, spec *BuffSpec) (roundsLeft int, totalRounds int)

func LoadDataFiles

func LoadDataFiles()

file self loads due to init()

func SearchBuffs

func SearchBuffs(searchTerm string) []int

Searches for buffs whose name contains text and returns their Ids

Types

type Buff

type Buff struct {
	BuffId         int    // Which buff template does it refer to?
	Source         string `yaml:"source,omitempty"`         // Optional source identifier for where this buff originated. Example: spell, item, area
	OnStartWaiting bool   `yaml:"onstartwaiting,omitempty"` // Is the onstart event waiting to trigger?
	PermaBuff      bool   `yaml:"permabuff,omitempty"`      // Is this buff from a worn item or race?
	// Need to instance track the following:
	RoundCounter int `yaml:"roundcounter,omitempty"` // How many rounds have passed. Triggers on (RoundCounter%RoundInterval == 0)
	TriggersLeft int `yaml:"triggersleft,omitempty"` // How many times it triggers
}

func (*Buff) Expired

func (b *Buff) Expired() bool

func (*Buff) Name

func (bs *Buff) Name() string

func (*Buff) StatMod

func (b *Buff) StatMod(statName string) int

type BuffMessage

type BuffMessage struct {
	User string
	Room string
}

type BuffMessages

type BuffMessages struct {
	Start  BuffMessage
	Effect BuffMessage
	End    BuffMessage
}

type BuffSpec

type BuffSpec struct {
	BuffId        int               // Unique identifier for this buff spec
	Name          string            // The name of the buff
	Description   string            // A description of the buff
	Secret        bool              // Whether or not the buff is secret (not displayed to the user)
	TriggerNow    bool              `yaml:"triggernow,omitempty"`    // if true, buff triggers once right when it is applied
	TriggerRate   string            `yaml:"triggerrate,omitempty"`   // How often should it trigger? (time string)
	RoundInterval int               `yaml:"roundinterval,omitempty"` // triggers every x rounds
	TriggerCount  int               `yaml:"triggercount,omitempty"`  // How many times it triggers before it is removed
	StatMods      statmods.StatMods `yaml:"statmods,omitempty"`      // stat mods for the duration of the buff
	Flags         []Flag            `yaml:"flags,omitempty"`         // A list of actions and such that this buff prevents or enables
}

func GetBuffSpec

func GetBuffSpec(buffId int) *BuffSpec

func (*BuffSpec) Filename

func (b *BuffSpec) Filename() string

func (*BuffSpec) Filepath

func (b *BuffSpec) Filepath() string

func (*BuffSpec) GetScript

func (b *BuffSpec) GetScript() string

func (*BuffSpec) GetScriptPath

func (b *BuffSpec) GetScriptPath() string

func (*BuffSpec) GetValue

func (b *BuffSpec) GetValue() int

Calculates the value of this buff

func (*BuffSpec) Id

func (b *BuffSpec) Id() int

Presumably to ensure the datafile hasn't messed something up.

func (*BuffSpec) Validate

func (b *BuffSpec) Validate() error

Presumably to ensure the datafile hasn't messed something up.

func (*BuffSpec) VisibleNameDesc

func (b *BuffSpec) VisibleNameDesc() (name, description string)

type Buffs

type Buffs struct {
	List []*Buff
	// contains filtered or unexported fields
}

A list of applied buffs

func New

func New() Buffs

func (*Buffs) AddBuff

func (bs *Buffs) AddBuff(buffId int, isPermanent bool) bool

func (*Buffs) GetBuffIdsWithFlag

func (bs *Buffs) GetBuffIdsWithFlag(action Flag) []int

func (*Buffs) GetBuffs

func (bs *Buffs) GetBuffs(buffId ...int) []*Buff

func (*Buffs) HasBuff

func (bs *Buffs) HasBuff(buffId int) bool

func (*Buffs) HasFlag

func (bs *Buffs) HasFlag(action Flag, expire bool) bool

func (*Buffs) Prune

func (bs *Buffs) Prune() (prunedBuffs []*Buff)

func (*Buffs) RemoveBuff

func (bs *Buffs) RemoveBuff(buffId int) bool

func (*Buffs) Started

func (bs *Buffs) Started(buffId int)

func (*Buffs) StatMod

func (bs *Buffs) StatMod(statName string) int

func (*Buffs) Trigger

func (bs *Buffs) Trigger(buffId ...int) (triggeredBuffs []*Buff)

Returns what buffs were triggered

func (*Buffs) TriggersLeft

func (bs *Buffs) TriggersLeft(buffId int) int

func (*Buffs) Validate

func (bs *Buffs) Validate(forceRebuild ...bool)

type Flag

type Flag string
const (
	//
	// All Flags must be lowercase
	//
	All Flag = ``

	// Behavioral flags
	NoCombat       Flag = `no-combat`
	NoMovement     Flag = `no-go`
	NoFlee         Flag = `no-flee`
	CancelIfCombat Flag = `cancel-on-combat`
	CancelOnAction Flag = `cancel-on-action`
	CancelOnWater  Flag = `cancel-on-water`

	// Death preventing
	ReviveOnDeath Flag = `revive-on-death`

	// Gear related
	PermaGear   Flag = `perma-gear`
	RemoveCurse Flag = `remove-curse`

	// Harmful flags
	Poison Flag = `poison`
	Drunk  Flag = `drunk`

	// Useful flags
	Hidden       Flag = `hidden`
	Accuracy     Flag = `accuracy`
	Blink        Flag = `blink`
	EmitsLight   Flag = `lightsource`
	SuperHearing Flag = `superhearing`
	NightVision  Flag = `nightvision`
	Warmed       Flag = `warmed`
	Hydrated     Flag = `hydrated`
	Thirsty      Flag = `thirsty`

	// Flags that reveal things
	SeeHidden Flag = `see-hidden`
	SeeNouns  Flag = `see-nouns`
)

Jump to

Keyboard shortcuts

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