shield

package
v0.0.0-...-69059c8 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package shield provide a handler to keep track of shields and add shields etc...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler keeps track of all the active shields However we do care which is active since: - global shields: only active is shielded - 1 character shields: active only shieled if is target of shield

func New

func New(f *int, log glog.Logger, events event.Eventter) *Handler

func (*Handler) Add

func (h *Handler) Add(shd Shield)

TODO: do shields get affected by hitlag? if so.. which timer? active char?

func (*Handler) AddShieldBonusMod

func (h *Handler) AddShieldBonusMod(key string, dur int, f ShieldBonusModFunc)

func (*Handler) CharacterIsShielded

func (h *Handler) CharacterIsShielded(char, active int) bool

func (*Handler) Count

func (h *Handler) Count() int

func (*Handler) Get

func (h *Handler) Get(t Type) Shield

func (*Handler) List

func (h *Handler) List() []Shield

func (*Handler) OnDamage

func (h *Handler) OnDamage(char, active int, dmg float64, ele attributes.Element) float64

func (*Handler) ShieldBonus

func (h *Handler) ShieldBonus() float64

TODO: this probably should be affected by hitlag as well

func (*Handler) ShieldBonusModIsActive

func (h *Handler) ShieldBonusModIsActive(key string) bool

func (*Handler) Tick

func (h *Handler) Tick()

type Shield

type Shield interface {
	ShieldOwner() int
	ShieldTarget() int // -1 to apply to all characters, character index otherwise
	Key() int
	Type() Type
	ShieldStrength(ele attributes.Element, bonus float64) float64
	OnDamage(dmg float64, ele attributes.Element, bonus float64) (float64, bool) // return dmg taken and shield stays
	OnExpire()
	OnOverwrite()
	Expiry() int
	CurrentHP() float64
	Element() attributes.Element
	Desc() string
}

type ShieldBonusModFunc

type ShieldBonusModFunc func() (float64, bool)

type Tmpl

type Tmpl struct {
	ActorIndex int
	Target     int
	Name       string
	Src        int
	ShieldType Type
	Ele        attributes.Element
	HP         float64
	Expires    int
}

func (*Tmpl) CurrentHP

func (t *Tmpl) CurrentHP() float64

func (*Tmpl) Desc

func (t *Tmpl) Desc() string

func (*Tmpl) Element

func (t *Tmpl) Element() attributes.Element

func (*Tmpl) Expiry

func (t *Tmpl) Expiry() int

func (*Tmpl) Key

func (t *Tmpl) Key() int

func (*Tmpl) OnDamage

func (t *Tmpl) OnDamage(dmg float64, ele attributes.Element, bonus float64) (float64, bool)

func (*Tmpl) OnExpire

func (t *Tmpl) OnExpire()

func (*Tmpl) OnOverwrite

func (t *Tmpl) OnOverwrite()

func (*Tmpl) ShieldOwner

func (t *Tmpl) ShieldOwner() int

func (*Tmpl) ShieldStrength

func (t *Tmpl) ShieldStrength(ele attributes.Element, bonus float64) float64

func (*Tmpl) ShieldTarget

func (t *Tmpl) ShieldTarget() int

func (*Tmpl) Type

func (t *Tmpl) Type() Type

type Type

type Type int
const (
	Crystallize Type = iota // lasts 15 seconds
	NoelleSkill
	NoelleA1
	ZhongliJadeShield
	DionaSkill
	BeidouThunderShield
	BeidouC1
	XinyanSkill
	XinyanC2
	KaeyaC4
	YanfeiC4
	Bell
	YunjinSkill
	ThomaSkill
	CandaceSkill
	LaylaSkill
	BaizhuBurst
	KiraraSkill
	TravelerHydroC4
	SigewinneC2
	CitlaliSkill
	EndType
)

Jump to

Keyboard shortcuts

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