パッケージ model.stats

クラス StatsContainer

java.lang.Object
model.stats.StatsContainer

public class StatsContainer extends Object
A container that holds numeric values for each StatType.

All stats are stored as raw doubles keyed by StatType. Values default to 0.0 when absent. The container is intentionally simple: no layered base/percent separation is performed here — callers use the composite helper methods (getTotalAtk(), etc.) to resolve final values from the stored base, percent, and flat components.

Instances are not thread-safe and are expected to be used within a single simulation thread.

  • コンストラクタの概要

    コンストラクタ
    コンストラクタ
    説明
     
  • メソッドの概要

    修飾子とタイプ
    メソッド
    説明
    void
    add(StatType type, double value)
    Adds value to the current value of type, initialising it to 0.0 first if absent.
    void
    Iterates over all entries in this container, invoking action for each (StatType, Double) pair that has been explicitly set or added.
    double
    get(StatType type)
    Returns the stored value for type, or 0.0 if no value has been recorded.
    double
    Computes and returns the final ATK value using the standard Genshin formula: BASE_ATK * (1 + ATK_PERCENT) + ATK_FLAT.
    double
    Computes and returns the final DEF value: BASE_DEF * (1 + DEF_PERCENT) + DEF_FLAT.
    double
    Computes and returns the final HP value: BASE_HP * (1 + HP_PERCENT) + HP_FLAT.
    Creates and returns a new StatsContainer whose values are the element-wise sum of this container and other.
    void
    set(StatType type, double value)
    Overwrites the stored value for type with value, regardless of any previously accumulated value.

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

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • コンストラクタの詳細

    • StatsContainer

      public StatsContainer()
  • メソッドの詳細

    • add

      public void add(StatType type, double value)
      Adds value to the current value of type, initialising it to 0.0 first if absent. Use this method when multiple sources contribute to the same stat (e.g. different artifact pieces).
      パラメータ:
      type - the stat to modify
      value - amount to add (may be negative)
    • set

      public void set(StatType type, double value)
      Overwrites the stored value for type with value, regardless of any previously accumulated value. Use this for stats that should not stack (e.g. base stats set once from the character CSV).
      パラメータ:
      type - the stat to overwrite
      value - new value to store
    • get

      public double get(StatType type)
      Returns the stored value for type, or 0.0 if no value has been recorded.
      パラメータ:
      type - stat to retrieve
      戻り値:
      stored value, or 0.0
    • getTotalAtk

      public double getTotalAtk()
      Computes and returns the final ATK value using the standard Genshin formula: BASE_ATK * (1 + ATK_PERCENT) + ATK_FLAT.
      戻り値:
      total ATK
    • getTotalHp

      public double getTotalHp()
      Computes and returns the final HP value: BASE_HP * (1 + HP_PERCENT) + HP_FLAT.
      戻り値:
      total HP
    • getTotalDef

      public double getTotalDef()
      Computes and returns the final DEF value: BASE_DEF * (1 + DEF_PERCENT) + DEF_FLAT.
      戻り値:
      total DEF
    • merge

      public StatsContainer merge(StatsContainer other)
      Creates and returns a new StatsContainer whose values are the element-wise sum of this container and other. Neither operand is modified. If other is null a copy of this container is returned.
      パラメータ:
      other - container to add; may be null
      戻り値:
      new container with merged values
    • forEach

      public void forEach(BiConsumer<StatType,Double> action)
      Iterates over all entries in this container, invoking action for each (StatType, Double) pair that has been explicitly set or added.
      パラメータ:
      action - callback to invoke for each entry