クラス Character
Each concrete subclass represents a specific character and must implement
applyPassive(StatsContainer) to register its talent-derived stat
modifications, and getEnergyCost() to declare the burst energy
requirement.
Stat computation overview:
getEffectiveStats(double)– full stats including active buffs; use for damage calculations.getStructuralStats(double)– base + weapon + artifacts + self-passive only; excludes active and team buffs to prevent recursive cycles when team-buff providers query their own stats.
Snapshot pattern: call
captureSnapshot(double, java.util.List)
at cast time and getSnapshot() during impact resolution to replicate
Genshin's snapshot behaviour for skills whose damage is calculated after the
initial buff window has elapsed.
Initialised with KQM standard base stats: 5 % crit rate, 50 % crit DMG, 100 % energy recharge.
-
フィールドの概要
フィールド修飾子とタイプフィールド説明protected ArtifactSet[]protected StatsContainerLevel-90 base stats for this character.protected doubleprotected intprotected doubleprotected Elementprotected doubleprotected doubleprotected Stringprotected doubleprotected intprotected StatsContainerStored snapshot stats captured at skill/burst cast time.protected doubleprotected doubleprotected doubleCumulative particle energy received pre-ER scaling, post-field-penalty.protected Weapon -
コンストラクタの概要
コンストラクタコンストラクタ説明Initialises base stats with KQM standard defaults: 5 % crit rate, 50 % crit DMG, 100 % energy recharge. -
メソッドの概要
修飾子とタイプメソッド説明voidAdds a buff to this character's active buff list.abstract voidapplyPassive(StatsContainer currentStats) Hook called during stat compilation to apply this character's passive talents (e.g., ascension passives, innate scaling conversions).booleancanBurst(double currentTime) Returnstrueif the elemental burst can be used at the given simulation time, requiring both the burst cooldown to have elapsed and sufficient energy.booleancanSkill(double currentTime) Returnstrueif the elemental skill is available at the given simulation time (i.e. no remaining cooldown / a charge is available).voidcaptureSnapshot(double currentTime, List<Buff> extraBuffs) Captures and stores a stat snapshot at the given simulation time.voidRemoves all active buffs from this character.Returns the live list of active buffs.Returns the stored artifact substat roll distribution, or an empty map if none has been set.Returns the array of equipped artifact sets.Returns the raw level-90 base stats container before any equipment or buffs are applied.doubleReturns the elemental burst cooldown duration in seconds.doublegetBurstCDRemaining(double currentTime) Returns the remaining elemental burst cooldown in seconds, or0if the burst cooldown has elapsed (energy requirement is checked separately bycanBurst(double)).List<double[]> Returns the list of per-burst-window energy records.intReturns the character's constellation level (0–6).doubleReturns the character's current energy.getEffectiveStats(double currentTime) Computes and returns the character's fully resolved stats at the given simulation time, including base stats, weapon, artifacts, weapon passive, all non-expired active buffs, artifact passives, and the character's own passive talent.Returns the character's elemental vision (e.g.abstract doubleReturns the elemental burst energy cost for this character.doubleReturns the simulation time at which the elemental burst was last used.doubleReturns the simulation time at which the elemental skill was last used.getName()Returns the character's display name.doubleReturns the elemental skill cooldown duration in seconds.doublegetSkillCDRemaining(double currentTime) Returns the remaining elemental skill cooldown in seconds, or0if the skill (or a charge) is available.Returns the most recently captured stat snapshot.getStructuralStats(double currentTime) Computes a recursion-safe stat view that includes only base stats, weapon stats, weapon passive, artifact stats, artifact passives, and the character's own passive talent.Returns the list of team-wide buffs that this character provides to the party.doubleReturns the cumulative total energy credited to the gauge across all windows (post-ER for particle energy, direct for flat energy).doubleReturns the cumulative flat energy received across all windows.doubleReturns the cumulative pre-ER particle energy received across all windows.Returns the currently equipped weapon.booleanReturnstrueif at least one active buff with the given name exists.booleanisBurstActive(double currentTime) Returnstrueif the character's burst is currently in an active state (providing on-field buffs or dealing DoT damage).booleanReturnstrueif this character is a Lunar character.voidmarkBurstUsed(double currentTime) Records that the elemental burst was used atcurrentTime.voidmarkSkillUsed(double currentTime) Records that the elemental skill was used atcurrentTime.voidonAction(String key, CombatSimulator sim) Called by the simulator when a named action (e.g.voidCalled by the simulator when this character is swapped off-field.voidreceiveEnergy(double amount) Adds the given final energy amount to this character's energy gauge, capped atgetEnergyCost(), and accumulates it in the total energy-gained counter.voidreceiveFlatEnergy(double amount) Receives a flat energy amount that bypasses ER scaling (e.g. from certain talent or passive mechanics).voidreceiveParticleEnergy(double baseAmount, double er) Receives energy from elemental particles or orbs.voidremoveBuff(String name) Removes all buffs with the given name from the active buff list.voidResets all energy counters and windows to their initial state.voidsetArtifactRolls(Map<StatType, Integer> rolls) Stores the artifact substat roll distribution used by the optimizer.voidsetArtifacts(ArtifactSet artifact) Equips a single artifact set, replacing any previously equipped artifacts.voidsetBurstCD(double cd) Sets the elemental burst cooldown in seconds.voidsetSkillCD(double cd) Sets the elemental skill cooldown in seconds.voidEquips the given weapon on this character.
-
フィールド詳細
-
name
-
baseStats
Level-90 base stats for this character. -
weapon
-
artifacts
-
constellation
protected int constellation -
activeBuffs
-
snapshotStats
Stored snapshot stats captured at skill/burst cast time. -
currentEnergy
protected double currentEnergy -
totalEnergyGained
protected double totalEnergyGained -
totalFlatEnergyGained
protected double totalFlatEnergyGained -
totalParticleEnergyGained
protected double totalParticleEnergyGainedCumulative particle energy received pre-ER scaling, post-field-penalty. -
element
-
artifactRolls
-
lastSkillTime
protected double lastSkillTime -
lastBurstTime
protected double lastBurstTime -
skillCD
protected double skillCD -
burstCD
protected double burstCD -
skillMaxCharges
protected int skillMaxCharges
-
-
コンストラクタの詳細
-
Character
public Character()Initialises base stats with KQM standard defaults: 5 % crit rate, 50 % crit DMG, 100 % energy recharge.
-
-
メソッドの詳細
-
getConstellation
public int getConstellation()Returns the character's constellation level (0–6).- 戻り値:
- constellation level
-
getName
Returns the character's display name.- 戻り値:
- character name
-
getBaseStats
Returns the raw level-90 base stats container before any equipment or buffs are applied.- 戻り値:
- base stats container
-
getWeapon
Returns the currently equipped weapon.- 戻り値:
- weapon, or
nullif none is equipped
-
setWeapon
Equips the given weapon on this character.- パラメータ:
weapon- weapon to equip
-
setArtifacts
Equips a single artifact set, replacing any previously equipped artifacts.- パラメータ:
artifact- artifact set to equip
-
getArtifacts
Returns the array of equipped artifact sets.- 戻り値:
- artifact set array, or
nullif none are equipped
-
applyPassive
Hook called during stat compilation to apply this character's passive talents (e.g., ascension passives, innate scaling conversions). Implementations should callcurrentStats.add(...)to modify the provided container in-place.- パラメータ:
currentStats- the aggregated stats container to mutate
-
addBuff
Adds a buff to this character's active buff list.- パラメータ:
buff- buff to add
-
removeBuff
Removes all buffs with the given name from the active buff list.- パラメータ:
name- name of the buff to remove
-
hasBuff
Returnstrueif at least one active buff with the given name exists.- パラメータ:
name- buff name to query- 戻り値:
trueif the buff is present
-
getActiveBuffs
Returns the live list of active buffs. Callers should not modify this list directly; useaddBuff(mechanics.buff.Buff)andremoveBuff(java.lang.String)instead.- 戻り値:
- mutable list of active buffs
-
clearBuffs
public void clearBuffs()Removes all active buffs from this character. -
getEffectiveStats
Computes and returns the character's fully resolved stats at the given simulation time, including base stats, weapon, artifacts, weapon passive, all non-expired active buffs, artifact passives, and the character's own passive talent.This is the primary stat source for damage calculations. Do not call this from inside a team-buff provider's own stat lookup; use
getStructuralStats(double)there to avoid recursion.- パラメータ:
currentTime- simulation time in seconds- 戻り値:
- fully resolved stats container
-
getStructuralStats
Computes a recursion-safe stat view that includes only base stats, weapon stats, weapon passive, artifact stats, artifact passives, and the character's own passive talent.This method intentionally ignores "Active Buffs" and "Team Buffs" to prevent infinite recursion when a team buff needs to scale off the provider's own stats (e.g., Kazuha's EM sharing).
- パラメータ:
currentTime- simulation time in seconds- 戻り値:
- structural stats container
-
captureSnapshot
Captures and stores a stat snapshot at the given simulation time.getEffectiveStats(double)is used as the base, then anyextraBuffsthat have not yet expired are applied on top. The resulting container is stored and retrievable viagetSnapshot().Call this at the moment a skill or burst is cast to replicate Genshin's snapshotting behaviour, where later damage instances inherit the caster's stats at cast time rather than impact time.
- パラメータ:
currentTime- simulation time in seconds at which the snapshot is takenextraBuffs- additional buffs to layer on top of the effective stats; may benull
-
getSnapshot
Returns the most recently captured stat snapshot. If no snapshot has been captured yet, returns an emptyStatsContainer.- 戻り値:
- snapshot stats, never
null
-
onAction
Called by the simulator when a named action (e.g."Q"for burst,"E"for skill) is executed. Delegates to the weapon's action hook by default.- パラメータ:
key- action key stringsim- the active combat simulator
-
onSwitchOut
Called by the simulator when this character is swapped off-field. Default implementation does nothing; override to handle off-field cleanup.- パラメータ:
sim- the active combat simulator
-
getElement
Returns the character's elemental vision (e.g. PYRO, CRYO).- 戻り値:
- element type
-
receiveEnergy
public void receiveEnergy(double amount) Adds the given final energy amount to this character's energy gauge, capped atgetEnergyCost(), and accumulates it in the total energy-gained counter.Prefer
receiveParticleEnergy(double, double)orreceiveFlatEnergy(double)so that per-source accounting is maintained correctly.- パラメータ:
amount- final energy amount to add (after all multipliers)
-
getCurrentEnergy
public double getCurrentEnergy()Returns the character's current energy.- 戻り値:
- current energy value
-
receiveParticleEnergy
public void receiveParticleEnergy(double baseAmount, double er) Receives energy from elemental particles or orbs. RecordsbaseAmount(count × value × off-field factor) in the pre-ER particle energy total, then applies the character's energy recharge multiplier (er) before crediting the gauge viareceiveEnergy(double).- パラメータ:
baseAmount- raw energy before ER scaling (particle count × particle value × field penalty)er- the character's energy recharge ratio (e.g. 1.32 for 132 % ER)
-
receiveFlatEnergy
public void receiveFlatEnergy(double amount) Receives a flat energy amount that bypasses ER scaling (e.g. from certain talent or passive mechanics). Tracks the amount separately for analysis and forwards it toreceiveEnergy(double).- パラメータ:
amount- flat energy to add directly to the gauge
-
getTotalParticleEnergy
public double getTotalParticleEnergy()Returns the cumulative pre-ER particle energy received across all windows.- 戻り値:
- total particle energy (pre-ER)
-
getTotalFlatEnergy
public double getTotalFlatEnergy()Returns the cumulative flat energy received across all windows.- 戻り値:
- total flat energy
-
getTotalEnergyGained
public double getTotalEnergyGained()Returns the cumulative total energy credited to the gauge across all windows (post-ER for particle energy, direct for flat energy).- 戻り値:
- total energy gained
-
resetEnergyStats
public void resetEnergyStats()Resets all energy counters and windows to their initial state. SetscurrentEnergytogetEnergyCost()so that the first burst of a rotation can be used immediately. -
setArtifactRolls
Stores the artifact substat roll distribution used by the optimizer.- パラメータ:
rolls- map fromStatTypeto number of rolls allocated
-
getArtifactRolls
Returns the stored artifact substat roll distribution, or an empty map if none has been set.- 戻り値:
- roll distribution map, never
null
-
setSkillCD
public void setSkillCD(double cd) Sets the elemental skill cooldown in seconds.- パラメータ:
cd- cooldown duration
-
setBurstCD
public void setBurstCD(double cd) Sets the elemental burst cooldown in seconds.- パラメータ:
cd- cooldown duration
-
canSkill
public boolean canSkill(double currentTime) Returnstrueif the elemental skill is available at the given simulation time (i.e. no remaining cooldown / a charge is available).- パラメータ:
currentTime- simulation time in seconds- 戻り値:
trueif the skill can be used
-
canBurst
public boolean canBurst(double currentTime) Returnstrueif the elemental burst can be used at the given simulation time, requiring both the burst cooldown to have elapsed and sufficient energy.- パラメータ:
currentTime- simulation time in seconds- 戻り値:
trueif the burst can be used
-
isBurstActive
public boolean isBurstActive(double currentTime) Returnstrueif the character's burst is currently in an active state (providing on-field buffs or dealing DoT damage). Default implementation always returnsfalse; override in subclasses that have persistent burst effects.- パラメータ:
currentTime- simulation time in seconds- 戻り値:
trueif the burst is active
-
getSkillCDRemaining
public double getSkillCDRemaining(double currentTime) Returns the remaining elemental skill cooldown in seconds, or0if the skill (or a charge) is available. For charge-based skills, returns the time until the earliest charge is restored.- パラメータ:
currentTime- simulation time in seconds- 戻り値:
- seconds remaining on cooldown,
0if ready
-
getBurstCDRemaining
public double getBurstCDRemaining(double currentTime) Returns the remaining elemental burst cooldown in seconds, or0if the burst cooldown has elapsed (energy requirement is checked separately bycanBurst(double)).- パラメータ:
currentTime- simulation time in seconds- 戻り値:
- seconds remaining on cooldown,
0if the timer has expired
-
markSkillUsed
public void markSkillUsed(double currentTime) Records that the elemental skill was used atcurrentTime. For charge-based skills, a new charge-restore timestamp is appended and the list is kept sorted. Always updateslastSkillTime.- パラメータ:
currentTime- simulation time in seconds
-
markBurstUsed
public void markBurstUsed(double currentTime) Records that the elemental burst was used atcurrentTime. Snapshots the current window's particle and flat energy intogetBurstEnergyWindows()for ER requirement analysis, resets the per-window counters, drains the energy gauge to zero, and updateslastBurstTime.- パラメータ:
currentTime- simulation time in seconds
-
getBurstEnergyWindows
Returns the list of per-burst-window energy records. Each element is adouble[3]array:[particleBaseEnergy, flatEnergy, burstCost].- 戻り値:
- list of energy window records
-
getEnergyCost
public abstract double getEnergyCost()Returns the elemental burst energy cost for this character.- 戻り値:
- burst energy cost
-
getSkillCD
public double getSkillCD()Returns the elemental skill cooldown duration in seconds.- 戻り値:
- skill cooldown
-
getBurstCD
public double getBurstCD()Returns the elemental burst cooldown duration in seconds.- 戻り値:
- burst cooldown
-
getLastSkillTime
public double getLastSkillTime()Returns the simulation time at which the elemental skill was last used.- 戻り値:
- last skill use time in seconds
-
getLastBurstTime
public double getLastBurstTime()Returns the simulation time at which the elemental burst was last used.- 戻り値:
- last burst use time in seconds
-
isLunarCharacter
public boolean isLunarCharacter()Returnstrueif this character is a Lunar character. Lunar characters receive special synergy buffs from non-Lunar teammates (Moonsign / Ascendant Blessing mechanics) and may interact withLUNAR_*stat types inStatType. Default implementation returnsfalse; override in Lunar character subclasses.- 戻り値:
trueif this is a Lunar character
-
getTeamBuffs
Returns the list of team-wide buffs that this character provides to the party. These buffs are applied to teammates during stat compilation and must usegetStructuralStats(double)internally to avoid recursive stat lookups. Default implementation returns an empty list.- 戻り値:
- list of team buffs granted by this character
-