Skip to content

Commit

Permalink
feat: Add 4.6 artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
wormtql committed Apr 19, 2024
1 parent d593ebf commit 46c629c
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mona_core/src/artifacts/artifact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ pub enum ArtifactSetName {
WanderersTroupe,
SongOfDaysPast,
NighttimeWhispersInTheEchoingWoods,
FragmentOfHarmonicWhimsy,
UnfinishedReverie,
}

impl ArtifactSetName {
Expand Down
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 @@ -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)]
Expand Down Expand Up @@ -244,6 +246,8 @@ pub struct ArtifactConfigInterface {
pub config_golden_troupe: Option<ConfigRate>,
pub config_song_of_days_past: Option<ConfigSongOfDaysPast>,
pub config_nighttime_whispers_in_the_echoing_woods: Option<ConfigNighttimeWhispersInTheEchoingWoods>,
pub config_fragment_of_harmonic_whimsy: Option<ConfigLevel>,
pub config_unfinished_reverie: Option<ConfigRate>,
}

impl ArtifactConfigInterface {
Expand Down Expand Up @@ -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(),
}
}
}
Expand Down
77 changes: 77 additions & 0 deletions mona_core/src/artifacts/effects/fragment_of_harmonic_whimsy.rs
Original file line number Diff line number Diff line change
@@ -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<A: Attribute> ArtifactEffect<A> 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<A: Attribute>(config: &ArtifactEffectConfig, character_common_data: &CharacterCommonData) -> Box<dyn ArtifactEffect<A>> {
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 }
}
]);
}
4 changes: 4 additions & 0 deletions mona_core/src/artifacts/effects/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<T: Attribute>(name: ArtifactSetName, config: &ArtifactEffectConfig, character: &Character<T>) -> Box<dyn ArtifactEffect<T>> {
name.create_effect(config, &character.common_data)
Expand Down
70 changes: 70 additions & 0 deletions mona_core/src/artifacts/effects/unfinished_reverie.rs
Original file line number Diff line number Diff line change
@@ -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<A: Attribute> ArtifactEffect<A> 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<A: Attribute>(config: &ArtifactEffectConfig, character_common_data: &CharacterCommonData) -> Box<dyn ArtifactEffect<A>> {
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 }
}
]);
}

0 comments on commit 46c629c

Please sign in to comment.