パッケージ model.stats
クラス StatsContainer
java.lang.Object
model.stats.StatsContainer
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.
-
コンストラクタの概要
コンストラクタ -
メソッドの概要
修飾子とタイプメソッド説明voidAddsvalueto the current value oftype, initialising it to0.0first if absent.voidforEach(BiConsumer<StatType, Double> action) Iterates over all entries in this container, invokingactionfor each (StatType, Double) pair that has been explicitly set or added.doubleReturns the stored value fortype, or0.0if no value has been recorded.doubleComputes and returns the final ATK value using the standard Genshin formula:BASE_ATK * (1 + ATK_PERCENT) + ATK_FLAT.doubleComputes and returns the final DEF value:BASE_DEF * (1 + DEF_PERCENT) + DEF_FLAT.doubleComputes and returns the final HP value:BASE_HP * (1 + HP_PERCENT) + HP_FLAT.merge(StatsContainer other) Creates and returns a newStatsContainerwhose values are the element-wise sum of this container andother.voidOverwrites the stored value fortypewithvalue, regardless of any previously accumulated value.
-
コンストラクタの詳細
-
StatsContainer
public StatsContainer()
-
-
メソッドの詳細
-
add
Addsvalueto the current value oftype, initialising it to0.0first if absent. Use this method when multiple sources contribute to the same stat (e.g. different artifact pieces).- パラメータ:
type- the stat to modifyvalue- amount to add (may be negative)
-
set
Overwrites the stored value fortypewithvalue, 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 overwritevalue- new value to store
-
get
Returns the stored value fortype, or0.0if 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
Creates and returns a newStatsContainerwhose values are the element-wise sum of this container andother. Neither operand is modified. Ifotherisnulla copy of this container is returned.- パラメータ:
other- container to add; may benull- 戻り値:
- new container with merged values
-
forEach
Iterates over all entries in this container, invokingactionfor each (StatType, Double) pair that has been explicitly set or added.- パラメータ:
action- callback to invoke for each entry
-