Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
wormtql committed Oct 5, 2023
2 parents 325e5e2 + 4f22676 commit 04b5c43
Show file tree
Hide file tree
Showing 15 changed files with 3,012 additions and 2,923 deletions.
4 changes: 2 additions & 2 deletions mona_core/src/character/characters/anemo/faruzan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub const FARUZAN_SKILL: FaruzanSkillType = FaruzanSkillType {
plunging_dmg2: [1.1363, 1.2288, 1.3213, 1.4535, 1.5459, 1.6516, 1.797, 1.9423, 2.0877, 2.2462, 2.4048, 2.5634, 2.7219, 2.8805, 3.039],
plunging_dmg3: [1.4193, 1.5349, 1.6504, 1.8154, 1.931, 2.063, 2.2445, 2.4261, 2.6076, 2.8057, 3.0037, 3.2018, 3.3998, 3.5979, 3.7959],
e_dmg: [1.488, 1.5996, 1.7112, 1.86, 1.9716, 2.0832, 2.232, 2.3808, 2.5296, 2.6784, 2.8272, 2.976, 3.162, 3.348, 3.534],
e_collapse_dmg: [0.4175, 0.4425, 0.4675, 0.5, 0.525, 0.55, 0.5825, 0.615, 0.6475, 0.68, 0.7125, 0.745, 0.7775, 0.81, 0.8425],
e_collapse_dmg: [1.08, 1.161, 1.242, 1.35, 1.431, 1.512, 1.62, 1.728, 1.836, 1.944, 2.052, 2.16, 2.295, 2.43, 2.565],
q_dmg: [3.776, 4.0592, 4.3424, 4.72, 5.0032, 5.2864, 5.664, 6.0416, 6.4192, 6.7968, 7.1744, 7.552, 8.024, 8.496, 8.968],
q_bonus: [0.18, 0.1935, 0.207, 0.225, 0.2385, 0.252, 0.27, 0.288, 0.306, 0.324, 0.342, 0.36, 0.3825, 0.405, 0.4275],
};
Expand Down Expand Up @@ -243,4 +243,4 @@ impl CharacterTrait for Faruzan {
fn get_target_function_by_role(role_index: usize, team: &TeamQuantization, c: &CharacterCommonData, w: &WeaponCommonData) -> Box<dyn TargetFunction> {
unimplemented!()
}
}
}
56 changes: 39 additions & 17 deletions mona_core/src/character/characters/cryo/wriothesley.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,36 @@ impl CharacterTrait for Wriothesley {
}
]);

#[cfg(not(target_family = "wasm"))]
const CONFIG_SKILL: Option<&'static [ItemConfig]> = Some(&[
ItemConfig {
name: "under_chilling_penalty",
title: locale!(
zh_cn: "「寒烈的惩裁」状态",
en: "Enable 「Chilling Penalty」",
),
config: ItemConfigType::Bool { default: true },
},
]);

fn damage_internal<D: DamageBuilder>(context: &DamageContext<'_, D::AttributeType>, s: usize, config: &CharacterSkillConfig, fumo: Option<Element>) -> D::Result {
let s: WriothesleyDamageEnum = num::FromPrimitive::from_usize(s).unwrap();
let (s1, s2, s3) = context.character_common_data.get_3_skill();

use WriothesleyDamageEnum::*;

let under_chilling_penalty = match *config {
CharacterSkillConfig::Wriothesley { under_chilling_penalty }
=> under_chilling_penalty,
_ => true,
};

let mut ratio = match s {
Normal1 => WRIOTHESLEY_SKILL.normal_dmg1[s1],
Normal2 => WRIOTHESLEY_SKILL.normal_dmg2[s1],
Normal3 => WRIOTHESLEY_SKILL.normal_dmg3[s1],
Normal4Div2 => WRIOTHESLEY_SKILL.normal_dmg4[s1],
Normal5 => WRIOTHESLEY_SKILL.normal_dmg5[s1],
Normal1 => WRIOTHESLEY_SKILL.normal_dmg1[s1] * (if under_chilling_penalty {WRIOTHESLEY_SKILL.e_bonus[s2]} else { 1.0 }),
Normal2 => WRIOTHESLEY_SKILL.normal_dmg2[s1] * (if under_chilling_penalty {WRIOTHESLEY_SKILL.e_bonus[s2]} else { 1.0 }),
Normal3 => WRIOTHESLEY_SKILL.normal_dmg3[s1] * (if under_chilling_penalty {WRIOTHESLEY_SKILL.e_bonus[s2]} else { 1.0 }),
Normal4Div2 => WRIOTHESLEY_SKILL.normal_dmg4[s1] * (if under_chilling_penalty {WRIOTHESLEY_SKILL.e_bonus[s2]} else { 1.0 }),
Normal5 => WRIOTHESLEY_SKILL.normal_dmg5[s1] * (if under_chilling_penalty {WRIOTHESLEY_SKILL.e_bonus[s2]} else { 1.0 }),
Charged => WRIOTHESLEY_SKILL.charged_dmg[s1],
ChargedTalent1 => WRIOTHESLEY_SKILL.charged_dmg[s1],
Plunging1 => WRIOTHESLEY_SKILL.plunging_dmg1[s1],
Expand All @@ -184,14 +203,27 @@ impl CharacterTrait for Wriothesley {

let mut builder = D::new();

let skill_type = s.get_skill_type();
if skill_type == SkillType::ElementalBurst {
if context.character_common_data.constellation >= 2 {
let talent2_stack = context.attribute.get_value(AttributeName::USER1);
let value = talent2_stack * 0.4;
ratio = ratio * (1.0 + value);
}
}
builder.add_atk_ratio("技能倍率", ratio);

if s == ChargedTalent1 {
if context.character_common_data.has_talent1 {
let mul = if context.character_common_data.constellation >= 1 {
let mul_punch_bonus = if context.character_common_data.constellation >= 1 {
2.0
} else {
0.5
};
ratio = (1.0 + mul) * ratio;
let ratio_punch_bonus = mul_punch_bonus * ratio;
if mul_punch_bonus >= 0.0 {
builder.add_atk_ratio("「惩戒·凌跃拳」倍率加成",ratio_punch_bonus);
}

if context.character_common_data.constellation >= 6 {
builder.add_extra_critical_damage("6命「予无罪者以念抚」", 0.8);
Expand All @@ -200,16 +232,6 @@ impl CharacterTrait for Wriothesley {
}
}

let skill_type = s.get_skill_type();
if skill_type == SkillType::ElementalBurst {
if context.character_common_data.constellation >= 2 {
let talent2_stack = context.attribute.get_value(AttributeName::USER1);
let value = talent2_stack * 0.4;
ratio = ratio * (1.0 + value);
}
}

builder.add_atk_ratio("技能倍率", ratio);

builder.damage(
&context.attribute,
Expand Down
1 change: 1 addition & 0 deletions mona_core/src/character/skill_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ pub enum CharacterSkillConfig {
Freminet { talent2_rate: f64 },
Lyney { prop_stack: f64, under_pyro: bool, pyro_count: usize, },
Neuvillette { talent1_stack: usize },
Wriothesley { under_chilling_penalty: bool },
NoConfig,
}
2 changes: 1 addition & 1 deletion mona_core/src/target_functions/target_function_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ pub enum TargetFunctionConfig {
AlhaithamDefault { charged_ratio: f64, e_ratio: f64, q_ratio: f64, spread_ratio: f64 },
DehyaDefault { melt_rate: f64, vaporize_rate: f64, e_count: usize },
MikaDefault { recharge_demand: f64, crit_demand: f64 },

WriothesleyDefault { punch_ratio: f64, melt_rate:f64 },
NoConfig,
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,36 @@ use crate::target_functions::{TargetFunction, TargetFunctionConfig, TargetFuncti
use crate::team::TeamQuantization;
use crate::weapon::Weapon;
use crate::weapon::weapon_common_data::WeaponCommonData;
use crate::common::item_config_type::{ItemConfig, ItemConfigType};

pub struct WriothesleyDefaultTargetFunction;
pub struct WriothesleyDefaultTargetFunction {
pub punch_ratio: f64,
pub melt_rate: f64,
}

impl WriothesleyDefaultTargetFunction {
pub fn new(config: &TargetFunctionConfig) -> Self {
let (
punch_ratio,
melt_rate,
) = match *config {
TargetFunctionConfig::WriothesleyDefault {
punch_ratio,
melt_rate,
} =>
(
punch_ratio,
melt_rate,
),
_ => (0.0, 0.0)
};

Self {
punch_ratio,
melt_rate,
}
}
}

impl TargetFunction for WriothesleyDefaultTargetFunction {
fn get_target_function_opt_config(&self) -> TargetFunctionOptConfig {
Expand All @@ -36,14 +64,23 @@ impl TargetFunction for WriothesleyDefaultTargetFunction {
};

type S = <Wriothesley as CharacterTrait>::DamageEnumType;
let dmg_normal = Wriothesley::damage::<SimpleDamageBuilder>(
&context,
S::Normal1,
&CharacterSkillConfig::Wriothesley {under_chilling_penalty: true},
None
);
let dmg_charged2 = Wriothesley::damage::<SimpleDamageBuilder>(
&context,
S::ChargedTalent1,
&CharacterSkillConfig::NoConfig,
&CharacterSkillConfig::Wriothesley {under_chilling_penalty: true},
None
);

dmg_charged2.normal.expectation
let dmg_normal_mean = self.melt_rate * dmg_normal.melt.unwrap().expectation + (1.0-self.melt_rate) * dmg_normal.normal.expectation;
let dmg_charged2_mean = self.melt_rate * dmg_charged2.melt.unwrap().expectation + (1.0-self.melt_rate)*dmg_charged2.normal.expectation;

dmg_normal_mean * 6.3886 + self.punch_ratio*dmg_charged2_mean
}
}

Expand All @@ -56,15 +93,35 @@ impl TargetFunctionMetaTrait for WriothesleyDefaultTargetFunction {
en: "Wriothesley-Emissary of Solitary Iniquity"
),
description: locale!(
zh_cn: "最大化惩戒·凌跃拳伤害",
en: "Maximize Rebuke: Vaulting Fist DMG"
zh_cn: "最大化强化普+重混合伤害",
en: "Maximize normal+charged combo DMG"
),
tags: "",
four: TargetFunctionFor::SomeWho(CharacterName::Wriothesley),
image: TargetFunctionMetaImage::Avatar
};

#[cfg(not(target_family = "wasm"))]
const CONFIG: Option<&'static [ItemConfig]> = Some(&[
ItemConfig {
name: "punch_ratio",
title: locale!(
zh_cn: "一套普攻打几个重击",
en: "Punch per Normal Attack Combo"
),
config: ItemConfigType::Float { default: 0.5, min: 0.0, max: 5.0 }
},
ItemConfig {
name: "melt_rate",
title: locale!(
zh_cn: "融化占比",
en: "Melt Ratio",
),
config: ItemConfig::RATE01_TYPE
},
]);

fn create(character: &CharacterCommonData, weapon: &WeaponCommonData, config: &TargetFunctionConfig) -> Box<dyn TargetFunction> {
Box::new(WriothesleyDefaultTargetFunction)
Box::new(WriothesleyDefaultTargetFunction::new(config))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ use crate::common::i18n::locale;
use crate::common::item_config_type::{ItemConfig, ItemConfigType};
use crate::damage::{DamageContext, SimpleDamageBuilder};
use crate::enemies::Enemy;
use crate::target_functions::{TargetFunction, TargetFunctionConfig, TargetFunctionName};
use crate::target_functions::target_function::TargetFunctionMetaTrait;
use crate::target_functions::target_function_meta::{TargetFunctionFor, TargetFunctionMeta, TargetFunctionMetaImage};
use crate::target_functions::target_function_opt_config::TargetFunctionOptConfig;
use crate::target_functions::{TargetFunction, TargetFunctionConfig, TargetFunctionName};
use crate::team::TeamQuantization;
use crate::weapon::Weapon;
use crate::weapon::weapon_common_data::WeaponCommonData;
Expand All @@ -32,25 +32,24 @@ impl TargetFunction for TighnariDefaultTargetFunction {
fn target(&self, attribute: &SimpleAttributeGraph2, character: &Character<SimpleAttributeGraph2>, weapon: &Weapon<SimpleAttributeGraph2>, artifacts: &[&Artifact], enemy: &Enemy) -> f64 {
let context: DamageContext<'_, SimpleAttributeGraph2> = DamageContext {
character_common_data: &character.common_data,
attribute, enemy
attribute,
enemy,
};

type S = <Tighnari as CharacterTrait>::DamageEnumType;
let dmg_c3 = Tighnari::damage::<SimpleDamageBuilder>(&&context, S::Charged3, &CharacterSkillConfig::NoConfig, None);
let dmg_c4 = Tighnari::damage::<SimpleDamageBuilder>(&&context, S::Charged4, &CharacterSkillConfig::NoConfig, None);
let dmg_cc6: f64 = if character.common_data.constellation == 6 { Tighnari::damage::<SimpleDamageBuilder>(&&context, S::ChargedC6, &CharacterSkillConfig::NoConfig, None).spread.unwrap().expectation} else { 0.0 };
let dmg_cc6: f64 = if character.common_data.constellation == 6 { Tighnari::damage::<SimpleDamageBuilder>(&&context, S::ChargedC6, &CharacterSkillConfig::NoConfig, None).spread.unwrap().expectation } else { 0.0 };
let dmg_q1 = Tighnari::damage::<SimpleDamageBuilder>(&&context, S::Q1, &CharacterSkillConfig::NoConfig, None);
let dmg_q2 = Tighnari::damage::<SimpleDamageBuilder>(&&context, S::Q2, &CharacterSkillConfig::NoConfig, None);
let dmg_e = Tighnari::damage::<SimpleDamageBuilder>(&&context, S::E1, &CharacterSkillConfig::NoConfig, None);
let dmg =
dmg_c3.spread.unwrap().expectation +
dmg_c4.spread.unwrap().expectation +
dmg_c4.normal.expectation * 3.0 + dmg_cc6 +
dmg_q1.spread.unwrap().expectation + dmg_q2.spread.unwrap().expectation +
(dmg_q1.normal.expectation + dmg_q2.normal.expectation) * 5.0 +
dmg_e.spread.unwrap().expectation;


let dmg =
dmg_c3.spread.unwrap().expectation +
dmg_c4.spread.unwrap().expectation +
dmg_c4.normal.expectation * 3.0 + dmg_cc6 +
dmg_q1.spread.unwrap().expectation + dmg_q2.spread.unwrap().expectation +
(dmg_q1.normal.expectation + dmg_q2.normal.expectation) * 5.0 +
dmg_e.spread.unwrap().expectation;

dmg
}
Expand All @@ -70,7 +69,7 @@ impl TargetFunctionMetaTrait for TighnariDefaultTargetFunction {
),
tags: "",
four: TargetFunctionFor::SomeWho(CharacterName::Tighnari),
image: TargetFunctionMetaImage::Avatar
image: TargetFunctionMetaImage::Avatar,
};


Expand Down
2 changes: 1 addition & 1 deletion mona_core/src/weapon/weapons/claymores/mailed_flower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl MailedFlowerEffect {
impl<T: Attribute> WeaponEffect<T> for MailedFlowerEffect {
fn apply(&self, data: &WeaponCommonData, attribute: &mut T) {
let refine = data.refine as f64;
let value1 = (refine * 0.3 + 0.09)*self.rate;
let value1 = (refine * 0.03 + 0.09)*self.rate;
let value2 = (refine * 12.0 + 36.0)*self.rate;
attribute.add_atk_percentage("饰铁之花被动等效", value1);
attribute.set_value_by(AttributeName::ElementalMastery, "饰铁之花被动等效", value2);
Expand Down
Loading

0 comments on commit 04b5c43

Please sign in to comment.