Documentation ¶
Index ¶
- Constants
- Variables
- func PrettyPrintStats(stats []float64) string
- func PrettyPrintStatsSlice(stats []float64) []string
- func RegisterCharFunc(char CharKey, f NewCharacterFunc)
- func RegisterSetFunc(name string, f NewSetFunc)
- func RegisterWeaponFunc(name string, f NewWeaponFunc)
- type ActionBlock
- type ActionBlockType
- type ActionItem
- type ActionType
- type AnimationState
- type AttackCB
- type AttackCBFunc
- type AttackEvent
- type AttackInfo
- type AttackPattern
- func NewCircleHit(x, y, r float64, self bool, targets ...TargettableType) AttackPattern
- func NewDefBoxHit(w, h float64, self bool, targets ...TargettableType) AttackPattern
- func NewDefCircHit(r float64, self bool, targets ...TargettableType) AttackPattern
- func NewDefSingleTarget(ind int, typ TargettableType) AttackPattern
- type AttackTag
- type CDAdjust
- type CharKey
- type CharStatMod
- type Character
- type CharacterBase
- type CharacterProfile
- type Circle
- type CmdCalcWait
- type CmdNoSwap
- type CmdResetLimit
- type CmdWait
- type CmdWaitType
- type CombatHandler
- type Command
- type CommandHandler
- type CommandType
- type Condition
- type Construct
- type ConstructHandler
- type Core
- func (c *Core) AbsorbCheck(p AttackPattern, prio ...EleType) EleType
- func (c *Core) AddChar(v CharacterProfile) (Character, error)
- func (c *Core) AddStamMod(f func(a ActionType) (float64, bool), key string)
- func (c *Core) AddTarget(t Target)
- func (c *Core) AnimationCancelDelay(next ActionType, p map[string]int) int
- func (c *Core) CharByName(key CharKey) (Character, bool)
- func (c *Core) ClearState()
- func (c *Core) EnemyByDistance(x, y float64, excl int) []int
- func (c *Core) EnemyExcl(self int) []int
- func (c *Core) GetCustomFlag(key string) (int, bool)
- func (c *Core) Init()
- func (c *Core) RandomEnemyTarget() int
- func (c *Core) RandomTargetIndex(typ TargettableType) int
- func (c *Core) RemoveTarget(i int)
- func (c *Core) ResetAllNormalCounter()
- func (c *Core) RestoreStam(v float64)
- func (c *Core) SetCustomFlag(key string, val int)
- func (c *Core) SetState(state AnimationState, duration int)
- func (c *Core) Skip(n int)
- func (c *Core) StamPercentMod(a ActionType) float64
- func (c *Core) State() AnimationState
- func (c *Core) Swap(next CharKey) int
- func (c *Core) Tick()
- func (c *Core) UserCustomDelay() int
- type DefMod
- type Delays
- type DrainInfo
- type Durability
- type EleType
- type EnemyProfile
- type EnergyEvent
- type EnergyHandler
- type EventHandler
- type EventHook
- type EventType
- type ExprTreeNode
- type Flags
- type GeoConstructType
- type HealInfo
- type HealType
- type HealthHandler
- type HurtEvent
- type ICDGroup
- type ICDTag
- type LogCtrl
- type LogEvent
- type LogSource
- type NewCharacterFunc
- type NewSetFunc
- type NewWeaponFunc
- type NilLogEvent
- type NilLogger
- type Particle
- type PreDamageMod
- type QueueHandler
- type ReactionBonusMod
- type ReactionType
- type Rectangle
- type ResistMod
- type SelfDamage
- type Shape
- type Shield
- type ShieldHandler
- type ShieldType
- type SimulationConfig
- type SimulationQueueMode
- type SimulatorSettings
- type SingleTarget
- type Snapshot
- type StatType
- type StatusHandler
- type StrikeType
- type TalentProfile
- type Target
- type TargettableType
- type TaskHandler
- type WeaponClass
- type WeaponInfusion
- type WeaponProfile
- type ZoneType
Constants ¶
View Source
const ( MaxStam = 240 StamCDFrames = 90 JumpFrames = 33 DashFrames = 24 WalkFrames = 1 SwapCDFrames = 60 MaxTeamPlayerCount = 4 DefaultTargetIndex = 1 )
Variables ¶
View Source
var CharKeyToEle = map[CharKey]EleType{ TravelerElectro: Electro, TravelerAnemo: Anemo, TravelerGeo: Geo, TravelerHydro: Hydro, TravelerCryo: Cryo, TravelerPyro: Pyro, TravelerDendro: Dendro, Albedo: Geo, Aloy: Cryo, Amber: Pyro, Barbara: Hydro, Beidou: Electro, Bennett: Pyro, Chongyun: Cryo, Diluc: Pyro, Diona: Cryo, Eula: Cryo, Fischl: Electro, Ganyu: Cryo, Hutao: Pyro, Jean: Anemo, Kazuha: Anemo, Kaeya: Cryo, Ayaka: Cryo, Ayato: Hydro, Keqing: Electro, Klee: Pyro, Sara: Electro, Lisa: Electro, Mona: Hydro, Ningguang: Geo, Noelle: Geo, Qiqi: Cryo, Raiden: Electro, Razor: Electro, Rosaria: Cryo, Kokomi: Hydro, Sayu: Anemo, Sucrose: Anemo, Tartaglia: Hydro, Thoma: Pyro, Venti: Anemo, Xiangling: Pyro, Xiao: Anemo, Xingqiu: Hydro, Xinyan: Pyro, Yanfei: Pyro, Yoimiya: Pyro, Zhongli: Geo, Gorou: Geo, Itto: Geo, Shenhe: Cryo, Yunjin: Geo, YaeMiko: Electro, }
View Source
var CharNameToKey = map[string]CharKey{ "travelerelectro": TravelerElectro, "traveleranemo": TravelerAnemo, "travelergeo": TravelerGeo, "travelerhydro": TravelerHydro, "travelercryo": TravelerCryo, "travelerpyro": TravelerPyro, "travelerdendro": TravelerDendro, "traveler (electro)": TravelerElectro, "traveler (anemo)": TravelerAnemo, "traveler (geo)": TravelerGeo, "traveler (hydro)": TravelerHydro, "traveler (cryo)": TravelerCryo, "traveler (pyro)": TravelerPyro, "traveler (dendro)": TravelerDendro, "albedo": Albedo, "aloy": Aloy, "amber": Amber, "barbara": Barbara, "beidou": Beidou, "bennett": Bennett, "chongyun": Chongyun, "diluc": Diluc, "diona": Diona, "eula": Eula, "fischl": Fischl, "ganyu": Ganyu, "hutao": Hutao, "jean": Jean, "kaedeharakazuha": Kazuha, "kazuha": Kazuha, "kaeya": Kaeya, "kamisatoayaka": Ayaka, "ayaka": Ayaka, "kamisatoayato": Ayato, "ayato": Ayato, "keqing": Keqing, "klee": Klee, "kujousara": Sara, "kujosara": Sara, "sara": Sara, "lisa": Lisa, "mona": Mona, "ningguang": Ningguang, "noelle": Noelle, "qiqi": Qiqi, "raidenshogun": Raiden, "raiden": Raiden, "razor": Razor, "rosaria": Rosaria, "sangonomiyakokomi": Kokomi, "kokomi": Kokomi, "sayu": Sayu, "sucrose": Sucrose, "tartaglia": Tartaglia, "thoma": Thoma, "venti": Venti, "xiangling": Xiangling, "xiao": Xiao, "xingqiu": Xingqiu, "xinyan": Xinyan, "yanfei": Yanfei, "yoimiya": Yoimiya, "yunjin": Yunjin, "zhongli": Zhongli, "gorou": Gorou, "aratakiitto": Itto, "itto": Itto, "shenhe": Shenhe, "yae": YaeMiko, "yaemiko": YaeMiko, }
View Source
var ConstructNameToKey = map[string]GeoConstructType{ "ningguang": GeoConstructNingSkill, "zhongli": GeoConstructZhongliSkill, "traveler_skill": GeoConstructTravellerSkill, "traveler_burst": GeoConstructTravellerBurst, "albedo": GeoConstructAlbedoSkill, "itto": GeoConstructIttoSkill, }
View Source
var ConstructString = [...]string{
"Invalid",
"NingSkill",
"ZhongliSkill",
"TravellerSkill",
"TravellerBurst",
"AlbedoSkill",
"IttoSkill",
}
View Source
var EleTypeString = [...]string{
"electro",
"pyro",
"cryo",
"hydro",
"frozen",
"delim",
"anemo",
"dendro",
"geo",
"",
"physical",
"ec",
"unknown",
}
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, 0.0, 0.0, 0.0, 0.0},
{1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
}
View Source
var ICDGroupEleApplicationSequence = [][]int{
{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, 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, 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, 1.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, 1.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, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.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, 0.0},
{1.0, 1.0},
{1.0, 1.0},
}
View Source
var ICDGroupResetTimer = []int{
150,
60,
60,
300,
300,
30,
6,
30,
30,
}
View Source
var LogSourceFromString = map[string]LogSource{ "procs": LogProcs, "damage": LogDamageEvent, "pre_damage_mods": LogPreDamageMod, "hurt": LogHurtEvent, "heal": LogHealEvent, "calc": LogCalc, "reaction": LogReactionEvent, "element": LogElementEvent, "snapshot": LogSnapshotEvent, "snapshot_mods": LogSnapshotModsEvent, "status": LogStatusEvent, "action": LogActionEvent, "queue": LogQueueEvent, "energy": LogEnergyEvent, "character": LogCharacterEvent, "enemy": LogEnemyEvent, "hook": LogHookEvent, "sim": LogSimEvent, "task": LogTaskEvent, "artifact": LogArtifactEvent, "weapon": LogWeaponEvent, "shield": LogShieldEvent, "construct": LogConstructEvent, "icd": LogICDEvent, }
View Source
var LogSourceString = [...]string{
"procs",
"damage",
"pre_damage_mods",
"hurt",
"heal",
"calc",
"reaction",
"element",
"snapshot",
"snapshot_mods",
"status",
"action",
"queue",
"energy",
"character",
"enemy",
"hook",
"sim",
"task",
"artifact",
"weapon",
"shield",
"construct",
"icd",
}
View Source
var StatTypeString = [...]string{
"n/a",
"def%",
"def",
"hp",
"hp%",
"atk",
"atk%",
"er",
"em",
"cr",
"cd",
"heal",
"pyro%",
"hydro%",
"cryo%",
"electro%",
"anemo%",
"geo%",
"phys%",
"dendro%",
"atkspd%",
"dmg%",
}
Functions ¶
func PrettyPrintStats ¶
func PrettyPrintStatsSlice ¶
func RegisterCharFunc ¶
func RegisterCharFunc(char CharKey, f NewCharacterFunc)
func RegisterSetFunc ¶
func RegisterSetFunc(name string, f NewSetFunc)
func RegisterWeaponFunc ¶
func RegisterWeaponFunc(name string, f NewWeaponFunc)
Types ¶
type ActionBlock ¶
type ActionBlock struct { Label string //label for this block Type ActionBlockType //sequence is only relevant to ActionBlockTypeSequence Sequence []ActionItem SequenceChar CharKey ChainSequences []ActionBlock //conditions Conditions *ExprTreeNode //conditions to be met OnField bool //if true then can only use if char is on field; sequence only Needs string //previous queued action block label must match this Limit int //number of times this action block can be queued Timeout int //the action block cannot be used again for x frames //options SwapTo CharKey //character to swap to after this block SwapLock int //must stay on current char for x frames Try bool //if true then drop rest of queue if any action is not ready TryDropIfNotReady bool //if false will keep trying next action; other wise drop sequence. Only if Try is set to true //tracking NumQueued int //number of times this action block has been queued LastQueued int //last time this action block was queued //options related to wait Wait CmdWait CalcWait CmdCalcWait }
func (*ActionBlock) Clone ¶
func (a *ActionBlock) Clone() ActionBlock
type ActionBlockType ¶
type ActionBlockType int
const ( ActionBlockTypeSequence ActionBlockType = iota ActionBlockTypeWait ActionBlockTypeChain ActionBlockTypeResetLimit ActionBlockTypeCalcWait ActionBlockTypeCalcRestart )
type ActionItem ¶
type ActionItem struct { Typ ActionType Param map[string]int Target CharKey }
func (*ActionItem) Clone ¶
func (a *ActionItem) Clone() ActionItem
func (*ActionItem) Type ¶
func (a *ActionItem) Type() CommandType
type ActionType ¶
type ActionType int
const ( InvalidAction ActionType = iota ActionSkill ActionBurst ActionAttack ActionCharge ActionHighPlunge ActionLowPlunge ActionAim ActionCancellable // delim cancellable action ActionDash ActionJump ActionSwap ActionWalk EndActionType //these are only used for frames purposes and that's why it's after end ActionSkillHoldFramesOnly )
func (ActionType) String ¶
func (a ActionType) String() string
type AnimationState ¶
type AnimationState int
const ( Idle AnimationState = iota NormalAttackState ChargeAttackState PlungeAttackState SkillState BurstState AimState DashState )
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:"-"` }
type AttackInfo ¶
type AttackInfo struct { ActorIndex int //character this attack belongs to DamageSrc int //source of this attack (i.e. index of core.Targets); always 0 for player, 1+ for the rest Abil string //name of ability triggering the damage AttackTag AttackTag ICDTag ICDTag ICDGroup ICDGroup Element EleType //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 //special flag for sim generated attack SourceIsSim bool DoNotLog bool }
type AttackPattern ¶
type AttackPattern struct { Shape Shape Targets [TargettableTypeCount]bool SelfHarm bool }
func NewCircleHit ¶
func NewCircleHit(x, y, r float64, self bool, targets ...TargettableType) AttackPattern
func NewDefBoxHit ¶
func NewDefBoxHit(w, h float64, self bool, targets ...TargettableType) AttackPattern
func NewDefCircHit ¶
func NewDefCircHit(r float64, self bool, targets ...TargettableType) AttackPattern
func NewDefSingleTarget ¶
func NewDefSingleTarget(ind int, 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 AttackTagLength )
type CharKey ¶
type CharKey int
const ( NoChar CharKey = iota TravelerElectro TravelerAnemo TravelerGeo TravelerHydro TravelerCryo TravelerPyro TravelerDendro TravelerMale TravelerFemale TravelerDelim // delim Albedo Aloy Amber Barbara Beidou Bennett Chongyun Diluc Diona Eula Fischl Ganyu Hutao Jean Kazuha Kaeya Ayaka Ayato Keqing Klee Sara Lisa Mona Ningguang Noelle Qiqi Raiden Razor Rosaria Kokomi Sayu Sucrose Tartaglia Thoma Venti Xiangling Xiao Xingqiu Xinyan Yanfei Yoimiya Zhongli Gorou Itto Shenhe Yunjin YaeMiko )
func (*CharKey) MarshalJSON ¶ added in v0.5.19
func (*CharKey) UnmarshalJSON ¶ added in v0.5.19
type CharStatMod ¶
type Character ¶
type Character interface { SetIndex(index int) //to be called to set the index Init() //to be called when everything including weapon and artifacts has been loaded Tick() //function to be called every frame //information functions Key() CharKey Name() string CharIndex() int Ele() EleType Level() int WeaponClass() WeaponClass SetWeaponKey(k string) WeaponKey() string Zone() ZoneType CurrentEnergy() float64 //current energy MaxEnergy() float64 HP() float64 MaxHP() float64 ModifyHP(float64) Stat(s StatType) float64 CalcBaseStats() error AddTask(fun func(), name string, delay int) //actions; each action should return 2 ints: // the earliest frame at which the next action may be queued, and; // the total length of the animation state Attack(p map[string]int) (int, int) Aimed(p map[string]int) (int, int) ChargeAttack(p map[string]int) (int, int) HighPlungeAttack(p map[string]int) (int, int) LowPlungeAttack(p map[string]int) (int, int) Skill(p map[string]int) (int, int) Burst(p map[string]int) (int, int) Dash(p map[string]int) (int, int) //info methods ActionReady(a ActionType, p map[string]int) bool ActionStam(a ActionType, p map[string]int) float64 Charges(ActionType) int //number of frames this action will take // ActionFrames(a ActionType, p map[string]int) int //return the number of frames the current action must wait before it can be //executed; ActionInterruptableDelay(next ActionType, p map[string]int) int //char stat mods AddMod(mod CharStatMod) ModIsActive(key string) bool AddPreDamageMod(mod PreDamageMod) AddWeaponInfuse(inf WeaponInfusion) WeaponInfuseIsActive(key string) bool AddReactBonusMod(mod ReactionBonusMod) ReactBonus(AttackInfo) float64 //cooldown stuff SetCD(a ActionType, dur int) Cooldown(a ActionType) int ResetActionCooldown(a ActionType) ReduceActionCooldown(a ActionType, v int) AddCDAdjustFunc(adj CDAdjust) //status stuff AddTag(key string, val int) RemoveTag(key string) Tag(key string) int //energy QueueParticle(src string, num int, ele EleType, delay int) ReceiveParticle(p Particle, isActive bool, partyCount int) AddEnergy(src string, e float64) //combat Snapshot(a *AttackInfo) Snapshot PreDamageSnapshotAdjust(*AttackEvent, Target) []interface{} ResetNormalCounter() NextNormalCounter() int }
type CharacterBase ¶
type CharacterBase struct { Key CharKey `json:"key"` Name string `json:"name"` Element EleType `json:"element"` Level int `json:"level"` MaxLevel int `json:"max_level"` HP float64 `json:"base_hp"` Atk float64 `json:"base_atk"` Def float64 `json:"base_def"` Cons int `json:"cons"` StartHP float64 `json:"start_hp"` }
type CharacterProfile ¶
type CharacterProfile struct { Base CharacterBase `json:"base"` Weapon WeaponProfile `json:"weapon"` Talents TalentProfile `json:"talents"` Stats []float64 `json:"stats"` Sets map[string]int `json:"sets"` SetParams map[string]map[string]int `json:"-"` Params map[string]int `json:"-"` }
func (*CharacterProfile) Clone ¶
func (c *CharacterProfile) Clone() CharacterProfile
type Circle ¶
type Circle struct {
// contains filtered or unexported fields
}
func (*Circle) IntersectCircle ¶
func (*Circle) IntersectRectangle ¶
type CmdCalcWait ¶
type CmdNoSwap ¶
type CmdNoSwap struct {
Val int
}
func (*CmdNoSwap) Type ¶
func (c *CmdNoSwap) Type() CommandType
type CmdResetLimit ¶
type CmdResetLimit struct { }
func (CmdResetLimit) Type ¶
func (c CmdResetLimit) Type() CommandType
type CmdWait ¶
type CmdWait struct { For CmdWaitType Max int //cannot be 0 if type is timed Source string Conditions Condition FillAction ActionItem }
func (*CmdWait) Type ¶
func (c *CmdWait) Type() CommandType
type CmdWaitType ¶
type CmdWaitType int
const ( CmdWaitTypeInvalid CmdWaitType = iota CmdWaitTypeTimed CmdWaitTypeParticle CmdWaitTypeMods )
type CombatHandler ¶
type CombatHandler interface { ApplyDamage(*AttackEvent) float64 QueueAttack(a AttackInfo, p AttackPattern, snapshotDelay int, dmgDelay int, callbacks ...AttackCBFunc) QueueAttackWithSnap(a AttackInfo, s Snapshot, p AttackPattern, dmgDelay int, callbacks ...AttackCBFunc) QueueAttackEvent(ae *AttackEvent, dmgDelay int) TargetHasResMod(debuff string, param int) bool TargetHasDefMod(debuff string, param int) bool TargetHasElement(ele EleType, param int) bool }
type Command ¶
type Command interface {
Type() CommandType
}
Command is what gets executed by the sim.
type CommandHandler ¶
type CommandType ¶
type CommandType int
const ( CommandTypeAction CommandType = iota CommandTypeWait CommandTypeNoSwap CommandTypeResetLimit )
type Construct ¶
type Construct interface { OnDestruct() Key() int Type() GeoConstructType Expiry() int IsLimited() bool Count() int }
type ConstructHandler ¶
type Core ¶
type Core struct { //control F int // current frame Flags Flags // global flags Rand *rand.Rand Log LogCtrl //core data Stam float64 SwapCD int LastStamUse int //track characters ActiveChar int // index of currently active char ActiveDuration int // duration in frames that the current char has been on field for Chars []Character // array holding all the characters on the team CharPos map[CharKey]int // map of character string name to their index (for quick lookup by name) //track targets Targets []Target TotalDamage float64 // keeps tracks of total damage dealt for the purpose of final results //last action taken by the sim LastAction ActionItem //handlers Status StatusHandler Energy EnergyHandler Action CommandHandler Queue QueueHandler Combat CombatHandler Tasks TaskHandler Constructs ConstructHandler Shields ShieldHandler Health HealthHandler Events EventHandler // contains filtered or unexported fields }
func (*Core) AbsorbCheck ¶
func (c *Core) AbsorbCheck(p AttackPattern, prio ...EleType) EleType
func (*Core) AddStamMod ¶
func (c *Core) AddStamMod(f func(a ActionType) (float64, bool), key string)
func (*Core) AnimationCancelDelay ¶
func (c *Core) AnimationCancelDelay(next ActionType, p map[string]int) int
func (*Core) ClearState ¶
func (c *Core) ClearState()
func (*Core) EnemyByDistance ¶
EnemeyByDistance returns an array of indices of the enemies sorted by distance
func (*Core) RandomEnemyTarget ¶
func (*Core) RandomTargetIndex ¶
func (c *Core) RandomTargetIndex(typ TargettableType) int
func (*Core) RemoveTarget ¶
func (*Core) ResetAllNormalCounter ¶
func (c *Core) ResetAllNormalCounter()
func (*Core) RestoreStam ¶
func (*Core) SetCustomFlag ¶
func (*Core) SetState ¶
func (c *Core) SetState(state AnimationState, duration int)
func (*Core) StamPercentMod ¶
func (c *Core) StamPercentMod(a ActionType) float64
func (*Core) State ¶
func (c *Core) State() AnimationState
func (*Core) UserCustomDelay ¶
type Durability ¶
type Durability float64
type EleType ¶
type EleType int
EleType is a string representing an element i.e. HYDRO/PYRO/etc...
const ( Electro EleType = iota Pyro Cryo Hydro Frozen ElementDelimAttachable Anemo Dendro Geo NoElement Physical EC UnknownElement EndEleType )
ElementType should be pryo, Hydro, Cryo, Electro, Geo, Anemo and maybe dendro
func StringToEle ¶
func (*EleType) MarshalJSON ¶ added in v0.5.19
func (*EleType) UnmarshalJSON ¶ added in v0.5.19
type EnemyProfile ¶
type EnemyProfile struct { Level int `json:"level"` HP float64 `json:"-"` Resist map[EleType]float64 `json:"-"` Size float64 `json:"-"` CoordX, CoordY float64 `json:"-"` }
func (*EnemyProfile) Clone ¶
func (e *EnemyProfile) Clone() EnemyProfile
type EnergyEvent ¶
type EnergyHandler ¶
type EnergyHandler interface {
DistributeParticle(p Particle)
}
type EventHandler ¶
type EventType ¶
type EventType int
const ( OnAttackWillLand EventType = iota //target, AttackEvent OnDamage //target, AttackEvent, amount, crit OnAuraDurabilityAdded //target, ele, durability OnAuraDurabilityDepleted //target, ele // OnReaction //target, AttackEvent, ReactionType ReactionEventStartDelim OnOverload //target, AttackEvent OnSuperconduct //target, AttackEvent OnMelt //target, AttackEvent OnVaporize //target, AttackEvent OnFrozen //target, AttackEvent OnElectroCharged //target, AttackEvent OnSwirlHydro OnSwirlCryo OnSwirlElectro OnSwirlPyro OnCrystallizeHydro OnCrystallizeCryo OnCrystallizeElectro OnCrystallizePyro ReactionEventEndDelim //other stuff OnStamUse //abil OnShielded //shield OnCharacterSwap //prev, next OnParticleReceived //particle OnEnergyChange //character_received, pre_energy, energy_change, src (post-energy available in character_received) OnTargetDied //target OnCharacterHurt //amount OnHeal //src char, target character, amount //ability use PreSkill //nil PostSkill //nil, frames PreBurst //nil PostBurst //nil, frames PreAttack //nil PostAttack //nil, frames PreChargeAttack //nil PostChargeAttack //nil, frames PrePlunge //nil PostPlunge //nil, frames PreAimShoot //nil PostAimShoot //nil, frames PreDash PostDash //sim stuff OnInitialize //nil OnStateChange //prev, next OnTargetAdded //t EndEventTypes //elim )
type ExprTreeNode ¶
type ExprTreeNode struct { Left *ExprTreeNode Right *ExprTreeNode IsLeaf bool Op string //&& || ( ) Expr Condition }
func (*ExprTreeNode) Clone ¶
func (e *ExprTreeNode) Clone() *ExprTreeNode
type Flags ¶
type Flags struct { DamageMode bool EnergyCalcMode bool // Allows Burst Action when not at full Energy, logs current Energy when using Burst LogDebug bool // Used to determine logging level ChildeActive bool // Used for Childe +1 NA talent passive Delays Delays // AmpReactionDidOccur bool // AmpReactionType ReactionType // NextAttackMVMult float64 // melt vape multiplier // ReactionDamageTriggered bool Custom map[string]int }
type GeoConstructType ¶
type GeoConstructType int
const ( GeoConstructInvalid GeoConstructType = iota GeoConstructNingSkill GeoConstructZhongliSkill GeoConstructTravellerSkill GeoConstructTravellerBurst GeoConstructAlbedoSkill GeoConstructIttoSkill EndGeoConstructType )
func (GeoConstructType) String ¶
func (c GeoConstructType) String() string
type HealthHandler ¶
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 ICDTagElementalBurst ICDTagDash ICDTagLisaElectro ICDTagYanfeiFire ICDTagVentiBurstAnemo ICDTagVentiBurstPyro ICDTagVentiBurstHydro ICDTagVentiBurstCryo ICDTagVentiBurstElectro ICDTagMonaWaterDamage ICDTagTravelerWakeOfEarth ICDTagKleeFireDamage ICDTagTartagliaRiptideFlash ICDReactionDamageDelim ICDTagOverloadDamage ICDTagSuperconductDamage ICDTagECDamage ICDTagShatter ICDTagSwirlPyro ICDTagSwirlHydro ICDTagSwirlCryo ICDTagSwirlElectro ICDTagLength )
type LogEvent ¶
type LogEvent interface { LogSource() LogSource //returns the type of this log event i.e. character, sim, damage, etc... StartFrame() int //returns the frame on which this event was started Src() int //returns the index of the character that triggered this event. -1 if it's not a character Write(keyAndVal ...interface{}) //write additional keyAndVal pairs to the event SetEnded(f int) }
type LogSource ¶
type LogSource int
const ( LogProcs LogSource = iota LogDamageEvent LogPreDamageMod LogHurtEvent LogHealEvent LogCalc LogReactionEvent LogElementEvent LogSnapshotEvent LogSnapshotModsEvent LogStatusEvent LogActionEvent LogQueueEvent LogEnergyEvent LogCharacterEvent LogEnemyEvent LogHookEvent LogSimEvent LogTaskEvent LogArtifactEvent LogWeaponEvent LogShieldEvent LogConstructEvent LogICDEvent )
type NewCharacterFunc ¶
type NewCharacterFunc func(core *Core, p CharacterProfile) (Character, error)
type NewWeaponFunc ¶
type NilLogEvent ¶
type NilLogEvent struct{}
func (*NilLogEvent) LogSource ¶
func (n *NilLogEvent) LogSource() LogSource
func (*NilLogEvent) SetEnded ¶
func (n *NilLogEvent) SetEnded(f int)
func (*NilLogEvent) Src ¶
func (n *NilLogEvent) Src() int
func (*NilLogEvent) StartFrame ¶
func (n *NilLogEvent) StartFrame() int
func (*NilLogEvent) Write ¶
func (n *NilLogEvent) Write(keyAndVal ...interface{})
type PreDamageMod ¶
type QueueHandler ¶
type QueueHandler interface { //returns a sequence of 1 or more commands to execute, //whether or not to drop sequence if any is not ready, and any error Next() (queue []Command, dropIfFailed bool, err error) SetActionList(pq []ActionBlock) error }
type ReactionBonusMod ¶
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" NoReaction ReactionType = "" FreezeExtend ReactionType = "FreezeExtend" )
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 ShieldHandler ¶
type ShieldType ¶
type ShieldType int
const ( ShieldCrystallize ShieldType = iota //lasts 15 seconds ShieldNoelleSkill ShieldNoelleA1 ShieldZhongliJadeShield ShieldDionaSkill ShieldBeidouThunderShield ShieldXinyanSkill ShieldXinyanC2 ShieldKaeyaC4 ShieldYanfeiC4 ShieldBell ShieldYunjinSkill EndShieldType )
type SimulationConfig ¶
type SimulationConfig struct { //these settings relate to each simulation iteration DamageMode bool `json:"damage_mode"` Targets []EnemyProfile `json:"targets"` Characters struct { Initial CharKey `json:"initial"` Profile []CharacterProfile `json:"profile"` } `json:"characters"` Rotation []ActionBlock `json:"-"` Hurt HurtEvent `json:"-"` Energy EnergyEvent `json:"-"` Settings SimulatorSettings `json:"-"` }
SimulationConfig describes the required settings to run an simulation
func (*SimulationConfig) Clone ¶
func (c *SimulationConfig) Clone() SimulationConfig
type SimulationQueueMode ¶
type SimulationQueueMode int
const ( ActionPriorityList SimulationQueueMode = iota SequentialList )
type SimulatorSettings ¶
type SingleTarget ¶
type SingleTarget struct {
Target int
}
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 EleType ExtraIndex int //this is currently purely for Kaeya icicle ICD Cancelled bool //set to true if this snap should be ignored Stats [EndStatType]float64 //total character stats including from artifact, bonuses, etc... BaseAtk float64 //base attack used in calc BaseDef float64 SourceFrame int // frame snapshot was generated at Logs []interface{} // logs for the snapshot }
type StatType ¶
type StatType int
const ( NoStat StatType = iota DEFP DEF HP HPP ATK ATKP ER EM CR CD Heal PyroP HydroP CryoP ElectroP AnemoP GeoP PhyP // ElementalP DendroP AtkSpd DmgP //delim EndStatType )
stat types
func StrToStatType ¶
type StatusHandler ¶
type StrikeType ¶
type StrikeType int
const ( StrikeTypeDefault StrikeType = iota StrikeTypePierce StrikeTypeBlunt StrikeTypeSlash StrikeTypeSpear )
type TalentProfile ¶
type Target ¶
type Target interface { //basic info Type() TargettableType //type of target Index() int //should correspond to index SetIndex(ind int) //update the current index MaxHP() float64 HP() float64 //collision detection Shape() Shape //attacks Attack(*AttackEvent, LogEvent) (float64, bool) //reaction/aura stuff Tick() AuraContains(...EleType) bool AuraType() EleType //tags SetTag(key string, val int) GetTag(key string) int RemoveTag(key string) //target mods AddDefMod(key string, val float64, dur int) AddResMod(key string, val ResistMod) RemoveResMod(key string) RemoveDefMod(key string) HasDefMod(key string) bool HasResMod(key string) bool //getting rid of Kill() }
type TargettableType ¶
type TargettableType int
const ( TargettableEnemy TargettableType = iota TargettablePlayer TargettableObject TargettableTypeCount )
type TaskHandler ¶
type TaskHandler interface { Add(f func(), delay int) Run() }
type WeaponClass ¶
type WeaponClass int
const ( WeaponClassSword WeaponClass = iota WeaponClassClaymore WeaponClassSpear WeaponClassBow WeaponClassCatalyst EndWeaponClass )
func (WeaponClass) String ¶
func (w WeaponClass) String() string
type WeaponInfusion ¶
type WeaponProfile ¶
type WeaponProfile struct { Name string `json:"name"` Key string `json:"key"` //use this to match with weapon curve mapping Class WeaponClass `json:"-"` Refine int `json:"refine"` Level int `json:"level"` MaxLevel int `json:"max_level"` Atk float64 `json:"base_atk"` Params map[string]int `json:"-"` }
Click to show internal directories.
Click to hide internal directories.