Documentation ¶
Overview ¶
Package combat handles all combat related functionalities including
- target tracking
- target selection
- hitbox collision checking
- attack queueing
Index ¶
- type AttackCB
- type AttackCBFunc
- type AttackEvent
- type AttackInfo
- type AttackPattern
- func NewBoxHit(src, center, offset positional, w, h float64) AttackPattern
- func NewBoxHitOnTarget(trg, offset positional, w, h float64) AttackPattern
- func NewCircleHit(src, center, offset positional, r float64) AttackPattern
- func NewCircleHitFanAngle(src, center, offset positional, r, fanAngle float64) AttackPattern
- func NewCircleHitOnTarget(trg, offset positional, r float64) AttackPattern
- func NewCircleHitOnTargetFanAngle(trg, offset positional, r, fanAngle float64) AttackPattern
- func NewSingleTargetHit(ind targets.TargetKey) AttackPattern
- type CharHandler
- type Character
- type DefMod
- type Enemy
- type Gadget
- type GadgetTyp
- type Handler
- func (h *Handler) AbsorbCheck(idx int, p AttackPattern, prio ...attributes.Element) attributes.Element
- func (h *Handler) AddEnemy(t Target)
- func (h *Handler) AddGadget(t Gadget)
- func (h *Handler) ApplyAttack(a *AttackEvent) float64
- func (h *Handler) ClosestEnemiesWithinArea(a AttackPattern, filter func(t Enemy) bool) []Enemy
- func (h *Handler) ClosestEnemy(pos geometry.Point) Enemy
- func (h *Handler) ClosestEnemyWithinArea(a AttackPattern, filter func(t Enemy) bool) Enemy
- func (h *Handler) ClosestGadget(pos geometry.Point) Gadget
- func (h *Handler) ClosestGadgetWithinArea(a AttackPattern, filter func(t Gadget) bool) Gadget
- func (h *Handler) ClosestGadgetsWithinArea(a AttackPattern, filter func(t Gadget) bool) []Gadget
- func (h *Handler) Enemies() []Target
- func (h *Handler) EnemiesWithinArea(a AttackPattern, filter func(t Enemy) bool) []Enemy
- func (h *Handler) Enemy(i int) Target
- func (h *Handler) EnemyCount() int
- func (h *Handler) Gadget(i int) Gadget
- func (h *Handler) GadgetCount() int
- func (h *Handler) Gadgets() []Gadget
- func (h *Handler) GadgetsWithinArea(a AttackPattern, filter func(t Gadget) bool) []Gadget
- func (h *Handler) KillEnemy(i int)
- func (h *Handler) Player() Target
- func (h *Handler) PrimaryTarget() Target
- func (h *Handler) RandomEnemiesWithinArea(a AttackPattern, filter func(t Enemy) bool, maxCount int) []Enemy
- func (h *Handler) RandomEnemyWithinArea(a AttackPattern, filter func(t Enemy) bool) Enemy
- func (h *Handler) RandomGadgetWithinArea(a AttackPattern, filter func(t Gadget) bool) Gadget
- func (h *Handler) RandomGadgetsWithinArea(a AttackPattern, filter func(t Gadget) bool, maxCount int) []Gadget
- func (h *Handler) RemoveGadget(key targets.TargetKey)
- func (h *Handler) ReplaceGadget(key targets.TargetKey, t Gadget)
- func (h *Handler) SetEnemyPos(i int, p geometry.Point) bool
- func (h *Handler) SetPlayer(t Target)
- func (h *Handler) SetPlayerPos(p geometry.Point)
- func (h *Handler) Tick()
- type Opt
- type ResistMod
- type Snapshot
- type Status
- type Target
- type TargetWithAura
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttackCB ¶
type AttackCB struct { Target Target AttackEvent *AttackEvent Damage float64 IsCrit bool }
type AttackCBFunc ¶
type AttackCBFunc func(AttackCB)
type AttackEvent ¶
type AttackEvent struct { Info AttackInfo Pattern AttackPattern // Timing AttackTiming Snapshot Snapshot SourceFrame int // source frame Callbacks []AttackCBFunc `json:"-"` Reacted bool // true if a reaction already took place - for purpose of attach/refill }
type AttackInfo ¶
type AttackInfo struct { ActorIndex int // character this attack belongs to DamageSrc targets.TargetKey // source of this attack; should be a unique key identifying the target Abil string // name of ability triggering the damage AttackTag attacks.AttackTag AdditionalTags []attacks.AdditionalTag PoiseDMG float64 // only needed on blunt attacks for frozen consumption before shatter for now ICDTag attacks.ICDTag ICDGroup attacks.ICDGroup Element attributes.Element // element of ability Durability reactions.Durability // durability of aura, 0 if nothing applied NoImpulse bool HitWeakPoint bool Mult float64 // ability multiplier. could set to 0 from initial Mona dmg StrikeType attacks.StrikeType UseDef bool // we use this instead of flatdmg to make sure stat snapshotting works properly FlatDmg float64 // flat dmg; IgnoreDefPercent float64 // by default this value is 0; if = 1 then the attack will ignore defense; raiden c2 should be set to 0.6 (i.e. ignore 60%) IgnoreInfusion bool // amp info Amped bool // new flag used by new reaction system AmpMult float64 // amplier AmpType reactions.ReactionType // melt or vape i guess // catalyze info Catalyzed bool CatalyzedType reactions.ReactionType // special flag for sim generated attack SourceIsSim bool DoNotLog bool // hitlag stuff Alignment attacks.AdditionalTag // this to to track Arkhe/Nightsoul trigger HitlagHaltFrames float64 // this is the number of frames to pause by HitlagFactor float64 // this is factor to slow clock by CanBeDefenseHalted bool // for whacking ruin gaurds IsDeployable bool // if this is true, then hitlag does not affect owner HitlagOnHeadshotOnly bool // if this is true, will only apply if HitWeakpoint is also true }
type AttackPattern ¶
type AttackPattern struct { Shape geometry.Shape SkipTargets [targets.TargettableTypeCount]bool IgnoredKeys []targets.TargetKey }
func NewBoxHit ¶
func NewBoxHit(src, center, offset positional, w, h float64) AttackPattern
func NewBoxHitOnTarget ¶
func NewBoxHitOnTarget(trg, offset positional, w, h float64) AttackPattern
func NewCircleHit ¶
func NewCircleHit(src, center, offset positional, r float64) AttackPattern
func NewCircleHitFanAngle ¶
func NewCircleHitFanAngle(src, center, offset positional, r, fanAngle float64) AttackPattern
func NewCircleHitOnTarget ¶
func NewCircleHitOnTarget(trg, offset positional, r float64) AttackPattern
func NewCircleHitOnTargetFanAngle ¶
func NewCircleHitOnTargetFanAngle(trg, offset positional, r, fanAngle float64) AttackPattern
func NewSingleTargetHit ¶
func NewSingleTargetHit(ind targets.TargetKey) AttackPattern
type CharHandler ¶
type Character ¶
type Character interface {
ApplyAttackMods(a *AttackEvent, t Target) []interface{}
}
type Enemy ¶
type Enemy interface { Target // hp related MaxHP() float64 HP() float64 // hitlag related ApplyHitlag(factor, dur float64) QueueEnemyTask(f func(), delay int) // modifier related // add AddStatus(key string, dur int, hitlag bool) AddResistMod(mod ResistMod) AddDefMod(mod DefMod) // delete DeleteStatus(key string) DeleteResistMod(key string) DeleteDefMod(key string) // active StatusIsActive(key string) bool ResistModIsActive(key string) bool DefModIsActive(key string) bool StatusExpiry(key string) int }
type GadgetTyp ¶
type GadgetTyp int
const ( GadgetTypUnknown GadgetTyp = iota StartGadgetTypEnemy GadgetTypDendroCore GadgetTypLeaLotus GadgetTypBogglecatBox EndGadgetTypEnemy GadgetTypGuoba GadgetTypYueguiThrowing GadgetTypYueguiJumping GadgetTypBaronBunny GadgetTypGrinMalkinHat GadgetTypSourcewaterDropletHydroTrav GadgetTypSourcewaterDropletNeuv GadgetTypSourcewaterDropletSigewinne GadgetTypCrystallizeShard GadgetTypReactableweapon GadgetTypTest EndGadgetTyp )
type Handler ¶
func (*Handler) AbsorbCheck ¶
func (h *Handler) AbsorbCheck(idx int, p AttackPattern, prio ...attributes.Element) attributes.Element
func (*Handler) ApplyAttack ¶
func (h *Handler) ApplyAttack(a *AttackEvent) float64
func (*Handler) ClosestEnemiesWithinArea ¶
func (h *Handler) ClosestEnemiesWithinArea(a AttackPattern, filter func(t Enemy) bool) []Enemy
returns enemies within the given area, sorted from closest to furthest, pass nil for no filter
func (*Handler) ClosestEnemy ¶
returns the closest enemy to the given position without any range restrictions; SHOULD NOT be used outside of pkg
func (*Handler) ClosestEnemyWithinArea ¶
func (h *Handler) ClosestEnemyWithinArea(a AttackPattern, filter func(t Enemy) bool) Enemy
returns the closest enemy within the given area, pass nil for no filter
func (*Handler) ClosestGadget ¶
returns the closest gadget to the given position without any range restrictions; SHOULD NOT be used outside of pkg
func (*Handler) ClosestGadgetWithinArea ¶
func (h *Handler) ClosestGadgetWithinArea(a AttackPattern, filter func(t Gadget) bool) Gadget
returns the closest gadget within the given area, pass nil for no filter
func (*Handler) ClosestGadgetsWithinArea ¶
func (h *Handler) ClosestGadgetsWithinArea(a AttackPattern, filter func(t Gadget) bool) []Gadget
returns enemies within the given area, sorted from closest to furthest, pass nil for no filter
func (*Handler) EnemiesWithinArea ¶
func (h *Handler) EnemiesWithinArea(a AttackPattern, filter func(t Enemy) bool) []Enemy
returns enemies within the given area, no sorting, pass nil for no filter
func (*Handler) EnemyCount ¶
func (*Handler) GadgetCount ¶
func (*Handler) GadgetsWithinArea ¶
func (h *Handler) GadgetsWithinArea(a AttackPattern, filter func(t Gadget) bool) []Gadget
returns gadgets within the given area, no sorting, pass nil for no filter
func (*Handler) PrimaryTarget ¶
func (*Handler) RandomEnemiesWithinArea ¶
func (h *Handler) RandomEnemiesWithinArea(a AttackPattern, filter func(t Enemy) bool, maxCount int) []Enemy
returns a list of random enemies within the given area, pass nil for no filter
func (*Handler) RandomEnemyWithinArea ¶
func (h *Handler) RandomEnemyWithinArea(a AttackPattern, filter func(t Enemy) bool) Enemy
returns a random enemy within the given area, pass nil for no filter
func (*Handler) RandomGadgetWithinArea ¶
func (h *Handler) RandomGadgetWithinArea(a AttackPattern, filter func(t Gadget) bool) Gadget
returns a random gadget within the given area, pass nil for no filter
func (*Handler) RandomGadgetsWithinArea ¶
func (h *Handler) RandomGadgetsWithinArea(a AttackPattern, filter func(t Gadget) bool, maxCount int) []Gadget
returns a list of random gadgets within the given area, pass nil for no filter
func (*Handler) RemoveGadget ¶
func (*Handler) SetPlayerPos ¶
type Snapshot ¶
type Snapshot struct { CharLvl int ActorEle attributes.Element ExtraIndex int // this is currently purely for Kaeya icicle ICD Cancelled bool // set to true if this snap should be ignored Stats [attributes.EndStatType]float64 // total character stats including from artifact, bonuses, etc... BaseAtk float64 // base attack used in calc BaseDef float64 BaseHP float64 SourceFrame int // frame snapshot was generated at Logs []interface{} // logs for the snapshot }
type Target ¶
type Target interface { Key() targets.TargetKey // unique key for the target SetKey(k targets.TargetKey) // update key Type() targets.TargettableType // type of target Shape() geometry.Shape // geometry.Shape of target Pos() geometry.Point // center of target SetPos(p geometry.Point) // move target IsAlive() bool SetTag(key string, val int) GetTag(key string) int RemoveTag(key string) HandleAttack(*AttackEvent) float64 AttackWillLand(a AttackPattern) (bool, string) // hurtbox collides with AttackPattern IsWithinArea(a AttackPattern) bool // center is in AttackPattern Tick() // called every tick Kill() // for collision check CollidableWith(targets.TargettableType) bool CollidedWith(t Target) WillCollide(geometry.Shape) bool // direction related Direction() geometry.Point // returns viewing direction as a geometry.Point SetDirection(trg geometry.Point) // calculates viewing direction relative to default direction (0, 1) SetDirectionToClosestEnemy() // looks for closest enemy CalcTempDirection(trg geometry.Point) geometry.Point // used for stuff like Bow CA }
type TargetWithAura ¶
type TargetWithAura interface { Target AuraContains(e ...attributes.Element) bool }