Documentation ¶
Overview ¶
Package combat handles all combat related functionalities including
- target tracking
- target selection
- hitbox collision checking
- attack queueing
Index ¶
- Variables
- func WillCollide(p AttackPattern, t Target, key TargetKey) bool
- type AttackCB
- type AttackCBFunc
- type AttackEvent
- type AttackInfo
- type AttackPattern
- type AttackTag
- type CharHandler
- type Character
- type Circle
- type Durability
- 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 (h *Handler) Enemies() []Target
- func (c *Handler) EnemiesWithinRadius(x, y, r float64) []int
- func (h *Handler) Enemy(i int) Target
- func (c *Handler) EnemyByDistance(x, y float64, excl TargetKey) []int
- func (h *Handler) EnemyCount() int
- func (c *Handler) EnemyExcl(self int) []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) RandomEnemyTarget() int
- func (h *Handler) RemoveGadget(key TargetKey)
- func (h *Handler) ReplaceGadget(key TargetKey, t Gadget)
- func (h *Handler) SetEnemyPos(i int, x, y float64) bool
- func (h *Handler) SetPlayer(t Target)
- func (h *Handler) SetPlayerPos(x, y float64)
- func (h *Handler) Tick()
- type ICDGroup
- type ICDTag
- type Opt
- type Positional
- type ReactionType
- type Rectangle
- type SelfDamage
- type Shape
- type SingleTarget
- type Snapshot
- type StrikeType
- type Target
- type TargetKey
- type TargetWithAura
- type TargettableType
Constants ¶
This section is empty.
Variables ¶
View Source
var ICDGroupDamageSequence = [][]float64{
{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1},
{1.0, 0.0, 0.0, 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1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0},
{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
{1.0, 0.0, 0.0, 0.0},
{1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0},
{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
{1.0, 1.0},
{1.0, 1.0},
{1.0, 0, 0, 0, 0, 0, 0, 0},
}
View Source
var ICDGroupResetTimer = []int{
150,
60,
60,
300,
300,
30,
6,
18,
120,
180,
150,
30,
30,
120,
}
Functions ¶
func WillCollide ¶
func WillCollide(p AttackPattern, t Target, key TargetKey) bool
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 Cancelled bool //provide a way to cancel an attack event Snapshot Snapshot SourceFrame int //source frame Callbacks []AttackCBFunc `json:"-"` Reacted bool // true if a reaction already took place - for purpose of attach/refill OnICD bool // set this to true if on ICD so we don't accidentally increment counter twice; icd check only happens once }
type AttackInfo ¶
type AttackInfo struct { ActorIndex int //character this attack belongs to DamageSrc TargetKey //source of this attack; should be a unique key identifying the target Abil string //name of ability triggering the damage AttackTag AttackTag ICDTag ICDTag ICDGroup ICDGroup Element attributes.Element //element of ability Durability 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 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 ReactionType //melt or vape i guess // catalyze info Catalyzed bool CatalyzedType 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 Shape Targets [TargettableTypeCount]bool SelfHarm bool }
func NewCircleHit ¶
func NewCircleHit(trg Positional, r float64, self bool, targets ...TargettableType) AttackPattern
func NewDefSingleTarget ¶
func NewDefSingleTarget(ind TargetKey, typ TargettableType) AttackPattern
type AttackTag ¶
type AttackTag int //attacktag is used instead of actions etc..
const ( AttackTagNone AttackTag = iota AttackTagNormal AttackTagExtra AttackTagPlunge AttackTagElementalArt AttackTagElementalArtHold AttackTagElementalBurst AttackTagWeaponSkill AttackTagMonaBubbleBreak AttackTagNoneStat ReactionAttackDelim AttackTagOverloadDamage AttackTagSuperconductDamage AttackTagECDamage AttackTagShatter AttackTagSwirlPyro AttackTagSwirlHydro AttackTagSwirlCryo AttackTagSwirlElectro AttackTagBurningDamage AttackTagBloom AttackTagBurgeon AttackTagHyperbloom AttackTagLength )
type CharHandler ¶
type Character ¶
type Character interface {
ApplyAttackMods(a *AttackEvent, t Target) []interface{}
}
type Circle ¶
type Circle struct {
// contains filtered or unexported fields
}
func (*Circle) IntersectCircle ¶
type Durability ¶
type Durability float64
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) EnemiesWithinRadius ¶
EnemiesWithinRadius returns an array of indices of the enemies within radius r
func (*Handler) EnemyByDistance ¶
EnemyByDistance returns an array of indices of the enemies sorted by distance
func (*Handler) EnemyCount ¶ added in v1.2.0
func (*Handler) GadgetCount ¶ added in v1.2.0
func (*Handler) PrimaryTarget ¶
func (*Handler) RandomEnemyTarget ¶
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 ICDGroup ¶
type ICDGroup int //same ICD group shares the same timer
group dictate both the sequence and the reset timer
type ICDTag ¶
type ICDTag int //same ICD tag shares the same counter
const ( ICDTagNone ICDTag = iota ICDTagNormalAttack ICDTagExtraAttack ICDTagElementalArt ICDTagElementalArtAnemo ICDTagElementalArtPyro ICDTagElementalArtHydro ICDTagElementalArtCryo ICDTagElementalArtElectro ICDTagElementalBurst ICDTagElementalBurstAnemo ICDTagElementalBurstPyro ICDTagElementalBurstHydro ICDTagElementalBurstCryo ICDTagElementalBurstElectro ICDTagDash ICDTagLisaElectro ICDTagYanfeiFire ICDTagYelanBreakthrough ICDTagYelanBurst ICDTagMonaWaterDamage ICDTagTravelerWakeOfEarth ICDTagKleeFireDamage ICDTagTartagliaRiptideFlash ICDTagColleiSprout ICDReactionDamageDelim ICDTagOverloadDamage ICDTagSuperconductDamage ICDTagECDamage ICDTagShatter ICDTagSwirlPyro ICDTagSwirlHydro ICDTagSwirlCryo ICDTagSwirlElectro ICDTagBurningDamage ICDTagBloomDamage ICDTagBurgeonDamage ICDTagHyperbloomDamage ICDTagLength )
type Positional ¶
type Positional interface {
Pos() (x, y float64)
}
type ReactionType ¶
type ReactionType string
const ( Overload ReactionType = "overload" Superconduct ReactionType = "superconduct" Freeze ReactionType = "freeze" Melt ReactionType = "melt" Vaporize ReactionType = "vaporize" CrystallizeElectro ReactionType = "crystallize-electro" CrystallizeHydro ReactionType = "crystallize-hydro" CrystallizePyro ReactionType = "crystallize-pyro" CrystallizeCryo ReactionType = "crystallize-cryo" SwirlElectro ReactionType = "swirl-electro" SwirlHydro ReactionType = "swirl-hydro" SwirlPyro ReactionType = "swirl-pyro" SwirlCryo ReactionType = "swirl-cryo" ElectroCharged ReactionType = "electrocharged" Shatter ReactionType = "shatter" Burning ReactionType = "burning" Quicken ReactionType = "quicken" Aggravate ReactionType = "aggravate" Spread ReactionType = "spread" Bloom ReactionType = "bloom" Burgeon ReactionType = "burgeon" Hyperbloom ReactionType = "hyperbloom" NoReaction ReactionType = "" FreezeExtend ReactionType = "freeze-extend" )
type Rectangle ¶
type Rectangle struct {
// contains filtered or unexported fields
}
func (*Rectangle) IntersectCircle ¶
func (*Rectangle) IntersectRectangle ¶
type SelfDamage ¶
type SelfDamage struct{}
this is for attack that only hits self
func (*SelfDamage) IntersectCircle ¶
func (c *SelfDamage) IntersectCircle(in Circle) bool
func (*SelfDamage) IntersectRectangle ¶
func (c *SelfDamage) IntersectRectangle(in Rectangle) bool
type SingleTarget ¶
type SingleTarget struct {
Target TargetKey
}
func (*SingleTarget) IntersectCircle ¶
func (s *SingleTarget) IntersectCircle(in Circle) bool
func (*SingleTarget) IntersectRectangle ¶
func (s *SingleTarget) IntersectRectangle(in Rectangle) bool
func (*SingleTarget) Pos ¶
func (s *SingleTarget) Pos() (float64, float64)
func (*SingleTarget) String ¶
func (s *SingleTarget) String() string
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 StrikeType ¶
type StrikeType int
const ( StrikeTypeDefault StrikeType = iota StrikeTypePierce StrikeTypeBlunt StrikeTypeSlash StrikeTypeSpear )
type Target ¶
type Target interface { Index() int //should correspond to index SetIndex(index int) //update the current index Key() TargetKey //unique key for the target SetKey(k TargetKey) //update key Type() TargettableType //type of target Shape() Shape // shape of target Pos() (float64, float64) // center of target SetPos(x, y float64) // move target IsAlive() bool AttackWillLand(a AttackPattern, src TargetKey) (bool, string) Attack(*AttackEvent, glog.Event) (float64, bool) ApplyDamage(*AttackEvent, float64) Tick() //called every tick Kill() //for collision check CollidableWith(TargettableType) bool CollidedWith(t Target) WillCollide(Shape) bool }
type TargetWithAura ¶ added in v1.2.0
type TargetWithAura interface { Target AuraContains(e ...attributes.Element) bool }
type TargettableType ¶
type TargettableType int
const ( TargettableEnemy TargettableType = iota TargettablePlayer TargettableGadget TargettableTypeCount )
Click to show internal directories.
Click to hide internal directories.