パッケージ model.entity

クラス Character

java.lang.Object
model.entity.Character
直系の既知のサブクラス:
Bennett, Columbina, Flins, Ineffa, RaidenShogun, Sucrose, Xiangling, Xingqiu

public abstract class Character extends Object
Abstract base class for all playable characters in the simulation.

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 List<Buff>
     
    protected Map<StatType,Integer>
     
    protected ArtifactSet[]
     
    protected StatsContainer
    Level-90 base stats for this character.
    protected double
     
    protected int
     
    protected double
     
    protected Element
     
    protected double
     
    protected double
     
    protected String
     
    protected double
     
    protected int
     
    protected StatsContainer
    Stored snapshot stats captured at skill/burst cast time.
    protected double
     
    protected double
     
    protected double
    Cumulative 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.
  • メソッドの概要

    修飾子とタイプ
    メソッド
    説明
    void
    addBuff(Buff buff)
    Adds a buff to this character's active buff list.
    abstract void
    Hook called during stat compilation to apply this character's passive talents (e.g., ascension passives, innate scaling conversions).
    boolean
    canBurst(double currentTime)
    Returns true if the elemental burst can be used at the given simulation time, requiring both the burst cooldown to have elapsed and sufficient energy.
    boolean
    canSkill(double currentTime)
    Returns true if the elemental skill is available at the given simulation time (i.e. no remaining cooldown / a charge is available).
    void
    captureSnapshot(double currentTime, List<Buff> extraBuffs)
    Captures and stores a stat snapshot at the given simulation time.
    void
    Removes 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.
    double
    Returns the elemental burst cooldown duration in seconds.
    double
    getBurstCDRemaining(double currentTime)
    Returns the remaining elemental burst cooldown in seconds, or 0 if the burst cooldown has elapsed (energy requirement is checked separately by canBurst(double)).
    List<double[]>
    Returns the list of per-burst-window energy records.
    int
    Returns the character's constellation level (0–6).
    double
    Returns 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 double
    Returns the elemental burst energy cost for this character.
    double
    Returns the simulation time at which the elemental burst was last used.
    double
    Returns the simulation time at which the elemental skill was last used.
    Returns the character's display name.
    double
    Returns the elemental skill cooldown duration in seconds.
    double
    getSkillCDRemaining(double currentTime)
    Returns the remaining elemental skill cooldown in seconds, or 0 if 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.
    double
    Returns the cumulative total energy credited to the gauge across all windows (post-ER for particle energy, direct for flat energy).
    double
    Returns the cumulative flat energy received across all windows.
    double
    Returns the cumulative pre-ER particle energy received across all windows.
    Returns the currently equipped weapon.
    boolean
    Returns true if at least one active buff with the given name exists.
    boolean
    isBurstActive(double currentTime)
    Returns true if the character's burst is currently in an active state (providing on-field buffs or dealing DoT damage).
    boolean
    Returns true if this character is a Lunar character.
    void
    markBurstUsed(double currentTime)
    Records that the elemental burst was used at currentTime.
    void
    markSkillUsed(double currentTime)
    Records that the elemental skill was used at currentTime.
    void
    Called by the simulator when a named action (e.g.
    void
    Called by the simulator when this character is swapped off-field.
    void
    receiveEnergy(double amount)
    Adds the given final energy amount to this character's energy gauge, capped at getEnergyCost(), and accumulates it in the total energy-gained counter.
    void
    receiveFlatEnergy(double amount)
    Receives a flat energy amount that bypasses ER scaling (e.g. from certain talent or passive mechanics).
    void
    receiveParticleEnergy(double baseAmount, double er)
    Receives energy from elemental particles or orbs.
    void
    Removes all buffs with the given name from the active buff list.
    void
    Resets all energy counters and windows to their initial state.
    void
    Stores the artifact substat roll distribution used by the optimizer.
    void
    Equips a single artifact set, replacing any previously equipped artifacts.
    void
    setBurstCD(double cd)
    Sets the elemental burst cooldown in seconds.
    void
    setSkillCD(double cd)
    Sets the elemental skill cooldown in seconds.
    void
    setWeapon(Weapon weapon)
    Equips the given weapon on this character.

    クラスから継承されたメソッド java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • フィールド詳細

    • name

      protected String name
    • baseStats

      protected StatsContainer baseStats
      Level-90 base stats for this character.
    • weapon

      protected Weapon weapon
    • artifacts

      protected ArtifactSet[] artifacts
    • constellation

      protected int constellation
    • activeBuffs

      protected List<Buff> activeBuffs
    • snapshotStats

      protected StatsContainer 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 totalParticleEnergyGained
      Cumulative particle energy received pre-ER scaling, post-field-penalty.
    • element

      protected Element element
    • artifactRolls

      protected Map<StatType,Integer> 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

      public String getName()
      Returns the character's display name.
      戻り値:
      character name
    • getBaseStats

      public StatsContainer getBaseStats()
      Returns the raw level-90 base stats container before any equipment or buffs are applied.
      戻り値:
      base stats container
    • getWeapon

      public Weapon getWeapon()
      Returns the currently equipped weapon.
      戻り値:
      weapon, or null if none is equipped
    • setWeapon

      public void setWeapon(Weapon weapon)
      Equips the given weapon on this character.
      パラメータ:
      weapon - weapon to equip
    • setArtifacts

      public void setArtifacts(ArtifactSet artifact)
      Equips a single artifact set, replacing any previously equipped artifacts.
      パラメータ:
      artifact - artifact set to equip
    • getArtifacts

      public ArtifactSet[] getArtifacts()
      Returns the array of equipped artifact sets.
      戻り値:
      artifact set array, or null if none are equipped
    • applyPassive

      public abstract void applyPassive(StatsContainer currentStats)
      Hook called during stat compilation to apply this character's passive talents (e.g., ascension passives, innate scaling conversions). Implementations should call currentStats.add(...) to modify the provided container in-place.
      パラメータ:
      currentStats - the aggregated stats container to mutate
    • addBuff

      public void addBuff(Buff buff)
      Adds a buff to this character's active buff list.
      パラメータ:
      buff - buff to add
    • removeBuff

      public void removeBuff(String name)
      Removes all buffs with the given name from the active buff list.
      パラメータ:
      name - name of the buff to remove
    • hasBuff

      public boolean hasBuff(String name)
      Returns true if at least one active buff with the given name exists.
      パラメータ:
      name - buff name to query
      戻り値:
      true if the buff is present
    • getActiveBuffs

      public List<Buff> getActiveBuffs()
      Returns the live list of active buffs. Callers should not modify this list directly; use addBuff(mechanics.buff.Buff) and removeBuff(java.lang.String) instead.
      戻り値:
      mutable list of active buffs
    • clearBuffs

      public void clearBuffs()
      Removes all active buffs from this character.
    • getEffectiveStats

      public StatsContainer 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.

      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

      public StatsContainer 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.

      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

      public void captureSnapshot(double currentTime, List<Buff> extraBuffs)
      Captures and stores a stat snapshot at the given simulation time. getEffectiveStats(double) is used as the base, then any extraBuffs that have not yet expired are applied on top. The resulting container is stored and retrievable via getSnapshot().

      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 taken
      extraBuffs - additional buffs to layer on top of the effective stats; may be null
    • getSnapshot

      public StatsContainer getSnapshot()
      Returns the most recently captured stat snapshot. If no snapshot has been captured yet, returns an empty StatsContainer.
      戻り値:
      snapshot stats, never null
    • onAction

      public void onAction(String key, CombatSimulator sim)
      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 string
      sim - the active combat simulator
    • onSwitchOut

      public void onSwitchOut(CombatSimulator sim)
      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

      public Element 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 at getEnergyCost(), and accumulates it in the total energy-gained counter.

      Prefer receiveParticleEnergy(double, double) or receiveFlatEnergy(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. Records baseAmount (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 via receiveEnergy(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 to receiveEnergy(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. Sets currentEnergy to getEnergyCost() so that the first burst of a rotation can be used immediately.
    • setArtifactRolls

      public void setArtifactRolls(Map<StatType,Integer> rolls)
      Stores the artifact substat roll distribution used by the optimizer.
      パラメータ:
      rolls - map from StatType to number of rolls allocated
    • getArtifactRolls

      public Map<StatType,Integer> 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)
      Returns true if the elemental skill is available at the given simulation time (i.e. no remaining cooldown / a charge is available).
      パラメータ:
      currentTime - simulation time in seconds
      戻り値:
      true if the skill can be used
    • canBurst

      public boolean canBurst(double currentTime)
      Returns true if 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
      戻り値:
      true if the burst can be used
    • isBurstActive

      public boolean isBurstActive(double currentTime)
      Returns true if the character's burst is currently in an active state (providing on-field buffs or dealing DoT damage). Default implementation always returns false; override in subclasses that have persistent burst effects.
      パラメータ:
      currentTime - simulation time in seconds
      戻り値:
      true if the burst is active
    • getSkillCDRemaining

      public double getSkillCDRemaining(double currentTime)
      Returns the remaining elemental skill cooldown in seconds, or 0 if 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, 0 if ready
    • getBurstCDRemaining

      public double getBurstCDRemaining(double currentTime)
      Returns the remaining elemental burst cooldown in seconds, or 0 if the burst cooldown has elapsed (energy requirement is checked separately by canBurst(double)).
      パラメータ:
      currentTime - simulation time in seconds
      戻り値:
      seconds remaining on cooldown, 0 if the timer has expired
    • markSkillUsed

      public void markSkillUsed(double currentTime)
      Records that the elemental skill was used at currentTime. For charge-based skills, a new charge-restore timestamp is appended and the list is kept sorted. Always updates lastSkillTime.
      パラメータ:
      currentTime - simulation time in seconds
    • markBurstUsed

      public void markBurstUsed(double currentTime)
      Records that the elemental burst was used at currentTime. Snapshots the current window's particle and flat energy into getBurstEnergyWindows() for ER requirement analysis, resets the per-window counters, drains the energy gauge to zero, and updates lastBurstTime.
      パラメータ:
      currentTime - simulation time in seconds
    • getBurstEnergyWindows

      public List<double[]> getBurstEnergyWindows()
      Returns the list of per-burst-window energy records. Each element is a double[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()
      Returns true if this character is a Lunar character. Lunar characters receive special synergy buffs from non-Lunar teammates (Moonsign / Ascendant Blessing mechanics) and may interact with LUNAR_* stat types in StatType. Default implementation returns false; override in Lunar character subclasses.
      戻り値:
      true if this is a Lunar character
    • getTeamBuffs

      public List<Buff> 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 use getStructuralStats(double) internally to avoid recursive stat lookups. Default implementation returns an empty list.
      戻り値:
      list of team buffs granted by this character