From 820f8dca94dd8bcafe56724e76f380d76d5c92fb Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 20 May 2023 20:21:23 -0400 Subject: [PATCH] Sunder --- assets/common/abilities/axe/sunder.ron | 32 +++++++-------------- assets/voxygen/i18n/en/buff.ftl | 3 ++ common/src/cmd.rs | 1 + common/src/combat.rs | 7 ++++- common/src/comp/buff.rs | 16 ++++++++++- common/src/comp/stats.rs | 2 ++ common/systems/src/buff.rs | 6 ++++ voxygen/anim/src/character/selfbuff.rs | 39 +++++++++++++++++++++++++- voxygen/i18n-helpers/src/lib.rs | 3 +- voxygen/src/hud/mod.rs | 4 +++ voxygen/src/hud/util.rs | 6 ++-- 11 files changed, 91 insertions(+), 28 deletions(-) diff --git a/assets/common/abilities/axe/sunder.ron b/assets/common/abilities/axe/sunder.ron index b4732b4a2f..119ed42f22 100644 --- a/assets/common/abilities/axe/sunder.ron +++ b/assets/common/abilities/axe/sunder.ron @@ -1,22 +1,10 @@ -ComboMelee2( - strikes: [ - ( - melee_constructor: ( - kind: Slash( - damage: 4, - poise: 5, - knockback: 0, - energy_regen: 5, - ), - range: 3.0, - angle: 45.0, - ), - buildup_duration: 0.15, - swing_duration: 0.05, - hit_timing: 0.5, - recover_duration: 0.1, - ori_modifier: 0.6, - ), - ], - energy_cost_per_strike: 0, -) \ No newline at end of file +SelfBuff( + buildup_duration: 0.2, + cast_duration: 0.2, + recover_duration: 0.1, + buff_kind: Sunderer, + buff_strength: 0.25, + buff_duration: Some(15.0), + combo_cost: 10, + energy_cost: 0, +) diff --git a/assets/voxygen/i18n/en/buff.ftl b/assets/voxygen/i18n/en/buff.ftl index 787266bdf2..3bc582b445 100644 --- a/assets/voxygen/i18n/en/buff.ftl +++ b/assets/voxygen/i18n/en/buff.ftl @@ -97,6 +97,9 @@ buff-desc-imminentcritical = Your next attack will critically hit the enemy. ## Fury buff-title-fury = Fury buff-desc-fury = With your fury, you attack more swiftly. +## Sunderer +buff-title-sunderer = Sunderer +buff-desc-sunderer = Your attacks can break through your foes' defences and are more staggering. ## Util buff-text-over_seconds = over { $dur_secs } seconds buff-text-for_seconds = for { $dur_secs } seconds diff --git a/common/src/cmd.rs b/common/src/cmd.rs index ebddaa9888..83d7f3524a 100644 --- a/common/src/cmd.rs +++ b/common/src/cmd.rs @@ -174,6 +174,7 @@ lazy_static! { // BuffKind::SalamanderAspect => "salamander_aspect", BuffKind::ImminentCritical => "imminent_critical", BuffKind::Fury => "fury", + BuffKind::Sunderer => "sunderer", }; let mut buff_parser = HashMap::new(); for kind in BuffKind::iter() { diff --git a/common/src/combat.rs b/common/src/combat.rs index 5e4fd1b066..cccb540a81 100644 --- a/common/src/combat.rs +++ b/common/src/combat.rs @@ -137,8 +137,13 @@ impl Attack { mut emit_outcome: impl FnMut(Outcome), ) -> f32 { if damage.value > 0.0 { - let damage_reduction = + let attacker_penetration = attacker + .and_then(|a| a.stats) + .map_or(0.0, |s| s.mitigations_penetration) + .clamp(0.0, 1.0); + let raw_damage_reduction = Damage::compute_damage_reduction(Some(damage), target.inventory, target.stats, msm); + let damage_reduction = (1.0 - attacker_penetration) * raw_damage_reduction; let block_reduction = if let (Some(char_state), Some(ori)) = (target.char_state, target.ori) { if ori.look_vec().angle_between(-*dir) < char_state.block_angle() { diff --git a/common/src/comp/buff.rs b/common/src/comp/buff.rs index 732da7addd..dc9e45e3c8 100644 --- a/common/src/comp/buff.rs +++ b/common/src/comp/buff.rs @@ -86,6 +86,11 @@ pub enum BuffKind { ImminentCritical, /// Increases attack speed linearly with strength, 1.0 is a 100% increase Fury, + /// Increases poise damage and allows attacks to ignore DR + /// Poise damage increased linearly relative to strength, 1.0 is a 100% + /// increase. DR penetration is non-linear, 0.5 is 50% penetration and 1.0 + /// is a 67% penetration. + Sunderer, // Debuffs /// Does damage to a creature over time. /// Strength should be the DPS of the debuff. @@ -150,7 +155,8 @@ impl BuffKind { | BuffKind::Lifesteal //| BuffKind::SalamanderAspect | BuffKind::ImminentCritical - | BuffKind::Fury => true, + | BuffKind::Fury + | BuffKind::Sunderer => true, BuffKind::Bleeding | BuffKind::Cursed | BuffKind::Burning @@ -344,6 +350,10 @@ impl BuffKind { val: 1.0, }], BuffKind::Fury => vec![BuffEffect::AttackSpeed(1.0 + data.strength)], + BuffKind::Sunderer => vec![ + BuffEffect::AttackPoise(data.strength), + BuffEffect::MitigationsPenetration(nn_scaling(data.strength)), + ], } } @@ -474,6 +484,10 @@ pub enum BuffEffect { BuffOnHit(AttackEffect), BuffImmunity(BuffKind), SwimSpeed(f32), + /// Increases poise damage dealt by attacks + AttackPoise(f32), + /// Ignores some damage reduction on target + MitigationsPenetration(f32), } /// Actual de/buff. diff --git a/common/src/comp/stats.rs b/common/src/comp/stats.rs index 1e65d591b8..d99254a6b1 100644 --- a/common/src/comp/stats.rs +++ b/common/src/comp/stats.rs @@ -66,6 +66,7 @@ pub struct Stats { pub crit_chance_modifier: StatsModifier, pub buffs_on_hit: Vec, pub swim_speed_modifier: f32, + pub mitigations_penetration: f32, } impl Stats { @@ -86,6 +87,7 @@ impl Stats { crit_chance_modifier: StatsModifier::default(), buffs_on_hit: Vec::new(), swim_speed_modifier: 1.0, + mitigations_penetration: 0.0, } } diff --git a/common/systems/src/buff.rs b/common/systems/src/buff.rs index 3b39dbbd27..b63c998fa4 100644 --- a/common/systems/src/buff.rs +++ b/common/systems/src/buff.rs @@ -691,5 +691,11 @@ fn execute_effect( BuffEffect::SwimSpeed(speed) => { stat.swim_speed_modifier *= speed; }, + BuffEffect::AttackPoise(p) => { + stat.poise_damage_modifier *= p; + }, + BuffEffect::MitigationsPenetration(mp) => { + stat.mitigations_penetration *= mp; + }, }; } diff --git a/voxygen/anim/src/character/selfbuff.rs b/voxygen/anim/src/character/selfbuff.rs index 92e1774d33..cb09f92183 100644 --- a/voxygen/anim/src/character/selfbuff.rs +++ b/voxygen/anim/src/character/selfbuff.rs @@ -3,7 +3,7 @@ use super::{ CharacterSkeleton, SkeletonAttr, }; use common::states::utils::{AbilityInfo, StageSection}; -use core::f32::consts::PI; +use core::f32::consts::{PI, TAU}; pub struct SelfBuffAnimation; impl Animation for SelfBuffAnimation { @@ -323,6 +323,43 @@ impl Animation for SelfBuffAnimation { next.control.orientation.rotate_x(move2 * -0.5); next.control.position += Vec3::new(move2 * 9.0, move2 * -3.0, move2 * -14.0); }, + Some("common.abilities.axe.sunder") => { + let (move1_raw, move2_raw, move3) = match stage_section { + Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), + Some(StageSection::Action) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time), + _ => (0.0, 0.0, 0.0), + }; + let pullback = 1.0 - move3; + let move1 = move1_raw * pullback; + let move2 = move2_raw * pullback; + + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + + next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); + next.control.orientation = Quaternion::rotation_x(s_a.ac.3) + * Quaternion::rotation_y(s_a.ac.4) + * Quaternion::rotation_z(s_a.ac.5); + + next.control.orientation.rotate_z(move1 * -1.5); + next.control.position += Vec3::new(move1 * 12.0, 0.0, move1 * 5.0); + next.control.orientation.rotate_y(move1 * 0.5); + next.main.position += Vec3::new(0.0, move1 * 10.0, 0.0); + next.main.orientation.rotate_z(move1_raw * TAU); + next.second.position += Vec3::new(0.0, move1 * 10.0, 0.0); + next.second.orientation.rotate_z(move1_raw * -TAU); + + next.main.orientation.rotate_z(move2_raw * TAU); + next.main.position += Vec3::new(0.0, move2 * -10.0, 0.0); + next.second.orientation.rotate_z(move2_raw * -TAU); + next.second.position += Vec3::new(0.0, move2 * -10.0, 0.0); + next.control.position += Vec3::new(0.0, 0.0, move2 * -5.0); + }, _ => {}, } diff --git a/voxygen/i18n-helpers/src/lib.rs b/voxygen/i18n-helpers/src/lib.rs index ba16a5fad2..7f32fe6a13 100644 --- a/voxygen/i18n-helpers/src/lib.rs +++ b/voxygen/i18n-helpers/src/lib.rs @@ -122,7 +122,8 @@ pub fn localize_chat_message( | BuffKind::Lifesteal // | BuffKind::SalamanderAspect | BuffKind::ImminentCritical - | BuffKind::Fury => { + | BuffKind::Fury + | BuffKind::Sunderer => { tracing::error!("Player was killed by a positive buff!"); "hud-outcome-mysterious" }, diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index c5d634b983..f288e588f4 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -5116,6 +5116,8 @@ pub fn get_buff_image(buff: BuffKind, imgs: &Imgs) -> conrod_core::image::Id { BuffKind::ImminentCritical => imgs.buff_reckless, // TODO: Get buff image BuffKind::Fury => imgs.buff_reckless, + // TODO: Get buff image + BuffKind::Sunderer => imgs.debuff_crippled_0, // Debuffs BuffKind::Bleeding => imgs.debuff_bleed_0, BuffKind::Cursed => imgs.debuff_skull_0, @@ -5154,6 +5156,7 @@ pub fn get_buff_title(buff: BuffKind, localized_strings: &Localization) -> Cow localized_strings.get_msg("buff-title-salamanderaspect"), BuffKind::ImminentCritical => localized_strings.get_msg("buff-title-imminentcritical"), BuffKind::Fury => localized_strings.get_msg("buff-title-fury"), + BuffKind::Sunderer => localized_strings.get_msg("buff-title-sunderer"), // Debuffs BuffKind::Bleeding { .. } => localized_strings.get_msg("buff-title-bleed"), BuffKind::Cursed { .. } => localized_strings.get_msg("buff-title-cursed"), @@ -5199,6 +5202,7 @@ pub fn get_buff_desc(buff: BuffKind, data: BuffData, localized_strings: &Localiz // BuffKind::SalamanderAspect => localized_strings.get_msg("buff-desc-salamanderaspect"), BuffKind::ImminentCritical => localized_strings.get_msg("buff-desc-imminentcritical"), BuffKind::Fury => localized_strings.get_msg("buff-desc-fury"), + BuffKind::Sunderer => localized_strings.get_msg("buff-desc-sunderer"), // Debuffs BuffKind::Bleeding { .. } => localized_strings.get_msg("buff-desc-bleed"), BuffKind::Cursed { .. } => localized_strings.get_msg("buff-desc-cursed"), diff --git a/voxygen/src/hud/util.rs b/voxygen/src/hud/util.rs index 7c174b2aca..96af5faf6e 100644 --- a/voxygen/src/hud/util.rs +++ b/voxygen/src/hud/util.rs @@ -211,7 +211,8 @@ pub fn consumable_desc(effects: &Effects, i18n: &Localization) -> Vec { | BuffKind::Lifesteal // | BuffKind::SalamanderAspect | BuffKind::ImminentCritical - | BuffKind::Fury => Cow::Borrowed(""), + | BuffKind::Fury + | BuffKind::Sunderer => Cow::Borrowed(""), }; write!(&mut description, "{}", buff_desc).unwrap(); @@ -255,7 +256,8 @@ pub fn consumable_desc(effects: &Effects, i18n: &Localization) -> Vec { | BuffKind::Lifesteal // | BuffKind::SalamanderAspect | BuffKind::ImminentCritical - | BuffKind::Fury => Cow::Borrowed(""), + | BuffKind::Fury + | BuffKind::Sunderer => Cow::Borrowed(""), } } else if let BuffKind::Saturation | BuffKind::Regeneration