Skip to content

Commit

Permalink
feat(4.0): Add artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
wormtql committed Aug 19, 2023
1 parent 2290552 commit 5c99ccd
Show file tree
Hide file tree
Showing 15 changed files with 2,503 additions and 2,202 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 @@ -39,12 +39,14 @@ pub enum ArtifactSetName {
DesertPavilionChronicle,
GildedDreams,
GladiatorsFinale,
GoldenTroupe,
HeartOfDepth,
HuskOfOpulentDreams,
Instructor,
Lavawalker,
LuckyDog,
MaidenBeloved,
MarechausseeHunter,
MartialArtist,
NoblesseOblige,
NymphsDream,
Expand Down
12 changes: 12 additions & 0 deletions mona_core/src/artifacts/effect_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ pub struct ConfigVourukashasGlow {
pub stack: f64,
}

#[derive(Serialize, Deserialize)]
#[derive(Debug, Clone, Default)]
pub struct ConfigMarechausseeHunter {
pub stack: f64,
}

#[derive(Default, Debug, Clone)]
#[derive(Serialize, Deserialize)]
pub struct ArtifactEffectConfig {
Expand Down Expand Up @@ -186,6 +192,8 @@ pub struct ArtifactEffectConfig {
pub config_flower_of_paradise_lost: ConfigFlowerOfParadiseLost,
pub config_nymphs_dream: ConfigNymphsDream,
pub config_vourukashas_glow: ConfigVourukashasGlow,
pub config_marechaussee_hunter: ConfigMarechausseeHunter,
pub config_golden_troupe: ConfigRate,
}

#[derive(Serialize, Deserialize)]
Expand Down Expand Up @@ -216,6 +224,8 @@ pub struct ArtifactConfigInterface {
pub config_flower_of_paradise_lost: Option<ConfigFlowerOfParadiseLost>,
pub config_nymphs_dream: Option<ConfigNymphsDream>,
pub config_vourukashas_glow: Option<ConfigVourukashasGlow>,
pub config_marechaussee_hunter: Option<ConfigMarechausseeHunter>,
pub config_golden_troupe: Option<ConfigRate>,
}

impl ArtifactConfigInterface {
Expand Down Expand Up @@ -246,6 +256,8 @@ impl ArtifactConfigInterface {
config_flower_of_paradise_lost: self.config_flower_of_paradise_lost.unwrap_or(Default::default()),
config_nymphs_dream: self.config_nymphs_dream.unwrap_or(Default::default()),
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()),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion mona_core/src/artifacts/effects/defenders_will.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl ArtifactTrait for DefendersWill {
zh_cn: "守护束带",
en: "Guardian's Band",
)),
star: (0, 0),
star: (3, 4),
effect1: None,
effect2: Some(crate::common::i18n::locale!(
zh_cn: "防御力提高30%。",
Expand Down
72 changes: 72 additions & 0 deletions mona_core/src/artifacts/effects/golden_troupe.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
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 GoldenTroupeEffect {
pub rate: f64,
}

impl<A: Attribute> ArtifactEffect<A> for GoldenTroupeEffect {
fn effect2(&self, attribute: &mut A) {
attribute.set_value_by(AttributeName::BonusElementalSkill, "黄金剧团2", 0.2);
}

fn effect4(&self, attribute: &mut A) {
attribute.set_value_by(AttributeName::BonusElementalSkill, "黄金剧团4", 0.25 + self.rate * 0.25);
}
}

pub struct GoldenTroupe;

impl ArtifactTrait for GoldenTroupe {
fn create_effect<A: Attribute>(config: &ArtifactEffectConfig, character_common_data: &CharacterCommonData) -> Box<dyn ArtifactEffect<A>> {
Box::new(GoldenTroupeEffect {
rate: config.config_golden_troupe.rate
})
}

#[cfg(not(target_family = "wasm"))]
const META_DATA: ArtifactMetaData = ArtifactMetaData {
name: ArtifactSetName::GoldenTroupe,
name_mona: "GoldenTroupe",
name_locale: locale!(
zh_cn: "黄金剧团",
en: "Golden Troupe"
),
flower: Some(locale!(zh_cn: "黄金乐曲的变奏", en: "Golden Song's Variation")),
feather: Some(locale!(zh_cn: "黄金飞鸟的落羽", en: "Golden Bird's Shedding")),
sand: Some(locale!(zh_cn: "黄金时代的先声", en: "Golden Era's Prelude")),
goblet: Some(locale!(zh_cn: "黄金之夜的喧嚣", en: "Golden Night's Bustle")),
head: Some(locale!(zh_cn: "黄金剧团的奖赏", en: "Golden Troupe's Reward")),
star: (4, 5),
effect1: None,
effect2: Some(locale!(
zh_cn: "元素战技造成的伤害提升20%。",
en: "Increases Elemental Skill DMG by 20%."
)),
effect3: None,
effect4: Some(locale!(
zh_cn: "元素战技造成的伤害提升25%;此外,处于队伍后台时,元素战技造成的伤害还将进一步提升25%,该效果将在登场后2秒移除。",
en: "Increases Elemental Skill DMG by 25%. Additionally, when not on the field, Elemental Skill DMG will be further increased by 25%. This effect will be cleared 2s after taking the field."
)),
effect5: None,
internal_id: 15032
};

#[cfg(not(target_family = "wasm"))]
const CONFIG4: Option<&'static [ItemConfig]> = Some(&[
ItemConfig {
name: "rate",
title: locale!(
zh_cn: "被动应用比例",
en: "Effect Rate"
),
config: ItemConfigType::Float { min: 0.0, max: 1.0, default: 0.0 }
}
]);
}
73 changes: 73 additions & 0 deletions mona_core/src/artifacts/effects/marechaussee_hunter.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
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 MarechausseeHunterEffect {
pub stack: f64
}

impl<A: Attribute> ArtifactEffect<A> for MarechausseeHunterEffect {
fn effect2(&self, attribute: &mut A) {
attribute.set_value_by(AttributeName::BonusNormalAttack, "逐影猎人2", 0.15);
attribute.set_value_by(AttributeName::BonusChargedAttack, "逐影猎人2", 0.15);
}

fn effect4(&self, attribute: &mut A) {
attribute.set_value_by(AttributeName::CriticalBase, "逐影猎人4", 0.12 * self.stack);
}
}

pub struct MarechausseeHunter;

impl ArtifactTrait for MarechausseeHunter {
fn create_effect<A: Attribute>(config: &ArtifactEffectConfig, character_common_data: &CharacterCommonData) -> Box<dyn ArtifactEffect<A>> {
Box::new(MarechausseeHunterEffect {
stack: config.config_marechaussee_hunter.stack
})
}

#[cfg(not(target_family = "wasm"))]
const META_DATA: ArtifactMetaData = ArtifactMetaData {
name: ArtifactSetName::MarechausseeHunter,
name_mona: "MarechausseeHunter",
name_locale: locale!(
zh_cn: "逐影猎人",
en: "Marechaussee Hunter"
),
flower: Some(locale!(zh_cn: "猎人的胸花", en: "Hunter's Brooch")),
feather: Some(locale!(zh_cn: "杰作的序曲", en: "Masterpiece's Overture")),
sand: Some(locale!(zh_cn: "裁判的时刻", en: "Moment of Judgment")),
goblet: Some(locale!(zh_cn: "遗忘的容器", en: "Forgotten Vessel")),
head: Some(locale!(zh_cn: "老兵的容颜", en: "Veteran's Visage")),
star: (4, 5),
effect1: None,
effect2: Some(locale!(
zh_cn: "普通攻击与重击造成的伤害提高15%。",
en: "Normal and Charged Attack DMG +15%"
)),
effect3: None,
effect4: Some(locale!(
zh_cn: "当前生命值提升或降低时,暴击率提升12%,该效果持续5秒,至多叠加3次。",
en: "When current HP increases or decreases, CRIT Rate will be increased by 12% for 5s. Max 3 stacks."
)),
effect5: None,
internal_id: 15031
};

#[cfg(not(target_family = "wasm"))]
const CONFIG4: Option<&'static [ItemConfig]> = Some(&[
ItemConfig {
name: "stack",
title: locale!(
zh_cn: "平均层数",
en: "Avg 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 @@ -50,6 +50,8 @@ pub use desert_pavilion_chronicle::DesertPavilionChronicle;
pub use flower_of_paradise_lost::FlowerOfParadiseLost;
pub use nymphs_dream::NymphsDream;
pub use vourukashas_glow::VourukashasGlow;
pub use marechaussee_hunter::MarechausseeHunter;
pub use golden_troupe::GoldenTroupe;

pub mod empty;
pub mod adventurer;
Expand Down Expand Up @@ -97,6 +99,8 @@ pub mod desert_pavilion_chronicle;
pub mod flower_of_paradise_lost;
pub mod nymphs_dream;
pub mod vourukashas_glow;
pub mod marechaussee_hunter;
pub mod golden_troupe;

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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "genshin_artifacts",
"version": "5.15.0",
"version": "5.16.0",
"private": true,
"scripts": {
"serve": "cross-env ENV_FILE=.env.development.yaml vue-cli-service serve",
Expand Down
Loading

0 comments on commit 5c99ccd

Please sign in to comment.