Expand description
§genshin-calc-core
Damage and elemental reaction calculation engine for Genshin Impact.
§Calculation Pipelines
| Pipeline | Function | Reactions |
|---|---|---|
| Standard | calculate_damage | Amplifying (vaporize/melt), Catalyze (spread/aggravate), or none |
| Transformative | calculate_transformative | Overloaded, superconduct, electro-charged, swirl, bloom, etc. |
| Lunar | calculate_lunar | Lunar electro-charged, lunar bloom, lunar crystallize |
Standard damage passes through ATK/HP/DEF scaling, crit, defense, and resistance. Transformative damage scales with character level and elemental mastery only (no crit, no defense). Lunar damage scales like transformative but can crit.
§Team Composition
Build teams with TeamMember and resolve buffs with resolve_team_stats:
use genshin_calc_core::*;
let dps = TeamMember {
element: Element::Pyro,
weapon_type: WeaponType::Claymore,
stats: StatProfile {
base_atk: 900.0,
crit_rate: 0.60,
crit_dmg: 1.50,
energy_recharge: 1.0,
..Default::default()
},
buffs_provided: vec![],
is_moonsign: false,
can_nightsoul: false,
};
let support = TeamMember {
element: Element::Pyro,
weapon_type: WeaponType::Sword,
stats: StatProfile {
base_atk: 800.0,
energy_recharge: 1.0,
..Default::default()
},
buffs_provided: vec![ResolvedBuff {
source: "Bennett Burst".into(),
stat: BuffableStat::AtkFlat,
value: 1000.0,
target: BuffTarget::Team,
origin: None,
}],
is_moonsign: false,
can_nightsoul: false,
};
let result = resolve_team_stats(&[dps, support], 0, &[]).unwrap();
assert!(result.final_stats.atk > 900.0); // DPS gets Bennett's ATK buff§Example
use genshin_calc_core::*;
let input = DamageInput {
character_level: 90,
stats: Stats {
atk: 2000.0,
crit_rate: 0.75,
crit_dmg: 1.50,
dmg_bonus: 0.466,
..Default::default()
},
talent_multiplier: 1.76,
scaling_stat: ScalingStat::Atk,
damage_type: DamageType::Skill,
element: Some(Element::Pyro),
reaction: None,
reaction_bonus: 0.0,
flat_dmg: 0.0,
};
let enemy = Enemy {
level: 90,
resistance: 0.10,
def_reduction: 0.0,
def_ignore: 0.0,
};
let result = calculate_damage(&input, &enemy).unwrap();
assert!(result.average > 0.0);Re-exports§
pub use buff_types::BuffableStat;pub use damage::DamageInput;pub use damage::DamageResult;pub use damage::calculate_damage;pub use damage::collect_flat_dmg;pub use em::amplifying_em_bonus;pub use em::catalyze_em_bonus;pub use em::lunar_em_bonus;pub use em::transformative_em_bonus;pub use enemy::Enemy;pub use enemy::EnemyDebuffs;pub use enemy::apply_debuffs_to_enemy;pub use enemy::apply_enemy_debuffs;pub use enemy::superconduct_debuff;pub use error::CalcError;pub use level_table::reaction_base_value;pub use lunar::LunarInput;pub use lunar::LunarResult;pub use lunar::calculate_lunar;pub use moonsign::LunarContribution;pub use moonsign::MoonsignBenediction;pub use moonsign::MoonsignContext;pub use moonsign::MoonsignLevel;pub use moonsign::MoonsignTalentEffect;pub use moonsign::MoonsignTalentEnhancement;pub use moonsign::NonMoonsignLunarBuff;pub use moonsign::apply_moonsign_enhancements;pub use moonsign::calculate_lunar_team;pub use moonsign::calculate_non_moonsign_bonus;pub use moonsign::determine_moonsign_level;pub use moonsign::non_moonsign_scaling;pub use moonsign::resolve_moonsign_context;pub use moonsign::select_non_moonsign_buff;pub use reaction::Reaction;pub use reaction::ReactionCategory;pub use reaction::determine_reaction;pub use resonance::ElementalResonance;pub use resonance::determine_resonances;pub use resonance::resonance_buffs;pub use resonance::resonance_conditional_buffs;pub use stat_profile::StatProfile;pub use stat_profile::combine_stats;pub use stats::Stats;pub use team::BuffTarget;pub use team::DamageContext;pub use team::ResolvedBuff;pub use team::TeamMember;pub use team::TeamResolveResult;pub use team::apply_buffs_to_profile;pub use team::resolve_team_stats;pub use team::resolve_team_stats_detailed;pub use transformative::TransformativeInput;pub use transformative::TransformativeResult;pub use transformative::calculate_transformative;pub use types::DamageType;pub use types::Element;pub use types::ScalingStat;pub use types::WeaponType;
Modules§
- buff_
types - Buffable stat types for team buffs.
- damage
- Standard damage calculation pipeline.
- em
- Elemental mastery bonus formulas.
- enemy
- Enemy parameters and debuff application.
- error
- Error types for calculation failures.
- level_
table - Character level to reaction base value table.
- lunar
- Lunar reaction damage calculation pipeline.
- moonsign
- Moonsign character system types and calculations.
- reaction
- Elemental reaction types and properties.
- resonance
- Elemental resonance system.
- stat_
profile - Stat profile (base/percent/flat breakdown) and combination.
- stats
- Final combined character stats.
- team
- Team composition and buff resolution.
- transformative
- Transformative reaction damage calculation pipeline.
- types
- Core type enums: Element, DamageType, ScalingStat, WeaponType.