Skip to content

Commit

Permalink
feat(weapon): Add some weapons
Browse files Browse the repository at this point in the history
  • Loading branch information
wormtql committed Sep 26, 2023
1 parent 7456117 commit 3fe36c2
Show file tree
Hide file tree
Showing 23 changed files with 2,837 additions and 2,270 deletions.
2 changes: 1 addition & 1 deletion mona_core/src/common/item_config_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl ItemConfig {
pub const RATE01_TYPE: ItemConfigType = ItemConfigType::Float { min: 0.0, max: 1.0, default: 0.0 };
pub const RATE01: ItemConfig = ItemConfig { name: "rate", title: Self::DEFAULT_RATE_TITLE, config: ItemConfigType::Float { min: 0.0, max: 1.0, default: 0.0 } };
pub const STACK02: ItemConfig = ItemConfig { name: "stack", title: Self::DEFAULT_STACK_TITLE, config: ItemConfigType::Float { min: 0.0, max: 2.0, default: 0.0 } };
pub const STACK03: ItemConfig = ItemConfig { name: "stack", title: Self::DEFAULT_STACK_TITLE, config: ItemConfigType::Float { min: 0.0, max: 3.0, default: 0.0 } };
pub const STACK03: ItemConfig = ItemConfig { name: "stack", title: Self::DEFAULT_STACK_TITLE, config: ItemConfigType::Float { min: 0.0, max: 3.0, default: 3.0 } };
pub const STACK04: ItemConfig = ItemConfig { name: "stack", title: Self::DEFAULT_STACK_TITLE, config: ItemConfigType::Float { min: 0.0, max: 4.0, default: 0.0 } };
pub const STACK05: ItemConfig = ItemConfig { name: "stack", title: Self::DEFAULT_STACK_TITLE, config: ItemConfigType::Float { min: 0.0, max: 5.0, default: 0.0 } };
pub const BUFFV1P: ItemConfig = ItemConfig { name: "p", title: Self::DEFAULT_BUFF_TITLE, config: ItemConfigType::FloatPercentageInput { default: 0.0 } };
Expand Down
6 changes: 6 additions & 0 deletions mona_core/src/weapon/weapon_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub enum WeaponConfig {
WolfFang { e_stack: f64, q_stack: f64 },
FinaleOfTheDeep { rate1: f64, rate2: f64 },
FleuveCendreFerryman { rate: f64 },
TheDockhandsAssistant { stack: f64 },

// claymore
WolfsGravestone { rate: f64 },
Expand All @@ -49,6 +50,7 @@ pub enum WeaponConfig {
MailedFlower { rate: f64 },
TalkingStick { rate1: f64, rate2: f64 },
TidalShadow { rate: f64 },
PortablePowerSaw { stack: f64 },

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

// Catalyst
LostPrayerToTheSacredWinds { stack: f64 },
Expand All @@ -89,6 +92,8 @@ pub enum WeaponConfig {
JadeFallsSplendor { rate: f64 },
SacrificialJade { rate: f64 },
FlowingPurity { rate1: f64, rate2: f64 },
BalladOfTheBoundlessBlue { stack: f64 },
CashflowSupervision { stack: f64 },

// Bow
PolarStar { stack: usize },
Expand All @@ -115,6 +120,7 @@ pub enum WeaponConfig {
TheFirstGreatMagic { same_count: f64, diff_count: f64 },
ScionOfTheBlazingSun { rate: f64 },
SongOfStillness { rate: f64 },
RangeGauge { stack: f64 },
}

impl Default for WeaponConfig {
Expand Down
6 changes: 6 additions & 0 deletions mona_core/src/weapon/weapon_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub enum WeaponName {
WolfFang,
FinaleOfTheDeep,
FleuveCendreFerryman,
TheDockhandsAssistant,

// claymore
WolfsGravestone,
Expand Down Expand Up @@ -85,6 +86,7 @@ pub enum WeaponName {
MailedFlower,
TalkingStick,
TidalShadow,
PortablePowerSaw,

// polearm
EngulfingLightning,
Expand Down Expand Up @@ -115,6 +117,7 @@ pub enum WeaponName {
StaffOfTheScarletSands,
BalladOfTheFjords,
RightfulReward,
ProspectorsDrill,

// catalyst
LostPrayerToTheSacredWinds,
Expand Down Expand Up @@ -150,6 +153,8 @@ pub enum WeaponName {
JadeFallsSplendor,
SacrificialJade,
FlowingPurity,
BalladOfTheBoundlessBlue,
CashflowSupervision,

// bows
PolarStar,
Expand Down Expand Up @@ -188,4 +193,5 @@ pub enum WeaponName {
TheFirstGreatMagic,
ScionOfTheBlazingSun,
SongOfStillness,
RangeGauge,
}
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 @@ -51,6 +51,7 @@ pub enum WeaponSubStatFamily {
HP90,
HP102,
HP108,
HP120,
HP144,

PhysicalBonus45,
Expand Down Expand Up @@ -119,6 +120,7 @@ pub fn get_stat_name_from_family(family: WeaponSubStatFamily) -> StatName {
WeaponSubStatFamily::HP90 => StatName::HPPercentage,
WeaponSubStatFamily::HP102 => StatName::HPPercentage,
WeaponSubStatFamily::HP108 => StatName::HPPercentage,
WeaponSubStatFamily::HP120 => StatName::HPPercentage,
WeaponSubStatFamily::HP144 => StatName::HPPercentage,

WeaponSubStatFamily::PhysicalBonus45 => StatName::PhysicalBonus,
Expand Down Expand Up @@ -188,6 +190,7 @@ pub fn get_value_array(family: WeaponSubStatFamily) -> [f64; 8] {
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],
WeaponSubStatFamily::HP108 => [0.108, 0.191, 0.278, 0.322, 0.365, 0.409, 0.453, 0.496],
WeaponSubStatFamily::HP120 => [0.12, 0.212, 0.309, 0.3575, 0.406, 0.4543, 0.5028, 0.5513],
WeaponSubStatFamily::HP144 => [0.144, 0.2544, 0.3708, 0.429, 0.4872, 0.5452, 0.6034, 0.6615],

WeaponSubStatFamily::PhysicalBonus45 => [0.045, 0.08, 0.116, 0.134, 0.152, 0.17, 0.189, 0.207],
Expand Down
2 changes: 2 additions & 0 deletions mona_core/src/weapon/weapons/bows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub use ibis_piercer::IbisPiercer;
pub use the_first_great_magic::TheFirstGreatMagic;
pub use scion_of_the_blazing_sun::ScionOfTheBlazingSun;
pub use song_of_stillness::SongOfStillness;
pub use range_gauge::RangeGauge;

pub mod polar_star;
pub mod thundering_pulse;
Expand Down Expand Up @@ -71,3 +72,4 @@ pub mod ibis_piercer;
pub mod the_first_great_magic;
pub mod scion_of_the_blazing_sun;
pub mod song_of_stillness;
pub mod range_gauge;
57 changes: 57 additions & 0 deletions mona_core/src/weapon/weapons/bows/range_gauge.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
use crate::attribute::Attribute;
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_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;
use crate::weapon::weapons::prospectors_drill::ProspectorsDrillEffect;

pub struct RangeGauge;

impl WeaponTrait for RangeGauge {
const META_DATA: WeaponStaticData = WeaponStaticData {
name: WeaponName::RangeGauge,
internal_name: "Bow_Mechanic",
weapon_type: WeaponType::Bow,
weapon_sub_stat: Some(WeaponSubStatFamily::ATK60),
weapon_base: WeaponBaseATKFamily::ATK565,
star: 4,
#[cfg(not(target_family = "wasm"))]
effect: Some(locale!(
zh_cn: "受到治疗或进行治疗时,将赋予一枚团结标记,持续30秒,至多拥有三枚团结标记。施放元素战技或元素爆发时,将消耗所有的团结标记,产生持续10秒的「抗争」效果:每枚消耗的团结标记提高<span style=\"color: #409EFF;\">3%-4%-5%-6%-7%</span>攻击力与<span style=\"color: #409EFF;\">7%-8.5%-10%-11.5%-13%</span>所有元素伤害加成。每15秒至多触发一次抗争效果;角色处于队伍后台时也能获得团结标记。",
en: "When the wielder is healed or heals others, they will gain a Unity's Symbol that lasts 30s, up to a maximum of 3 Symbols. When using their Elemental Skill or Burst, all Symbols will be consumed and the Struggle effect will be granted for 10s. For each Symbol consumed, gain <span style=\"color: #409EFF;\">3%-4%-5%-6%-7%</span> ATK and <span style=\"color: #409EFF;\">7%-8.5%-10%-11.5%-13%</span> All Elemental DMG Bonus. The Struggle effect can be triggered once every 15s, and Symbols can be gained even when the character is not on the field."
)),
#[cfg(not(target_family = "wasm"))]
name_locale: locale!(
zh_cn: "测距规",
en: "Range Gauge"
)
};

#[cfg(not(target_family = "wasm"))]
const CONFIG_DATA: Option<&'static [ItemConfig]> = Some(&[
ItemConfig {
name: "stack",
title: locale!(
zh_cn: "团结标记数量",
en: "Unity's Symbol Amount"
),
config: ItemConfigType::Float { min: 0.0, max: 3.0, default: 3.0 }
}
]);

fn get_effect<A: Attribute>(character: &CharacterCommonData, config: &WeaponConfig) -> Option<Box<dyn WeaponEffect<A>>> {
let stack = match *config {
WeaponConfig::RangeGauge { stack } => stack,
_ => 0.0
};
Some(Box::new(ProspectorsDrillEffect {
stack
}))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
use crate::attribute::{Attribute, 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 BalladOfTheBoundlessBlueEffect {
pub stack: f64,
}

impl<A: Attribute> WeaponEffect<A> for BalladOfTheBoundlessBlueEffect {
fn apply(&self, data: &WeaponCommonData, attribute: &mut A) {
let refine = data.refine as f64;

attribute.set_value_by(AttributeName::BonusNormalAttack, "无垠蔚蓝之歌被动", (0.06 + 0.02 * refine) * self.stack);
attribute.set_value_by(AttributeName::BonusChargedAttack, "无垠蔚蓝之歌被动", (0.045 + 0.015 * refine) * self.stack);
}
}

pub struct BalladOfTheBoundlessBlue;

impl WeaponTrait for BalladOfTheBoundlessBlue {
const META_DATA: WeaponStaticData = WeaponStaticData {
name: WeaponName::BalladOfTheBoundlessBlue,
internal_name: "Catalyst_DandelionPoem",
weapon_type: WeaponType::Catalyst,
weapon_sub_stat: Some(WeaponSubStatFamily::Recharge67),
weapon_base: WeaponBaseATKFamily::ATK565,
star: 4,
#[cfg(not(target_family = "wasm"))]
effect: Some(locale!(
zh_cn: "普通攻击或重击命中敌人后的6秒内,普通攻击造成的伤害提升<span style=\"color: #409EFF;\">8%-10%-12%-14%-16%</span>,重击造成的伤害提升<span style=\"color: #409EFF;\">6%-7.5%-9%-10.5%-12%</span>。该效果至多叠加3次,每0.3秒至多触发一次。",
en: "Within 6s after Normal or Charged Attacks hit an opponent, Normal Attack DMG will be increased by <span style=\"color: #409EFF;\">8%-10%-12%-14%-16%</span> and Charged Attack DMG will be increased by <span style=\"color: #409EFF;\">6%-7.5%-9%-10.5%-12%</span>. Max 3 stacks. This effect can be triggered once every 0.3s."
)),
#[cfg(not(target_family = "wasm"))]
name_locale: locale!(
zh_cn: "无垠蔚蓝之歌",
en: "Ballad of the Boundless Blue"
)
};

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

fn get_effect<A: Attribute>(character: &CharacterCommonData, config: &WeaponConfig) -> Option<Box<dyn WeaponEffect<A>>> {
let stack = match *config {
WeaponConfig::BalladOfTheBoundlessBlue { stack } => stack,
_ => 0.0
};
Some(Box::new(BalladOfTheBoundlessBlueEffect {
stack
}))
}
}
64 changes: 64 additions & 0 deletions mona_core/src/weapon/weapons/catalysts/cashflow_supervision.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
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 CashflowSupervisionEffect {
pub stack: f64,
}

impl<A: Attribute> WeaponEffect<A> for CashflowSupervisionEffect {
fn apply(&self, data: &WeaponCommonData, attribute: &mut A) {
let refine = data.refine as f64;

attribute.add_atk_percentage("金流监督被动", 0.12 + 0.04 * refine);
attribute.set_value_by(AttributeName::BonusNormalAttack, "金流监督被动", (0.012 + 0.04 * refine) * self.stack);
attribute.set_value_by(AttributeName::BonusChargedAttack, "金流监督被动", (0.105 + 0.035 * refine) * self.stack);
}
}

pub struct CashflowSupervision;

impl WeaponTrait for CashflowSupervision {
const META_DATA: WeaponStaticData = WeaponStaticData {
name: WeaponName::CashflowSupervision,
internal_name: "Catalyst_Wheatley",
weapon_type: WeaponType::Catalyst,
weapon_sub_stat: Some(WeaponSubStatFamily::CriticalRate48),
weapon_base: WeaponBaseATKFamily::ATK674,
star: 5,
#[cfg(not(target_family = "wasm"))]
effect: Some(locale!(
zh_cn: "攻击力提升<span style=\"color: #409EFF;\">16%-20%-24%-28%-32%</span>。当前生命值提升或降低时,普通攻击造成的伤害提升<span style=\"color: #409EFF;\">16%-20%-24%-28%-32%</span>,重击造成的伤害提升<span style=\"color: #409EFF;\">14%-17.5%-21%-24.5%-28%</span>。该效果持续4秒,至多叠加3层,每0.3秒至多触发一次;处于叠加3层的状态下时,攻击速度提升8%。",
en: "ATK is increased by <span style=\"color: #409EFF;\">16%-20%-24%-28%-32%</span>. When current HP increases or decreases, Normal Attack DMG will be increased by <span style=\"color: #409EFF;\">16%-20%-24%-28%-32%</span> and Charged Attack DMG will be increased by <span style=\"color: #409EFF;\">14%-17.5%-21%-24.5%-28%</span> for 4s. Max 3 stacks. This effect can be triggered once every 0.3s. When the wielder has 3 stacks, ATK SPD will be increased by 8%."
)),
#[cfg(not(target_family = "wasm"))]
name_locale: locale!(
zh_cn: "金流监督",
en: "Cashflow Supervision"
)
};

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

fn get_effect<A: Attribute>(character: &CharacterCommonData, config: &WeaponConfig) -> Option<Box<dyn WeaponEffect<A>>> {
let stack = match *config {
WeaponConfig::CashflowSupervision { stack } => stack,
_ => 0.0
};
Some(Box::new(CashflowSupervisionEffect {
stack
}))
}
}
4 changes: 4 additions & 0 deletions mona_core/src/weapon/weapons/catalysts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ pub use tulaytullah_s_remembrance::TulaytullahsRemembrance;
pub use jadefalls_splendor::JadeFallsSplendor;
pub use sacrificial_jade::SacrificialJade;
pub use flowing_purity::FlowingPurity;
pub use ballad_of_the_boundless_blue::BalladOfTheBoundlessBlue;
pub use cashflow_supervision::CashflowSupervision;

pub mod lost_prayer_to_the_sacred_winds;
pub mod skyward_atlas;
Expand Down Expand Up @@ -65,3 +67,5 @@ pub mod tulaytullah_s_remembrance;
pub mod jadefalls_splendor;
pub mod sacrificial_jade;
pub mod flowing_purity;
pub mod ballad_of_the_boundless_blue;
pub mod cashflow_supervision;
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 @@ -30,6 +30,7 @@ pub use beacon_of_the_reed_sea::BeaconOfTheReedSea;
pub use mailed_flower::MailedFlower;
pub use talking_stick::TalkingStick;
pub use tidal_shadow::TidalShadow;
pub use portable_power_saw::PortablePowerSaw;

pub mod wolfs_gravestone;
pub mod skyward_pride;
Expand Down Expand Up @@ -63,3 +64,4 @@ pub mod beacon_of_the_reed_sea;
pub mod mailed_flower;
pub mod talking_stick;
pub mod tidal_shadow;
pub mod portable_power_saw;
Loading

0 comments on commit 3fe36c2

Please sign in to comment.