Skip to content

Commit

Permalink
Merge pull request #336 from zhykzhykzhyk/mualani_fix
Browse files Browse the repository at this point in the history
Mualani target function fixes
  • Loading branch information
wormtql authored Oct 18, 2024
2 parents bf2c577 + 523d041 commit b5a3586
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
6 changes: 6 additions & 0 deletions mona_core/src/artifacts/effect_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,4 +429,10 @@ impl ArtifactEffectConfigBuilder {
self.config.config_golden_troupe.rate = rate;
self
}

pub fn obsidian_codex(&mut self, set2_rate: f64, set4_rate: f64) -> &mut Self {
self.config.config_obsidian_codex.set2_rate = set2_rate;
self.config.config_obsidian_codex.set4_rate = set4_rate;
self
}
}
1 change: 1 addition & 0 deletions mona_core/src/target_functions/target_function_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,6 @@ pub enum TargetFunctionConfig {
DehyaDefault { melt_rate: f64, vaporize_rate: f64, e_count: usize },
MikaDefault { recharge_demand: f64, crit_demand: f64 },
WriothesleyDefault { punch_ratio: f64, melt_rate:f64 },
MualaniDefault { vaporize_rate: f64 },
NoConfig,
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,30 @@ use crate::team::TeamQuantization;
use crate::weapon::Weapon;
use crate::weapon::weapon_common_data::WeaponCommonData;

pub struct MualaniDefaultTargetFunction;
pub struct MualaniDefaultTargetFunction {
pub vaporize_rate: f64,
}

impl MualaniDefaultTargetFunction {
pub fn new(config: &TargetFunctionConfig) -> MualaniDefaultTargetFunction {
MualaniDefaultTargetFunction {
vaporize_rate: match *config {
TargetFunctionConfig::MualaniDefault { vaporize_rate } => vaporize_rate,
_ => 0.0
}
}
}
}

impl TargetFunction for MualaniDefaultTargetFunction {
fn get_target_function_opt_config(&self) -> TargetFunctionOptConfig {
unimplemented!()
}

fn get_default_artifact_config(&self, team_config: &TeamQuantization) -> ArtifactEffectConfig {
Default::default()
ArtifactEffectConfigBuilder::new()

Check failure on line 41 in mona_core/src/target_functions/target_functions/hydro/mualani_default.rs

View workflow job for this annotation

GitHub Actions / build

failed to resolve: use of undeclared type `ArtifactEffectConfigBuilder`
.obsidian_codex(1.0, 1.0)
.build()
}

fn target(&self, attribute: &SimpleAttributeGraph2, character: &Character<SimpleAttributeGraph2>, weapon: &Weapon<SimpleAttributeGraph2>, artifacts: &[&Artifact], enemy: &Enemy) -> f64 {
Expand All @@ -42,7 +57,7 @@ impl TargetFunction for MualaniDefaultTargetFunction {
Mualani::damage::<SimpleDamageBuilder>(&context, S::A_Stack4, &CharacterSkillConfig::NoConfig, None)
};

dmg.normal.expectation
dmg.normal.expectation * (1.0 - self.vaporize_rate) + dmg.vaporize.unwrap().expectation * self.vaporize_rate
}
}

Expand All @@ -63,7 +78,19 @@ impl TargetFunctionMetaTrait for MualaniDefaultTargetFunction {
image: TargetFunctionMetaImage::Avatar,
};

#[cfg(not(target_family = "wasm"))]
const CONFIG: Option<&'static [ItemConfig]> = Some(&[
ItemConfig {
name: "vaporize_rate",
title: crate::common::i18n::locale!(
zh_cn: "蒸发占比",
en: "Vaporize Ratio",
),
config: ItemConfig::RATE01_TYPE
}
]);

fn create(character: &CharacterCommonData, weapon: &WeaponCommonData, config: &TargetFunctionConfig) -> Box<dyn TargetFunction> {
Box::new(MualaniDefaultTargetFunction)
Box::new(MualaniDefaultTargetFunction(config))

Check failure on line 94 in mona_core/src/target_functions/target_functions/hydro/mualani_default.rs

View workflow job for this annotation

GitHub Actions / build

expected function, tuple struct or tuple variant, found struct `MualaniDefaultTargetFunction`
}
}

0 comments on commit b5a3586

Please sign in to comment.