From 46c629cc06238cd21bb627d88a4186066b50123f Mon Sep 17 00:00:00 2001 From: wormtql <584130248@qq.com> Date: Sat, 20 Apr 2024 00:04:25 +0800 Subject: [PATCH] feat: Add 4.6 artifacts --- mona_core/src/artifacts/artifact.rs | 2 + mona_core/src/artifacts/effect_config.rs | 6 ++ .../effects/fragment_of_harmonic_whimsy.rs | 77 +++++++++++++++++++ mona_core/src/artifacts/effects/mod.rs | 4 + .../artifacts/effects/unfinished_reverie.rs | 70 +++++++++++++++++ 5 files changed, 159 insertions(+) create mode 100644 mona_core/src/artifacts/effects/fragment_of_harmonic_whimsy.rs create mode 100644 mona_core/src/artifacts/effects/unfinished_reverie.rs diff --git a/mona_core/src/artifacts/artifact.rs b/mona_core/src/artifacts/artifact.rs index a697c25a..1320781d 100644 --- a/mona_core/src/artifacts/artifact.rs +++ b/mona_core/src/artifacts/artifact.rs @@ -72,6 +72,8 @@ pub enum ArtifactSetName { WanderersTroupe, SongOfDaysPast, NighttimeWhispersInTheEchoingWoods, + FragmentOfHarmonicWhimsy, + UnfinishedReverie, } impl ArtifactSetName { diff --git a/mona_core/src/artifacts/effect_config.rs b/mona_core/src/artifacts/effect_config.rs index 1193f448..1e123732 100644 --- a/mona_core/src/artifacts/effect_config.rs +++ b/mona_core/src/artifacts/effect_config.rs @@ -210,6 +210,8 @@ pub struct ArtifactEffectConfig { pub config_golden_troupe: ConfigRate, pub config_song_of_days_past: ConfigSongOfDaysPast, pub config_nighttime_whispers_in_the_echoing_woods: ConfigNighttimeWhispersInTheEchoingWoods, + pub config_fragment_of_harmonic_whimsy: ConfigLevel, + pub config_unfinished_reverie: ConfigRate, } #[derive(Serialize, Deserialize)] @@ -244,6 +246,8 @@ pub struct ArtifactConfigInterface { pub config_golden_troupe: Option, pub config_song_of_days_past: Option, pub config_nighttime_whispers_in_the_echoing_woods: Option, + pub config_fragment_of_harmonic_whimsy: Option, + pub config_unfinished_reverie: Option, } impl ArtifactConfigInterface { @@ -278,6 +282,8 @@ impl ArtifactConfigInterface { config_golden_troupe: self.config_golden_troupe.unwrap_or(Default::default()), config_song_of_days_past: self.config_song_of_days_past.unwrap_or(Default::default()), config_nighttime_whispers_in_the_echoing_woods: self.config_nighttime_whispers_in_the_echoing_woods.unwrap_or(Default::default()), + config_fragment_of_harmonic_whimsy: self.config_fragment_of_harmonic_whimsy.unwrap_or_default(), + config_unfinished_reverie: self.config_unfinished_reverie.unwrap_or_default(), } } } diff --git a/mona_core/src/artifacts/effects/fragment_of_harmonic_whimsy.rs b/mona_core/src/artifacts/effects/fragment_of_harmonic_whimsy.rs new file mode 100644 index 00000000..99fa00bc --- /dev/null +++ b/mona_core/src/artifacts/effects/fragment_of_harmonic_whimsy.rs @@ -0,0 +1,77 @@ +use crate::artifacts::artifact_trait::{ArtifactMetaData, ArtifactTrait}; +use crate::artifacts::ArtifactSetName; +use crate::artifacts::effect::ArtifactEffect; +use crate::artifacts::effect_config::ArtifactEffectConfig; +use crate::attribute::{Attribute, AttributeCommon, AttributeName}; +use crate::character::character_common_data::CharacterCommonData; +use crate::common::i18n::locale; +use crate::common::item_config_type::{ItemConfig, ItemConfigType}; + +pub struct FragmentOfHarmonicWhimsyEffect { + pub stack: f64, +} + +impl ArtifactEffect for FragmentOfHarmonicWhimsyEffect { + fn effect2(&self, attribute: &mut A) { + attribute.add_atk_percentage("谐律异想断章2", 0.18); + } + + fn effect4(&self, attribute: &mut A) { + let bonus = self.stack * 0.18; + attribute.set_value_by(AttributeName::BonusBase, "谐律异想断章4", bonus); + } +} + +pub struct FragmentOfHarmonicWhimsy; + +impl ArtifactTrait for FragmentOfHarmonicWhimsy { + fn create_effect(config: &ArtifactEffectConfig, character_common_data: &CharacterCommonData) -> Box> { + let stack = config.config_fragment_of_harmonic_whimsy.level; + Box::new(FragmentOfHarmonicWhimsyEffect { + stack + }) + } + + #[cfg(not(target_family = "wasm"))] + const META_DATA: ArtifactMetaData = ArtifactMetaData { + name: ArtifactSetName::FragmentOfHarmonicWhimsy, + name_mona: "FragmentOfHarmonicWhimsy", + name_locale: locale!( + zh_cn: "谐律异想断章", + en: "Fragment of Harmonic Whimsy" + ), + flower: Some(locale!( + zh_cn: "谐律交响的前奏", + en: "Harmonious Symphony Prelude" + )), + feather: Some(locale!(zh_cn: "古海玄幽的夜想", en: "Ancient Sea's Nocturnal Musing")), + sand: Some(locale!(zh_cn: "命途轮转的谐谑", en: "The Grand Jape of the Turning of Fate")), + goblet: Some(locale!(zh_cn: "灵露倾洒的狂诗", en: "Ichor Shower Rhapsody")), + head: Some(locale!(zh_cn: "异想零落的圆舞", en: "Whimsical Dance of the Withered")), + star: (4, 5), + effect1: None, + effect2: Some(locale!( + zh_cn: "攻击力提高18%。", + en: "ATK +18%" + )), + effect3: None, + effect4: Some(locale!( + zh_cn: "生命之契的数值提升或降低时,角色造成的伤害提升18%,该效果持续6秒,至多叠加3次。", + en: "When the value of a Bond of Life increases or decreases, this character deals 18% increased DMG for 6s. Max 3 stacks." + )), + effect5: None, + internal_id: 15035, // todo + }; + + #[cfg(not(target_family = "wasm"))] + const CONFIG4: Option<&'static [ItemConfig]> = Some(&[ + ItemConfig { + name: "level", + title: locale!( + zh_cn: "被动层数", + en: "Stack" + ), + config: ItemConfigType::Float { min: 0.0, max: 3.0, default: 0.0 } + } + ]); +} diff --git a/mona_core/src/artifacts/effects/mod.rs b/mona_core/src/artifacts/effects/mod.rs index a20725db..34a35846 100644 --- a/mona_core/src/artifacts/effects/mod.rs +++ b/mona_core/src/artifacts/effects/mod.rs @@ -54,6 +54,8 @@ pub use marechaussee_hunter::MarechausseeHunter; pub use golden_troupe::GoldenTroupe; pub use song_of_days_past::SongOfDaysPast; pub use nighttime_whispers_in_the_echoing_woods::NighttimeWhispersInTheEchoingWoods; +pub use fragment_of_harmonic_whimsy::FragmentOfHarmonicWhimsy; +pub use unfinished_reverie::UnfinishedReverie; pub mod empty; pub mod adventurer; @@ -105,6 +107,8 @@ pub mod marechaussee_hunter; pub mod golden_troupe; pub mod song_of_days_past; pub mod nighttime_whispers_in_the_echoing_woods; +pub mod fragment_of_harmonic_whimsy; +pub mod unfinished_reverie; pub fn get_effect(name: ArtifactSetName, config: &ArtifactEffectConfig, character: &Character) -> Box> { name.create_effect(config, &character.common_data) diff --git a/mona_core/src/artifacts/effects/unfinished_reverie.rs b/mona_core/src/artifacts/effects/unfinished_reverie.rs new file mode 100644 index 00000000..a44e7cb3 --- /dev/null +++ b/mona_core/src/artifacts/effects/unfinished_reverie.rs @@ -0,0 +1,70 @@ +use crate::artifacts::artifact_trait::{ArtifactMetaData, ArtifactTrait}; +use crate::artifacts::ArtifactSetName; +use crate::artifacts::effect::ArtifactEffect; +use crate::artifacts::effect_config::ArtifactEffectConfig; +use crate::attribute::{Attribute, AttributeCommon, AttributeName}; +use crate::character::character_common_data::CharacterCommonData; +use crate::common::i18n::locale; +use crate::common::item_config_type::{ItemConfig, ItemConfigType}; + +pub struct UnfinishedReverieEffect { + pub rate: f64, +} + +impl ArtifactEffect for UnfinishedReverieEffect { + fn effect2(&self, attribute: &mut A) { + attribute.add_atk_percentage("未竟的遐思2", 0.18); + } + + fn effect4(&self, attribute: &mut A) { + let bonus = 0.5 * self.rate; + attribute.set_value_by(AttributeName::BonusBase, "未竟的遐思4", bonus); + } +} + +pub struct UnfinishedReverie; + +impl ArtifactTrait for UnfinishedReverie { + fn create_effect(config: &ArtifactEffectConfig, character_common_data: &CharacterCommonData) -> Box> { + Box::new(UnfinishedReverieEffect { + rate: config.config_unfinished_reverie.rate + }) + } + + #[cfg(not(target_family = "wasm"))] + const META_DATA: ArtifactMetaData = ArtifactMetaData { + name: ArtifactSetName::UnfinishedReverie, + name_mona: "UnfinishedReverie", + name_locale: locale!(zh_cn: "未竟的遐思", en: "Unfinished Reverie"), + flower: Some(locale!(zh_cn: "暗结的明花", en: "Dark Fruit of Bright Flowers")), + feather: Some(locale!(zh_cn: "褪光的翠尾", en: "Faded Emerald Tail")), + sand: Some(locale!(zh_cn: "举业的识刻", en: "Moment of Attainment")), + goblet: Some(locale!(zh_cn: "筹谋的共樽", en: "The Wine-Flask Over Which the Plan Was Hatched")), + head: Some(locale!(zh_cn: "失冕的宝冠", en: "Crownless Crown")), + star: (4, 5), + effect1: None, + effect2: Some(locale!( + zh_cn: "攻击力提高18%。", + en: "ATK +18%" + )), + effect3: None, + effect4: Some(locale!( + zh_cn: "脱离战斗状态3秒后,造成的伤害提升50%。在战斗状态下,附近不存在处于燃烧状态下的敌人超过6秒后,上述伤害提升效果每秒降低10%,直到降低至0%;存在处于燃烧状态下的敌人时,每秒提升10%,直到达到50%。装备此圣遗物套装的角色处于队伍后台时,依然会触发该效果。", + en: "After leaving combat for 3s, DMG dealt increased by 50%. In combat, if no Burning opponents are nearby for more than 6s, this DMG Bonus will decrease by 10% per second until it reaches 0%. When a Burning opponent exists, it will increase by 10% instead until it reaches 50%. This effect still triggers if the equipping character is off-field." + )), + effect5: None, + internal_id: 15036, + }; + + #[cfg(not(target_family = "wasm"))] + const CONFIG4: Option<&'static [ItemConfig]> = Some(&[ + ItemConfig { + name: "rate", + title: locale!( + zh_cn: "被动比例", + en: "Effect Ratio" + ), + config: ItemConfigType::Float { min: 0.0, max: 1.0, default: 0.0 } + } + ]); +}