Documentation ¶
Overview ¶
Package player contains player related tracking and functionalities: - tracking characters on the team - handling animations state - handling normal attack state - handling character stats and attributes - handling shielding
Index ¶
- Constants
- Variables
- type AirborneSource
- type Handler
- func (h *Handler) AbilStamCost(i int, a action.Action, p map[string]int) float64
- func (h *Handler) Active() int
- func (h *Handler) ActiveChar() *character.CharWrapper
- func (h *Handler) AddChar(char *character.CharWrapper) int
- func (h *Handler) AddStamPercentMod(key string, dur int, f StamPercentModFunc)
- func (h *Handler) Adjust(src string, char int, amt float64)
- func (h *Handler) Airborne() AirborneSource
- func (h *Handler) ApplyHitlag(char int, factor, dur float64)
- func (h *Handler) ByIndex(i int) *character.CharWrapper
- func (h *Handler) ByKey(k keys.Char) (*character.CharWrapper, bool)
- func (h *Handler) CharIsActive(k keys.Char) bool
- func (h *Handler) Chars() []*character.CharWrapper
- func (h *Handler) CombatByIndex(i int) combat.Character
- func (h *Handler) DistributeParticle(p character.Particle)
- func (h *Handler) Drain(di info.DrainInfo) float64
- func (h *Handler) Exec(t action.Action, k keys.Char, param map[string]int) error
- func (h *Handler) Heal(hi info.HealInfo)
- func (h *Handler) InitializeTeam() error
- func (h *Handler) ReadyCheck(t action.Action, k keys.Char, param map[string]int) error
- func (h *Handler) ResetAllNormalCounter()
- func (h *Handler) RestoreStam(v float64)
- func (h *Handler) SetActive(i int)
- func (h *Handler) SetAirborne(src AirborneSource) error
- func (h *Handler) StamPercentMod(a action.Action) float64
- func (h *Handler) StamPercentModIsActive(key string) bool
- func (h *Handler) Tick()
- type Opt
- type StamPercentModFunc
Constants ¶
const ( MaxStam = 240 StamCDFrames = 90 SwapCDFrames = 60 )
const (
XianyunAirborneBuff = "xianyun-airborne-buff"
)
Variables ¶
var ( // exec-specfic errors ErrActionNotReady = errors.New("action is not ready yet; cannot be executed") ErrPlayerNotReady = errors.New("player still in animation; cannot execute action") ErrInvalidAirborneAction = errors.New("player must use low_plunge or high_plunge while airborne") ErrActionNoOp = errors.New("action is a noop") // shared character-specific errors ErrInvalidChargeAction = errors.New("need to use attack right before charge") )
ErrActionNotReady is returned if the requested action is not ready; this could be due to any of the following:
- Insufficient energy (burst only)
- Ability on cooldown
- Player currently in animation
Functions ¶
This section is empty.
Types ¶
type AirborneSource ¶
type AirborneSource int
const ( Grounded AirborneSource = iota AirborneXiao AirborneVenti AirborneKazuha AirborneXianyun TerminateAirborne )
type Handler ¶
type Handler struct { Opt // handlers *animation.AnimationHandler Shields *shield.Handler infusion.Handler // stam Stam float64 LastStamUse int // swap SwapCD int // dash: dash fails iff lockout && on CD DashCDExpirationFrame int DashLockout bool // last action LastAction struct { UsedAt int Type action.Action Param map[string]int Char int } // contains filtered or unexported fields }
func (*Handler) AbilStamCost ¶
func (*Handler) ActiveChar ¶
func (h *Handler) ActiveChar() *character.CharWrapper
func (*Handler) AddStamPercentMod ¶
func (h *Handler) AddStamPercentMod(key string, dur int, f StamPercentModFunc)
TODO: not sure if this is affected by hitlag?
func (*Handler) Airborne ¶
func (h *Handler) Airborne() AirborneSource
func (*Handler) ApplyHitlag ¶
func (*Handler) Chars ¶
func (h *Handler) Chars() []*character.CharWrapper
func (*Handler) DistributeParticle ¶
func (*Handler) Exec ¶
Exec will forcefully execute an action t regardless if t is ready or not. The assumption is that whatever caller of Exec would have first checked ReadyCheck where ever relevant before calling Exec.
The separation allows for forcefully execution of certain actions such as swap bypassing swapCD if any
func (*Handler) InitializeTeam ¶
InitializeTeam will set up resonance event hooks and calculate all character base stats
func (*Handler) ReadyCheck ¶
ReadyCheck returns nil action is ready, else returns error representing why action is not ready
func (*Handler) ResetAllNormalCounter ¶
func (h *Handler) ResetAllNormalCounter()
func (*Handler) RestoreStam ¶
func (*Handler) SetAirborne ¶
func (h *Handler) SetAirborne(src AirborneSource) error
func (*Handler) StamPercentModIsActive ¶
Directories ¶
Path | Synopsis |
---|---|
package animation provides a simple way of tracking the current animation state at any given frame, as well as if the current frame is in animation lock or not
|
package animation provides a simple way of tracking the current animation state at any given frame, as well as if the current frame is in animation lock or not |
Package shield provide a handler to keep track of shields and add shields etc...
|
Package shield provide a handler to keep track of shields and add shields etc... |