パッケージ mechanics.formula
クラス DamageCalculator
java.lang.Object
mechanics.formula.DamageCalculator
Computes outgoing damage for a single attack action.
Two independent code paths are implemented inside calculateDamage(model.entity.Character, model.entity.Enemy, simulation.action.AttackAction, java.util.List<mechanics.buff.Buff>, double, double, simulation.CombatSimulator):
- Lunar path – entered when
action.isLunarConsidered()istrue. Uses the custom Lunar formula:3 * (Stat * MV) * (1 + BaseBonus + UniqueBonus) * (1 + ReactionBonus + GearBonus) * Crit * Res * ColumbinaMultiplier - Standard path – follows the official Genshin Impact formula:
(Stat * MV + FlatDmg) * (1 + DmgBonus%) * Crit * ReactionMulti * Def * Res
-
コンストラクタの概要
コンストラクタ -
メソッドの概要
修飾子とタイプメソッド説明static doublecalculateDamage(Character attacker, Enemy target, AttackAction action, List<Buff> activeBuffs, double currentTime, double reactionMultiplier, CombatSimulator sim) Calculates the final damage dealt byaction.static doublecalculateResMulti(double baseRes, double resShred) Computes the resistance damage multiplier after applying resistance shred.
-
コンストラクタの詳細
-
DamageCalculator
public DamageCalculator()
-
-
メソッドの詳細
-
calculateDamage
public static double calculateDamage(Character attacker, Enemy target, AttackAction action, List<Buff> activeBuffs, double currentTime, double reactionMultiplier, CombatSimulator sim) Calculates the final damage dealt byaction. Lunar path (action.isLunarConsidered() == true)- Resolve stats – snapshot or live, then apply active buffs.
- Base section:
3 * (statVal * MV) * (1 + LUNAR_BASE_BONUS) * (1 + LUNAR_UNIQUE_BONUS) - Reaction multiplier:
1 + (6*EM)/(EM+2000) + GearBonuseswhere gear coversLUNAR_CHARGED_DMG_BONUS,LUNAR_REACTION_DMG_BONUS_ALL, andLUNAR_MOONSIGN_BONUS. - Crit:
1 + min(CR,1) * CD - Res: via
calculateResMulti(double, double). - Columbina multiplier:
1 + LUNAR_MULTIPLIER– applied last as an independent final multiplier, scaling with(EM / 2000) * 1.5.
- Resolve stats – snapshot or live, then apply active buffs.
- Base damage:
(scalingStat * MV) + FLAT_DMG_BONUS - DMG Bonus%: sum of
DMG_BONUS_ALL, element-specific bonus, action bonus stat, and any extra bonuses attached to the action. - Crit:
1 + min(CR,1) * CD; burst/skill crit-rate overrides are added before clamping. - Reaction multiplier passed in from
CombatSimulator. - Defense: via
calculateDefMulti(int, int, double)at attacker level 90. - Resistance: via
calculateResMulti(double, double)after accumulating element-specific shred.
After computing damage on either path, weapon and artifact
onDamagehooks are fired so stacking/proc mechanics can update their internal state.- パラメータ:
attacker- the attacking charactertarget- the enemy being hitaction- the attack action containing MV, element, scaling stat, etc.activeBuffs- team and self buffs currently active (may benull)currentTime- simulation time in seconds at the moment of the hitreactionMultiplier- amplifying reaction multiplier pre-computed by the simulator (1.0 if no amplifying reaction)sim- the runningCombatSimulatorinstance- 戻り値:
- final damage value after all multipliers
-
calculateResMulti
public static double calculateResMulti(double baseRes, double resShred) Computes the resistance damage multiplier after applying resistance shred.The three-region piecewise function mirrors the official game:
finalRes < 0:1 - finalRes / 20 <= finalRes < 0.75:1 - finalResfinalRes >= 0.75:1 / (1 + 4 * finalRes)
- パラメータ:
baseRes- enemy base resistance for the relevant element (e.g. 0.10 for 10%)resShred- total resistance shred accumulated from all sources- 戻り値:
- resistance multiplier to apply to outgoing damage
-