Skip to content

Commit

Permalink
Merge pull request #301 from CortinthusYu/opt_wrio
Browse files Browse the repository at this point in the history
莱欧强化e修复以及给目标函数增加了普攻占比和融化
  • Loading branch information
wormtql authored Oct 4, 2023
2 parents 921ca47 + 39643e1 commit 4f22676
Show file tree
Hide file tree
Showing 12 changed files with 2,982 additions and 2,892 deletions.
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))
}
}
Loading

0 comments on commit 4f22676

Please sign in to comment.