shield

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: MIT Imports: 3 Imported by: 3

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 Note that there's no need to distinguish between characters here since the shields are shared However we do care which is active since only active is shielded

func New

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

func (*Handler) Add

func (s *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) Count

func (s *Handler) Count() int

func (*Handler) Get

func (s *Handler) Get(t ShieldType) Shield

func (*Handler) OnDamage

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

func (*Handler) PlayerIsShielded

func (h *Handler) PlayerIsShielded() bool

func (*Handler) ShieldBonus

func (h *Handler) ShieldBonus() (amt float64)

TODO: this probably should be affected by hitlag as well

func (*Handler) ShieldBonusModIsActive

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

func (*Handler) ShieldStrength added in v1.2.2

func (s *Handler) ShieldStrength(ele attributes.Element) float64

func (*Handler) Tick

func (s *Handler) Tick()

type Shield

type Shield interface {
	Key() int
	Type() ShieldType
	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 ShieldType

type ShieldType int
const (
	ShieldCrystallize ShieldType = iota //lasts 15 seconds
	ShieldNoelleSkill
	ShieldNoelleA1
	ShieldZhongliJadeShield
	ShieldDionaSkill
	ShieldBeidouThunderShield
	ShieldXinyanSkill
	ShieldXinyanC2
	ShieldKaeyaC4
	ShieldYanfeiC4
	ShieldBell
	ShieldYunjinSkill
	ShieldThomaSkill
	EndShieldType
)

type Tmpl

type Tmpl struct {
	Name       string
	Src        int
	ShieldType ShieldType
	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) ShieldStrength added in v1.2.2

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

func (*Tmpl) Type

func (t *Tmpl) Type() ShieldType

Jump to

Keyboard shortcuts

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