action

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: MIT Imports: 3 Imported by: 1

Documentation

Overview

Package action describes the valid actions that any character may take

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action int
const (
	InvalidAction Action = iota
	ActionSkill
	ActionBurst
	ActionAttack
	ActionCharge
	ActionHighPlunge
	ActionLowPlunge
	ActionAim
	ActionDash
	ActionJump
	//following action have to implementations
	ActionSwap
	ActionWalk
	ActionWait // character should stand around and wait
	EndActionType
	//these are only used for frames purposes and that's why it's after end
	ActionSkillHoldFramesOnly
)

func StringToAction

func StringToAction(s string) Action

func (Action) MarshalJSON added in v1.2.2

func (a Action) MarshalJSON() ([]byte, error)

func (Action) String

func (a Action) String() string

func (*Action) UnmarshalJSON added in v1.2.2

func (a *Action) UnmarshalJSON(b []byte) error

type ActionFailure added in v1.2.2

type ActionFailure int
const (
	NoFailure ActionFailure = iota
	SwapCD
	SkillCD
	BurstCD
	InsufficientEnergy
	InsufficientStamina
	CharacterDeceased // TODO: need chars to die first
	DashCD
)

func (ActionFailure) MarshalJSON added in v1.2.2

func (e ActionFailure) MarshalJSON() ([]byte, error)

func (ActionFailure) String added in v1.2.2

func (e ActionFailure) String() string

func (*ActionFailure) UnmarshalJSON added in v1.2.2

func (e *ActionFailure) UnmarshalJSON(b []byte) error

type ActionInfo

type ActionInfo struct {
	Frames              func(next Action) int `json:"-"`
	AnimationLength     int
	CanQueueAfter       int
	State               AnimationState
	FramePausedOnHitlag func() bool               `json:"-"`
	OnRemoved           func(next AnimationState) `json:"-"`
	//following are exposed only so we can log it properly
	CachedFrames         [EndActionType]int //TODO: consider removing the cache frames and instead cache the frames function instead
	TimePassed           float64
	NormalizedTimePassed float64
	UseNormalizedTime    func(next Action) bool
	// contains filtered or unexported fields
}

TODO: add a sync.Pool here to save some memory allocs

func (*ActionInfo) AnimationState

func (a *ActionInfo) AnimationState() AnimationState

func (*ActionInfo) CacheFrames

func (a *ActionInfo) CacheFrames()

func (*ActionInfo) CanQueueNext

func (a *ActionInfo) CanQueueNext() bool

func (*ActionInfo) CanUse

func (a *ActionInfo) CanUse(next Action) bool

func (*ActionInfo) QueueAction

func (a *ActionInfo) QueueAction(f func(), delay int)

func (*ActionInfo) Tick

func (a *ActionInfo) Tick() bool

type AnimationState

type AnimationState int
const (
	Idle AnimationState = iota
	NormalAttackState
	ChargeAttackState
	PlungeAttackState
	SkillState
	BurstState
	AimState
	DashState
	JumpState
	WalkState
	SwapState
)

func (AnimationState) String

func (a AnimationState) String() string

Jump to

Keyboard shortcuts

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