Skip to content

Commit

Permalink
feat(4.0): Add some weapons
Browse files Browse the repository at this point in the history
  • Loading branch information
wormtql committed Aug 18, 2023
1 parent a7916c6 commit 6aa1fa6
Show file tree
Hide file tree
Showing 18 changed files with 2,494 additions and 2,143 deletions.
3 changes: 3 additions & 0 deletions mona_core/src/weapon/weapon_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub enum WeaponConfig {
BeaconOfTheReedSea { rate_atk: f64, rate_hp: f64 },
MailedFlower { rate: f64 },
TalkingStick { rate1: f64, rate2: f64 },
TidalShadow { rate: f64 },

// Polearm
EngulfingLightning { rate: f64 },
Expand All @@ -65,6 +66,7 @@ pub enum WeaponConfig {
Moonpiercer { rate: f64 },
MissiveWindspear { rate: f64 },
StaffOfTheScarletSands { stack: f64 },
BalladOfTheFjords { use_effect: bool },

// Catalyst
LostPrayerToTheSacredWinds { stack: f64 },
Expand All @@ -85,6 +87,7 @@ pub enum WeaponConfig {
AThousandFloatingDreams { same_count: usize, diff_count: usize },
TulaytullahsRemembrance { stack: f64 },
JadeFallsSplendor { rate: f64 },
SacrificialJade { rate: f64 },

// Bow
PolarStar { stack: usize },
Expand Down
4 changes: 4 additions & 0 deletions mona_core/src/weapon/weapon_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ pub enum WeaponName {
BeaconOfTheReedSea,
MailedFlower,
TalkingStick,
TidalShadow,

// polearm
EngulfingLightning,
Expand Down Expand Up @@ -112,6 +113,8 @@ pub enum WeaponName {
Moonpiercer,
MissiveWindspear,
StaffOfTheScarletSands,
BalladOfTheFjords,
RightfulReward,

// catalyst
LostPrayerToTheSacredWinds,
Expand Down Expand Up @@ -145,6 +148,7 @@ pub enum WeaponName {
AThousandFloatingDreams,
TulaytullahsRemembrance,
JadeFallsSplendor,
SacrificialJade,

// bows
PolarStar,
Expand Down
3 changes: 3 additions & 0 deletions mona_core/src/weapon/weapon_sub_stat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub enum WeaponSubStatFamily {
EM48,
EM58,

HP60,
HP77,
HP90,
HP102,
Expand Down Expand Up @@ -113,6 +114,7 @@ pub fn get_stat_name_from_family(family: WeaponSubStatFamily) -> StatName {
WeaponSubStatFamily::EM48 => StatName::ElementalMastery,
WeaponSubStatFamily::EM58 => StatName::ElementalMastery,

WeaponSubStatFamily::HP60 => StatName::HPPercentage,
WeaponSubStatFamily::HP77 => StatName::HPPercentage,
WeaponSubStatFamily::HP90 => StatName::HPPercentage,
WeaponSubStatFamily::HP102 => StatName::HPPercentage,
Expand Down Expand Up @@ -181,6 +183,7 @@ pub fn get_value_array(family: WeaponSubStatFamily) -> [f64; 8] {
WeaponSubStatFamily::EM48 => [48.0, 85.0, 124.0, 143.0, 162.0, 182.0, 201.0, 221.0],
WeaponSubStatFamily::EM58 => [57.6, 101.78, 148.32, 171.59, 194.86, 218.07, 241.34, 264.61],

WeaponSubStatFamily::HP60 => [0.06, 0.106, 0.1545, 0.1787, 0.203, 0.2272, 0.2514, 0.2756],
WeaponSubStatFamily::HP77 => [0.077, 0.135, 0.197, 0.228, 0.259, 0.29, 0.321, 0.413],
WeaponSubStatFamily::HP90 => [0.09, 0.159, 0.232, 0.268, 0.304, 0.341, 0.377, 0.413],
WeaponSubStatFamily::HP102 => [0.102, 0.18, 0.263, 0.304, 0.345, 0.386, 0.427, 0.469],
Expand Down
2 changes: 2 additions & 0 deletions mona_core/src/weapon/weapons/catalysts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub use wandering_evenstar::WanderingEvenstar;
pub use a_thousand_floating_dreams::AThousandFloatingDreams;
pub use tulaytullah_s_remembrance::TulaytullahsRemembrance;
pub use jadefalls_splendor::JadeFallsSplendor;
pub use sacrificial_jade::SacrificialJade;

pub mod lost_prayer_to_the_sacred_winds;
pub mod skyward_atlas;
Expand Down Expand Up @@ -61,3 +62,4 @@ pub mod wandering_evenstar;
pub mod a_thousand_floating_dreams;
pub mod tulaytullah_s_remembrance;
pub mod jadefalls_splendor;
pub mod sacrificial_jade;
62 changes: 62 additions & 0 deletions mona_core/src/weapon/weapons/catalysts/sacrificial_jade.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
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;
use crate::common::WeaponType;
use crate::weapon::weapon_common_data::WeaponCommonData;
use crate::weapon::weapon_effect::WeaponEffect;
use crate::weapon::weapon_static_data::WeaponStaticData;
use crate::weapon::weapon_trait::WeaponTrait;
use crate::weapon::{WeaponConfig, WeaponName};
use crate::weapon::weapon_base_atk::WeaponBaseATKFamily;
use crate::weapon::weapon_sub_stat::WeaponSubStatFamily;

pub struct SacrificialJadeEffect {
pub rate: f64
}

impl<A: Attribute> WeaponEffect<A> for SacrificialJadeEffect {
fn apply(&self, data: &WeaponCommonData, attribute: &mut A) {
let refine = data.refine as f64;
attribute.add_hp_percentage("遗祀玉珑被动", self.rate * (0.08 * refine + 0.24));
attribute.set_value_by(AttributeName::ElementalMastery, "遗祀玉珑被动", self.rate * (10.0 * refine + 30.0));
}
}

pub struct SacrificialJade;

impl WeaponTrait for SacrificialJade {
const META_DATA: WeaponStaticData = WeaponStaticData {
name: WeaponName::SacrificialJade,
internal_name: "",
weapon_type: WeaponType::Catalyst,
weapon_sub_stat: Some(WeaponSubStatFamily::CriticalRate80),
weapon_base: WeaponBaseATKFamily::ATK454,
star: 4,
#[cfg(not(target_family = "wasm"))]
effect: Some(locale!(
zh_cn: "处于队伍后台超过5秒后,生命值上限提升<span style=\"color: #409EFF;\">32%-40%-48%-56%-64%</span>,元素精通提升<span style=\"color: #409EFF;\">40-50-60-70-80</span>点。装备者登场并留在场上10秒后,该效果将失效。",
en: "When not on the field for more than 5s, Max HP will be increased by <span style=\"color: #409EFF;\">32%-40%-48%-56%-64%</span> and Elemental Mastery will be increased by <span style=\"color: #409EFF;\">40-50-60-70-80</span>. These effects will be canceled after the wielder has been on the field for 10s."
)),
#[cfg(not(target_family = "wasm"))]
name_locale: locale!(
zh_cn: "遗祀玉珑",
en: "Sacrificial Jade"
)
};

#[cfg(not(target_family = "wasm"))]
const CONFIG_DATA: Option<&'static [ItemConfig]> = Some(&[
ItemConfig::RATE01
]);

fn get_effect<A: Attribute>(character: &CharacterCommonData, config: &WeaponConfig) -> Option<Box<dyn WeaponEffect<A>>> {
let rate = match *config {
WeaponConfig::SacrificialJade { rate } => rate,
_ => 0.0
};
Some(Box::new(SacrificialJadeEffect {
rate
}))
}
}
2 changes: 2 additions & 0 deletions mona_core/src/weapon/weapons/claymores/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub use makhaira_aquamarine::MakhairaAquamarine;
pub use beacon_of_the_reed_sea::BeaconOfTheReedSea;
pub use mailed_flower::MailedFlower;
pub use talking_stick::TalkingStick;
pub use tidal_shadow::TidalShadow;

pub mod wolfs_gravestone;
pub mod skyward_pride;
Expand Down Expand Up @@ -61,3 +62,4 @@ pub mod makhaira_aquamarine;
pub mod beacon_of_the_reed_sea;
pub mod mailed_flower;
pub mod talking_stick;
pub mod tidal_shadow;
62 changes: 62 additions & 0 deletions mona_core/src/weapon/weapons/claymores/tidal_shadow.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
use crate::attribute::{Attribute, AttributeCommon};
use crate::character::character_common_data::CharacterCommonData;
use crate::common::i18n::locale;
use crate::common::item_config_type::ItemConfig;
use crate::common::WeaponType;
use crate::weapon::weapon_common_data::WeaponCommonData;
use crate::weapon::weapon_effect::WeaponEffect;
use crate::weapon::weapon_static_data::WeaponStaticData;
use crate::weapon::weapon_trait::WeaponTrait;
use crate::weapon::{WeaponConfig, WeaponName};
use crate::weapon::weapon_base_atk::WeaponBaseATKFamily;
use crate::weapon::weapon_sub_stat::WeaponSubStatFamily;

pub struct TidalShadowEffect {
pub rate: f64
}

impl<A: Attribute> WeaponEffect<A> for TidalShadowEffect {
fn apply(&self, data: &WeaponCommonData, attribute: &mut A) {
let refine = data.refine as f64;
let value = 0.06 * refine + 0.18;
attribute.add_atk_percentage("浪影阔剑被动", value * self.rate);
}
}

pub struct TidalShadow;

impl WeaponTrait for TidalShadow {
const META_DATA: WeaponStaticData = WeaponStaticData {
name: WeaponName::TidalShadow,
internal_name: "Claymore_Vorpal",
weapon_type: WeaponType::Claymore,
weapon_sub_stat: Some(WeaponSubStatFamily::ATK90),
weapon_base: WeaponBaseATKFamily::ATK510,
star: 4,
#[cfg(not(target_family = "wasm"))]
effect: Some(locale!(
zh_cn: "受到治疗后,攻击力提升<span style=\"color: #409EFF;\">24%-30%-36%-42%-48%</span>,持续8秒。角色处于队伍后台也能触发。",
en: "After the wielder is healed, ATK will be increased by <span style=\"color: #409EFF;\">24%-30%-36%-42%-48%</span> for 8s. This can be triggered even when the character is not on the field."
)),
#[cfg(not(target_family = "wasm"))]
name_locale: locale!(
zh_cn: "浪影阔剑",
en: "Tidal Shadow",
)
};

#[cfg(not(target_family = "wasm"))]
const CONFIG_DATA: Option<&'static [ItemConfig]> = Some(&[
ItemConfig::RATE01
]);

fn get_effect<A: Attribute>(character: &CharacterCommonData, config: &WeaponConfig) -> Option<Box<dyn WeaponEffect<A>>> {
let rate = match *config {
WeaponConfig::TidalShadow { rate } => rate,
_ => 0.0
};
Some(Box::new(TidalShadowEffect {
rate
}))
}
}
70 changes: 70 additions & 0 deletions mona_core/src/weapon/weapons/polearms/ballad_of_the_fjords.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
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};
use crate::common::WeaponType;
use crate::weapon::weapon_common_data::WeaponCommonData;
use crate::weapon::weapon_effect::WeaponEffect;
use crate::weapon::weapon_static_data::WeaponStaticData;
use crate::weapon::weapon_trait::WeaponTrait;
use crate::weapon::{WeaponConfig, WeaponName};
use crate::weapon::weapon_base_atk::WeaponBaseATKFamily;
use crate::weapon::weapon_sub_stat::WeaponSubStatFamily;

pub struct BalladOfTheFjordsEffect {
pub use_effect: bool
}

impl<A: Attribute> WeaponEffect<A> for BalladOfTheFjordsEffect {
fn apply(&self, data: &WeaponCommonData, attribute: &mut A) {
if self.use_effect {
let value = 30 * data.refine + 90;
attribute.set_value_by(AttributeName::ElementalMastery, "峡湾长歌被动", value as f64);
}
}
}

pub struct BalladOfTheFjords;

impl WeaponTrait for BalladOfTheFjords {
const META_DATA: WeaponStaticData = WeaponStaticData {
name: WeaponName::BalladOfTheFjords,
internal_name: "Pole_Shanty",
weapon_type: WeaponType::Polearm,
weapon_sub_stat: Some(WeaponSubStatFamily::CriticalRate60),
weapon_base: WeaponBaseATKFamily::ATK510,
star: 4,
#[cfg(not(target_family = "wasm"))]
effect: Some(locale!(
zh_cn: "队伍中存在至少三种不同元素类型的角色时,元素精通提升<span style=\"color: #409EFF;\">120-150-180-210-240</span>点。",
en: "When there are at least 3 different Elemental Types in your party, Elemental Mastery will be increased by <span style=\"color: #409EFF;\">120-150-180-210-240</span>."
)),
#[cfg(not(target_family = "wasm"))]
name_locale: locale!(
zh_cn: "峡湾长歌",
en: "Ballad of the Fjords"
)
};

#[cfg(not(target_family = "wasm"))]
const CONFIG_DATA: Option<&'static [ItemConfig]> = Some(&[
ItemConfig {
name: "use_effect",
title: locale!(
zh_cn: "开启被动",
en: "Use Effect"
),
config: ItemConfigType::Bool { default: true }
}
]);

fn get_effect<A: Attribute>(character: &CharacterCommonData, config: &WeaponConfig) -> Option<Box<dyn WeaponEffect<A>>> {
let b = match *config {
WeaponConfig::BalladOfTheFjords { use_effect } => use_effect,
_ => false
};
Some(Box::new(BalladOfTheFjordsEffect {
use_effect: b
}))
}
}
4 changes: 4 additions & 0 deletions mona_core/src/weapon/weapons/polearms/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ pub use beginners_protector::BeginnersProtector;
pub use moonpiercer::Moonpiercer;
pub use missive_windspear::MissiveWindspear;
pub use staff_of_the_scarlet_sands::StaffOfTheScarletSands;
pub use ballad_of_the_fjords::BalladOfTheFjords;
pub use rightful_reward::RightfulReward;

pub mod engulfing_lightning;
pub mod skyward_spine;
Expand Down Expand Up @@ -51,3 +53,5 @@ pub mod beginners_protector;
pub mod moonpiercer;
pub mod missive_windspear;
pub mod staff_of_the_scarlet_sands;
pub mod ballad_of_the_fjords;
pub mod rightful_reward;
37 changes: 37 additions & 0 deletions mona_core/src/weapon/weapons/polearms/rightful_reward.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
use crate::attribute::Attribute;
use crate::character::character_common_data::CharacterCommonData;
use crate::common::i18n::locale;
use crate::common::WeaponType;
use crate::weapon::weapon_effect::WeaponEffect;
use crate::weapon::weapon_static_data::WeaponStaticData;
use crate::weapon::weapon_trait::WeaponTrait;
use crate::weapon::{WeaponConfig, WeaponName};
use crate::weapon::weapon_base_atk::WeaponBaseATKFamily;
use crate::weapon::weapon_sub_stat::WeaponSubStatFamily;

pub struct RightfulReward;

impl WeaponTrait for RightfulReward {
const META_DATA: WeaponStaticData = WeaponStaticData {
name: WeaponName::RightfulReward,
internal_name: "Pole_Vorpal",
weapon_type: WeaponType::Polearm,
weapon_sub_stat: Some(WeaponSubStatFamily::HP60),
weapon_base: WeaponBaseATKFamily::ATK565,
star: 4,
#[cfg(not(target_family = "wasm"))]
effect: Some(locale!(
zh_cn: "受到治疗时,恢复<span style=\"color: #409EFF;\">8-10-12-14-16</span>点能量,该效果每10秒至多触发一次,角色处于队伍后台时也能触发。",
en: "When the wielder is healed, restore <span style=\"color: #409EFF;\">8-10-12-14-16</span> Energy. This effect can be triggered once every 10s, and can occur even when the character is not on the field."
)),
#[cfg(not(target_family = "wasm"))]
name_locale: locale!(
zh_cn: "公义的酬报",
en: "Rightful Reward"
)
};

fn get_effect<A: Attribute>(character: &CharacterCommonData, config: &WeaponConfig) -> Option<Box<dyn WeaponEffect<A>>> {
None
}
}
Loading

0 comments on commit 6aa1fa6

Please sign in to comment.