Skip to content

Commit

Permalink
feat: Add 4.3 new artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
wormtql committed Dec 18, 2023
1 parent f1ae502 commit ceb7eff
Show file tree
Hide file tree
Showing 5 changed files with 222 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 @@ -70,6 +70,8 @@ pub enum ArtifactSetName {
ViridescentVenerer,
VourukashasGlow,
WanderersTroupe,
SongOfDaysPast,
NighttimeWhispersInTheEchoingWoods,
}

impl ArtifactSetName {
Expand Down
20 changes: 20 additions & 0 deletions mona_core/src/artifacts/effect_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,20 @@ pub struct ConfigMarechausseeHunter {
pub stack: f64,
}

#[derive(Serialize, Deserialize)]
#[derive(Debug, Clone, Default)]
pub struct ConfigSongOfDaysPast {
pub regeneration: f64,
pub rate: f64,
}

#[derive(Serialize, Deserialize)]
#[derive(Debug, Clone, Default)]
pub struct ConfigNighttimeWhispersInTheEchoingWoods {
pub rate1: f64,
pub rate2: f64,
}

#[derive(Default, Debug, Clone)]
#[derive(Serialize, Deserialize)]
pub struct ArtifactEffectConfig {
Expand Down Expand Up @@ -194,6 +208,8 @@ pub struct ArtifactEffectConfig {
pub config_vourukashas_glow: ConfigVourukashasGlow,
pub config_marechaussee_hunter: ConfigMarechausseeHunter,
pub config_golden_troupe: ConfigRate,
pub config_song_of_days_past: ConfigSongOfDaysPast,
pub config_nighttime_whispers_in_the_echoing_woods: ConfigNighttimeWhispersInTheEchoingWoods,
}

#[derive(Serialize, Deserialize)]
Expand Down Expand Up @@ -226,6 +242,8 @@ pub struct ArtifactConfigInterface {
pub config_vourukashas_glow: Option<ConfigVourukashasGlow>,
pub config_marechaussee_hunter: Option<ConfigMarechausseeHunter>,
pub config_golden_troupe: Option<ConfigRate>,
pub config_song_of_days_past: Option<ConfigSongOfDaysPast>,
pub config_nighttime_whispers_in_the_echoing_woods: Option<ConfigNighttimeWhispersInTheEchoingWoods>,
}

impl ArtifactConfigInterface {
Expand Down Expand Up @@ -258,6 +276,8 @@ impl ArtifactConfigInterface {
config_vourukashas_glow: self.config_vourukashas_glow.unwrap_or(Default::default()),
config_marechaussee_hunter: self.config_marechaussee_hunter.unwrap_or(Default::default()),
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()),
}
}
}
Expand Down
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 @@ -52,6 +52,8 @@ pub use nymphs_dream::NymphsDream;
pub use vourukashas_glow::VourukashasGlow;
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 mod empty;
pub mod adventurer;
Expand Down Expand Up @@ -101,6 +103,8 @@ pub mod nymphs_dream;
pub mod vourukashas_glow;
pub mod marechaussee_hunter;
pub mod golden_troupe;
pub mod song_of_days_past;
pub mod nighttime_whispers_in_the_echoing_woods;

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
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
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 NighttimeWhispersInTheEchoingWoodsEffect {
pub rate1: f64,
pub rate2: f64,
}

impl<A: Attribute> ArtifactEffect<A> for NighttimeWhispersInTheEchoingWoodsEffect {
fn effect2(&self, attribute: &mut A) {
attribute.add_atk_percentage("回声之林夜话2", 0.18);
}

fn effect4(&self, attribute: &mut A) {
let bonus = self.rate1 * (0.2 + 0.3 * self.rate2);
attribute.set_value_by(AttributeName::BonusGeo, "回声之林夜话4", bonus);
}
}

pub struct NighttimeWhispersInTheEchoingWoods;

impl ArtifactTrait for NighttimeWhispersInTheEchoingWoods {
fn create_effect<A: Attribute>(config: &ArtifactEffectConfig, character_common_data: &CharacterCommonData) -> Box<dyn ArtifactEffect<A>> {
Box::new(NighttimeWhispersInTheEchoingWoodsEffect {
rate1: config.config_nighttime_whispers_in_the_echoing_woods.rate1,
rate2: config.config_nighttime_whispers_in_the_echoing_woods.rate2
})
}

#[cfg(not(target_family = "wasm"))]
const META_DATA: ArtifactMetaData = ArtifactMetaData {
name: ArtifactSetName::NighttimeWhispersInTheEchoingWoods,
name_mona: "NighttimeWhispersInTheEchoingWoods",
name_locale: locale!(
zh_cn: "回声之林夜话",
en: "Nighttime Whispers in the Echoing Woods"
),
flower: Some(locale!(
zh_cn: "无私的妆饰花",
en: "Selfless Floral Accessory"
)),
feather: Some(locale!(
zh_cn: "诚恳的蘸水笔",
en: "Honest Quill"
)),
sand: Some(locale!(
zh_cn: "忠实的砂时计",
en: "Faithful Hourglass"
)),
goblet: Some(locale!(
zh_cn: "慷慨的墨水瓶",
en: "Magnanimous Ink Bottle"
)),
head: Some(locale!(
zh_cn: "慈爱的淑女帽",
en: "Compassionate Ladies' Hat"
)),
star: (4, 5),
effect1: None,
effect2: Some(locale!(
zh_cn: "攻击力提高18%。",
en: "ATK +18%."
)),
effect3: None,
effect4: Some(locale!(
zh_cn: "施放元素战技后的10秒内,岩元素伤害加成提升20%;若处于结晶反应产生的护盾庇护下,上述效果提高150%,进一步提高的效果将在失去结晶护盾庇护的1秒后移除。",
en: "After using an Elemental Skill, gain a 20% Geo DMG Bonus for 10s. While under a shield granted by the Crystallize reaction, the above effect will be increased by 150%, and this additional increase disappears 1s after that shield is lost."
)),
effect5: None,
internal_id: 15034
};

#[cfg(not(target_family = "wasm"))]
const CONFIG4: Option<&'static [ItemConfig]> = Some(&[
ItemConfig {
name: "rate1",
title: locale!(
zh_cn: "总被动比例",
en: "Ratio1"
),
config: ItemConfigType::Float { min: 0.0, max: 1.0, default: 0.0 }
},
ItemConfig {
name: "rate2",
title: locale!(
zh_cn: "护盾比例",
en: "Shield Ratio",
),
config: ItemConfigType::Float { min: 0.0, max: 1.0, default: 0.0 }
}
]);
}
98 changes: 98 additions & 0 deletions mona_core/src/artifacts/effects/song_of_days_past.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
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, AttributeName};
use crate::character::character_common_data::CharacterCommonData;
use crate::common::i18n::locale;
use crate::common::item_config_type::{ItemConfig, ItemConfigType};

pub struct SongOfDaysPastEffect {
pub rate: f64,
pub regeneration: f64,
}

impl<A: Attribute> ArtifactEffect<A> for SongOfDaysPastEffect {
fn effect2(&self, attribute: &mut A) {
attribute.set_value_by(AttributeName::HealingBonus, "昔时之歌2", 0.15);
}

fn effect4(&self, attribute: &mut A) {
let amount = self.regeneration as f64 * 0.08 * self.rate;
attribute.set_value_by(AttributeName::ExtraDmgBase, "昔时之歌4", amount);
}
}

pub struct SongOfDaysPast;

impl ArtifactTrait for SongOfDaysPast {
fn create_effect<A: Attribute>(config: &ArtifactEffectConfig, character_common_data: &CharacterCommonData) -> Box<dyn ArtifactEffect<A>> {
Box::new(SongOfDaysPastEffect {
regeneration: config.config_song_of_days_past.regeneration,
rate: config.config_song_of_days_past.rate
})
}

#[cfg(not(target_family = "wasm"))]
const META_DATA: ArtifactMetaData = ArtifactMetaData {
name: ArtifactSetName::SongOfDaysPast,
name_mona: "SongOfDaysPast",
name_locale: locale!(
zh_cn: "昔时之歌",
en: "Song of Days Past"
),
flower: Some(locale!(
zh_cn: "昔时遗落之誓",
en: "Forgotten Oath of Days Past"
)),
feather: Some(locale!(
zh_cn: "昔时浮想之思",
en: "Recollection of Days Past"
)),
sand: Some(locale!(
zh_cn: "昔时回映之音",
en: "Echoing Sound From Days Past"
)),
goblet: Some(locale!(
zh_cn: "昔时应许之梦",
en: "Promised Dream of Days Past"
)),
head: Some(locale!(
zh_cn: "昔时传奏之诗",
en: "Poetry of Days Past"
)),
star: (4, 5),
effect1: None,
effect2: Some(locale!(
zh_cn: "治疗加成提高15%。",
en: "Healing Bonus +15%."
)),
effect3: None,
effect4: Some(locale!(
zh_cn: "装备者对队伍中的角色进行治疗时,将产生持续6秒的渴盼效果,记录治疗的生命值回复量(包括溢出值)。持续时间结束时,渴盼效果将转变为「彼时的浪潮」效果:队伍中自己的当前场上角色的普通攻击、重击、下落攻击、元素战技与元素爆发命中敌人时,将基于渴盼效果所记录的回复量的8%提高造成的伤害,「彼时的浪潮」将在生效5次或10秒后移除。一次渴盼效果至多记录15000点回复量,同时至多存在一个,能够记录多个装备者的产生的回复量;装备者处于队伍后台时,依然能触发该效果。",
en: "When the equipping character heals a party member, the Yearning effect will be created for 6s, which records the total amount of healing provided (including overflow healing). When the duration expires, the Yearning effect will be transformed into the \"Waves of Days Past\" effect: When your active party member hits an opponent with a Normal Attack, Charged Attack, Plunging Attack, Elemental Skill, or Elemental Burst, the DMG dealt will be increased by 8% of the total healing amount recorded by the Yearning effect. The \"Waves of Days Past\" effect is removed after it has taken effect 5 times or after 10s. A single instance of the Yearning effect can record up to 15,000 healing, and only a single instance can exist at once, but it can record the healing from multiple equipping characters. Equipping characters on standby can still trigger this effect."
)),
effect5: None,
internal_id: 15033
};

#[cfg(not(target_family = "wasm"))]
const CONFIG4: Option<&'static [ItemConfig]> = Some(&[
ItemConfig {
name: "regeneration",
title: locale!(
zh_cn: "生命值回复量",
en: "HP Regeneration"
),
config: ItemConfigType::Int { min: 0, max: 15000, default: 0 },
},
ItemConfig {
name: "rate",
title: locale!(
zh_cn: "被动应用比例",
en: "Average Ratio"
),
config: ItemConfigType::Float { min: 0.0, max: 1.0, default: 0.0 }
}
]);
}

0 comments on commit ceb7eff

Please sign in to comment.