Skip to content

Commit

Permalink
fix: Peak Patrol Song
Browse files Browse the repository at this point in the history
  • Loading branch information
wormtql committed Oct 13, 2024
1 parent 24b4a00 commit bf2c577
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 17 deletions.
2 changes: 1 addition & 1 deletion mona_core/src/buffs/buffs/character/xilonen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ impl BuffMeta for BuffXilonenC4 {
ItemConfig {
name: "def",
title: locale!(zh_cn: "防御力", en: "DEF"),
config: ItemConfigType::Float { min: 0.0, max: 5000.0, default: 2000.0 }
config: ItemConfigType::Float { min: 0.0, max: 6000.0, default: 2000.0 }
}
]);

Expand Down
2 changes: 1 addition & 1 deletion mona_core/src/buffs/buffs/weapon/sword/peak_patrol_song.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl BuffMeta for BuffPeakPatrolSong {
zh_cn: "防御力",
en: "DEF"
),
config: ItemConfigType::Int { min: 1, max: 5000, default: 1000 },
config: ItemConfigType::Int { min: 1, max: 6000, default: 1000 },
},
ItemConfig {
name: "refine",
Expand Down
2 changes: 1 addition & 1 deletion mona_core/src/weapon/weapon_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub enum WeaponConfig {
Absolution { stack: f64 },
FluteOfEzpitzal { rate: f64 },
SturdyBone { rate: f64 },
PeakPatrolSong { def: f64, stack: f64, rate: f64 },
PeakPatrolSong { stack: f64, rate: f64 },

// claymore
WolfsGravestone { rate: f64 },
Expand Down
40 changes: 26 additions & 14 deletions mona_core/src/weapon/weapons/swords/peak_patrol_song.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::attribute::{Attribute, AttributeCommon};
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};
Expand All @@ -12,7 +12,6 @@ use crate::weapon::weapon_base_atk::WeaponBaseATKFamily;
use crate::weapon::weapon_sub_stat::WeaponSubStatFamily;

pub struct PeakPatrolSongEffect {
pub def: f64,
pub stack: f64,
pub rate: f64,
}
Expand All @@ -29,9 +28,30 @@ impl<A: Attribute> WeaponEffect<A> for PeakPatrolSongEffect {
let ele_bonus2 = 0.06 + 0.02 * refine;
let max_bonus2 = 0.192 + 0.064 * refine;
// let bonus2 = (ele_bonus2 * (self.def / 1000.0).floor()).min(max_bonus2);
let bonus2 = (ele_bonus2 * (self.def / 1000.0)).min(max_bonus2);
// let bonus2 = (ele_bonus2 * (self.def / 1000.0)).min(max_bonus2);
//
// attribute.add_elemental_bonus("岩峰巡歌被动", bonus2 * self.rate);

attribute.add_elemental_bonus("岩峰巡歌被动", bonus2 * self.rate);
let keys = [
AttributeName::BonusPhysical,
AttributeName::BonusPyro,
AttributeName::BonusCryo,
AttributeName::BonusHydro,
AttributeName::BonusGeo,
AttributeName::BonusAnemo,
AttributeName::BonusDendro,
AttributeName::BonusElectro,
];
for k in keys {
let rate = self.rate;
attribute.add_edge1(
AttributeName::DEF,
k,
Box::new(move |def, _| (ele_bonus2 * (def / 1000.0)).min(max_bonus2) * rate),
Box::new(|_x, _y, _grad| (0.0, 0.0)),
"岩峰巡歌被动"
);
}
}
}

Expand Down Expand Up @@ -59,14 +79,6 @@ impl WeaponTrait for PeakPatrolSong {

#[cfg(not(target_family = "wasm"))]
const CONFIG_DATA: Option<&'static [ItemConfig]> = Some(&[
ItemConfig {
name: "def",
title: locale!(
zh_cn: "防御力",
en: "DEF"
),
config: ItemConfigType::Int { min: 1, max: 5000, default: 1000 },
},
ItemConfig {
name: "stack",
title: locale!(
Expand All @@ -87,8 +99,8 @@ impl WeaponTrait for PeakPatrolSong {

fn get_effect<A: Attribute>(character: &CharacterCommonData, config: &WeaponConfig) -> Option<Box<dyn WeaponEffect<A>>> {
match *config {
WeaponConfig::PeakPatrolSong { def, rate, stack } => Some(Box::new(PeakPatrolSongEffect {
def, rate, stack
WeaponConfig::PeakPatrolSong { rate, stack } => Some(Box::new(PeakPatrolSongEffect {
rate, stack
})),
_ => None
}
Expand Down

0 comments on commit bf2c577

Please sign in to comment.