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 (c *Handler) AbsorbCheck(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 (c *Handler) ClosestEnemiesWithinArea(a AttackPattern, filter func(t Enemy) bool) []Enemy
- func (c *Handler) ClosestEnemy(pos geometry.Point) Enemy
- func (c *Handler) ClosestEnemyWithinArea(a AttackPattern, filter func(t Enemy) bool) Enemy
- func (h *Handler) Enemies() []Target
- func (c *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) KillEnemy(i int)
- func (h *Handler) Player() Target
- func (h *Handler) PrimaryTarget() Target
- func (c *Handler) RandomEnemiesWithinArea(a AttackPattern, filter func(t Enemy) bool, maxCount int) []Enemy
- func (c *Handler) RandomEnemyWithinArea(a AttackPattern, filter func(t Enemy) bool) Enemy
- 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 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 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 ¶ added in v1.6.0
func NewBoxHit(src, center, offset positional, w, h float64) AttackPattern
func NewBoxHitOnTarget ¶ added in v1.6.0
func NewBoxHitOnTarget(trg, offset positional, w, h float64) AttackPattern
func NewCircleHit ¶
func NewCircleHit(src, center, offset positional, r float64) AttackPattern
func NewCircleHitFanAngle ¶ added in v1.6.0
func NewCircleHitFanAngle(src, center, offset positional, r, fanAngle float64) AttackPattern
func NewCircleHitOnTarget ¶ added in v1.6.0
func NewCircleHitOnTarget(trg, offset positional, r float64) AttackPattern
func NewCircleHitOnTargetFanAngle ¶ added in v1.6.0
func NewCircleHitOnTargetFanAngle(trg, offset positional, r, fanAngle float64) AttackPattern
func NewSingleTargetHit ¶ added in v1.6.0
func NewSingleTargetHit(ind targets.TargetKey) AttackPattern
type CharHandler ¶
type Character ¶
type Character interface {
ApplyAttackMods(a *AttackEvent, t Target) []interface{}
}
type Enemy ¶ added in v1.7.0
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 Handler ¶
func (*Handler) AbsorbCheck ¶
func (c *Handler) AbsorbCheck(p AttackPattern, prio ...attributes.Element) attributes.Element
func (*Handler) ApplyAttack ¶
func (h *Handler) ApplyAttack(a *AttackEvent) float64
func (*Handler) ClosestEnemiesWithinArea ¶ added in v1.7.0
func (c *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 ¶ added in v1.7.0
returns the closest enemy to the given position without any range restrictions; SHOULD NOT be used outside of pkg
func (*Handler) ClosestEnemyWithinArea ¶ added in v1.7.0
func (c *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) EnemiesWithinArea ¶ added in v1.7.0
func (c *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 ¶ added in v1.2.0
func (*Handler) GadgetCount ¶ added in v1.2.0
func (*Handler) PrimaryTarget ¶
func (*Handler) RandomEnemiesWithinArea ¶ added in v1.7.0
func (c *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 ¶ added in v1.7.0
func (c *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) RemoveGadget ¶ added in v1.2.0
func (*Handler) ReplaceGadget ¶ added in v1.2.0
func (*Handler) SetEnemyPos ¶ added in v1.2.0
func (*Handler) SetPlayerPos ¶ added in v1.2.0
type ResistMod ¶ added in v1.7.0
type ResistMod struct { Ele attributes.Element Value float64 modifier.Base }
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 ¶ added in v1.2.0
type TargetWithAura interface { Target AuraContains(e ...attributes.Element) bool }
Click to show internal directories.
Click to hide internal directories.