rotation

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages the initiative tracker state

func NewManager

func NewManager() *Manager

NewManager creates a new initiative manager

func (*Manager) Add

func (m *Manager) Add(name string, initiative int)

Add adds a participant to the current initiative

func (*Manager) End

func (m *Manager) End()

End ends the current initiative session

func (*Manager) GetTracker

func (m *Manager) GetTracker() *Tracker

GetTracker returns the current tracker (may be nil)

func (*Manager) IsActive

func (m *Manager) IsActive() bool

IsActive returns true if initiative is currently active

func (*Manager) MarkIn

func (m *Manager) MarkIn(name string) error

MarkIn marks a participant as active again

func (*Manager) MarkOut

func (m *Manager) MarkOut(name string) error

MarkOut marks a participant as out

func (*Manager) Next

func (m *Manager) Next()

Next advances to the next turn

func (*Manager) Start

func (m *Manager) Start()

Start starts a new initiative session

type Participant

type Participant struct {
	Name       string
	Initiative int
	IsActive   bool // false if dead/out of combat
}

Participant represents a participant in initiative

type Tracker

type Tracker struct {
	Participants []*Participant
	CurrentTurn  int // index into Participants
	Round        int
}

Tracker manages initiative order and turn tracking

func NewTracker

func NewTracker() *Tracker

NewTracker creates a new initiative tracker

func (*Tracker) ActiveCount

func (t *Tracker) ActiveCount() int

ActiveCount returns the number of active participants

func (*Tracker) Add

func (t *Tracker) Add(name string, initiative int)

Add adds a participant to the initiative

func (*Tracker) GetCurrent

func (t *Tracker) GetCurrent() *Participant

GetCurrent returns the current participant

func (*Tracker) HasParticipants

func (t *Tracker) HasParticipants() bool

HasParticipants returns true if there are any participants

func (*Tracker) MarkIn

func (t *Tracker) MarkIn(name string) error

MarkIn marks a participant as active again

func (*Tracker) MarkOut

func (t *Tracker) MarkOut(name string) error

MarkOut marks a participant as out (dead/incapacitated)

func (*Tracker) Next

func (t *Tracker) Next()

Next advances to the next active participant's turn

Jump to

Keyboard shortcuts

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