This commit is contained in:
Sam 2023-05-20 20:21:23 -04:00
parent daea14f8e5
commit 820f8dca94
11 changed files with 91 additions and 28 deletions

View File

@ -1,22 +1,10 @@
ComboMelee2( SelfBuff(
strikes: [ buildup_duration: 0.2,
( cast_duration: 0.2,
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, recover_duration: 0.1,
ori_modifier: 0.6, buff_kind: Sunderer,
), buff_strength: 0.25,
], buff_duration: Some(15.0),
energy_cost_per_strike: 0, combo_cost: 10,
energy_cost: 0,
) )

View File

@ -97,6 +97,9 @@ buff-desc-imminentcritical = Your next attack will critically hit the enemy.
## Fury ## Fury
buff-title-fury = Fury buff-title-fury = Fury
buff-desc-fury = With your fury, you attack more swiftly. 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 ## Util
buff-text-over_seconds = over { $dur_secs } seconds buff-text-over_seconds = over { $dur_secs } seconds
buff-text-for_seconds = for { $dur_secs } seconds buff-text-for_seconds = for { $dur_secs } seconds

View File

@ -174,6 +174,7 @@ lazy_static! {
// BuffKind::SalamanderAspect => "salamander_aspect", // BuffKind::SalamanderAspect => "salamander_aspect",
BuffKind::ImminentCritical => "imminent_critical", BuffKind::ImminentCritical => "imminent_critical",
BuffKind::Fury => "fury", BuffKind::Fury => "fury",
BuffKind::Sunderer => "sunderer",
}; };
let mut buff_parser = HashMap::new(); let mut buff_parser = HashMap::new();
for kind in BuffKind::iter() { for kind in BuffKind::iter() {

View File

@ -137,8 +137,13 @@ impl Attack {
mut emit_outcome: impl FnMut(Outcome), mut emit_outcome: impl FnMut(Outcome),
) -> f32 { ) -> f32 {
if damage.value > 0.0 { 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); Damage::compute_damage_reduction(Some(damage), target.inventory, target.stats, msm);
let damage_reduction = (1.0 - attacker_penetration) * raw_damage_reduction;
let block_reduction = let block_reduction =
if let (Some(char_state), Some(ori)) = (target.char_state, target.ori) { if let (Some(char_state), Some(ori)) = (target.char_state, target.ori) {
if ori.look_vec().angle_between(-*dir) < char_state.block_angle() { if ori.look_vec().angle_between(-*dir) < char_state.block_angle() {

View File

@ -86,6 +86,11 @@ pub enum BuffKind {
ImminentCritical, ImminentCritical,
/// Increases attack speed linearly with strength, 1.0 is a 100% increase /// Increases attack speed linearly with strength, 1.0 is a 100% increase
Fury, 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 // Debuffs
/// Does damage to a creature over time. /// Does damage to a creature over time.
/// Strength should be the DPS of the debuff. /// Strength should be the DPS of the debuff.
@ -150,7 +155,8 @@ impl BuffKind {
| BuffKind::Lifesteal | BuffKind::Lifesteal
//| BuffKind::SalamanderAspect //| BuffKind::SalamanderAspect
| BuffKind::ImminentCritical | BuffKind::ImminentCritical
| BuffKind::Fury => true, | BuffKind::Fury
| BuffKind::Sunderer => true,
BuffKind::Bleeding BuffKind::Bleeding
| BuffKind::Cursed | BuffKind::Cursed
| BuffKind::Burning | BuffKind::Burning
@ -344,6 +350,10 @@ impl BuffKind {
val: 1.0, val: 1.0,
}], }],
BuffKind::Fury => vec![BuffEffect::AttackSpeed(1.0 + data.strength)], 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), BuffOnHit(AttackEffect),
BuffImmunity(BuffKind), BuffImmunity(BuffKind),
SwimSpeed(f32), SwimSpeed(f32),
/// Increases poise damage dealt by attacks
AttackPoise(f32),
/// Ignores some damage reduction on target
MitigationsPenetration(f32),
} }
/// Actual de/buff. /// Actual de/buff.

View File

@ -66,6 +66,7 @@ pub struct Stats {
pub crit_chance_modifier: StatsModifier, pub crit_chance_modifier: StatsModifier,
pub buffs_on_hit: Vec<AttackEffect>, pub buffs_on_hit: Vec<AttackEffect>,
pub swim_speed_modifier: f32, pub swim_speed_modifier: f32,
pub mitigations_penetration: f32,
} }
impl Stats { impl Stats {
@ -86,6 +87,7 @@ impl Stats {
crit_chance_modifier: StatsModifier::default(), crit_chance_modifier: StatsModifier::default(),
buffs_on_hit: Vec::new(), buffs_on_hit: Vec::new(),
swim_speed_modifier: 1.0, swim_speed_modifier: 1.0,
mitigations_penetration: 0.0,
} }
} }

View File

@ -691,5 +691,11 @@ fn execute_effect(
BuffEffect::SwimSpeed(speed) => { BuffEffect::SwimSpeed(speed) => {
stat.swim_speed_modifier *= speed; stat.swim_speed_modifier *= speed;
}, },
BuffEffect::AttackPoise(p) => {
stat.poise_damage_modifier *= p;
},
BuffEffect::MitigationsPenetration(mp) => {
stat.mitigations_penetration *= mp;
},
}; };
} }

View File

@ -3,7 +3,7 @@ use super::{
CharacterSkeleton, SkeletonAttr, CharacterSkeleton, SkeletonAttr,
}; };
use common::states::utils::{AbilityInfo, StageSection}; use common::states::utils::{AbilityInfo, StageSection};
use core::f32::consts::PI; use core::f32::consts::{PI, TAU};
pub struct SelfBuffAnimation; pub struct SelfBuffAnimation;
impl Animation for SelfBuffAnimation { impl Animation for SelfBuffAnimation {
@ -323,6 +323,43 @@ impl Animation for SelfBuffAnimation {
next.control.orientation.rotate_x(move2 * -0.5); next.control.orientation.rotate_x(move2 * -0.5);
next.control.position += Vec3::new(move2 * 9.0, move2 * -3.0, move2 * -14.0); 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);
},
_ => {}, _ => {},
} }

View File

@ -122,7 +122,8 @@ pub fn localize_chat_message(
| BuffKind::Lifesteal | BuffKind::Lifesteal
// | BuffKind::SalamanderAspect // | BuffKind::SalamanderAspect
| BuffKind::ImminentCritical | BuffKind::ImminentCritical
| BuffKind::Fury => { | BuffKind::Fury
| BuffKind::Sunderer => {
tracing::error!("Player was killed by a positive buff!"); tracing::error!("Player was killed by a positive buff!");
"hud-outcome-mysterious" "hud-outcome-mysterious"
}, },

View File

@ -5116,6 +5116,8 @@ pub fn get_buff_image(buff: BuffKind, imgs: &Imgs) -> conrod_core::image::Id {
BuffKind::ImminentCritical => imgs.buff_reckless, BuffKind::ImminentCritical => imgs.buff_reckless,
// TODO: Get buff image // TODO: Get buff image
BuffKind::Fury => imgs.buff_reckless, BuffKind::Fury => imgs.buff_reckless,
// TODO: Get buff image
BuffKind::Sunderer => imgs.debuff_crippled_0,
// Debuffs // Debuffs
BuffKind::Bleeding => imgs.debuff_bleed_0, BuffKind::Bleeding => imgs.debuff_bleed_0,
BuffKind::Cursed => imgs.debuff_skull_0, BuffKind::Cursed => imgs.debuff_skull_0,
@ -5154,6 +5156,7 @@ pub fn get_buff_title(buff: BuffKind, localized_strings: &Localization) -> Cow<s
// BuffKind::SalamanderAspect => localized_strings.get_msg("buff-title-salamanderaspect"), // BuffKind::SalamanderAspect => localized_strings.get_msg("buff-title-salamanderaspect"),
BuffKind::ImminentCritical => localized_strings.get_msg("buff-title-imminentcritical"), BuffKind::ImminentCritical => localized_strings.get_msg("buff-title-imminentcritical"),
BuffKind::Fury => localized_strings.get_msg("buff-title-fury"), BuffKind::Fury => localized_strings.get_msg("buff-title-fury"),
BuffKind::Sunderer => localized_strings.get_msg("buff-title-sunderer"),
// Debuffs // Debuffs
BuffKind::Bleeding { .. } => localized_strings.get_msg("buff-title-bleed"), BuffKind::Bleeding { .. } => localized_strings.get_msg("buff-title-bleed"),
BuffKind::Cursed { .. } => localized_strings.get_msg("buff-title-cursed"), 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::SalamanderAspect => localized_strings.get_msg("buff-desc-salamanderaspect"),
BuffKind::ImminentCritical => localized_strings.get_msg("buff-desc-imminentcritical"), BuffKind::ImminentCritical => localized_strings.get_msg("buff-desc-imminentcritical"),
BuffKind::Fury => localized_strings.get_msg("buff-desc-fury"), BuffKind::Fury => localized_strings.get_msg("buff-desc-fury"),
BuffKind::Sunderer => localized_strings.get_msg("buff-desc-sunderer"),
// Debuffs // Debuffs
BuffKind::Bleeding { .. } => localized_strings.get_msg("buff-desc-bleed"), BuffKind::Bleeding { .. } => localized_strings.get_msg("buff-desc-bleed"),
BuffKind::Cursed { .. } => localized_strings.get_msg("buff-desc-cursed"), BuffKind::Cursed { .. } => localized_strings.get_msg("buff-desc-cursed"),

View File

@ -211,7 +211,8 @@ pub fn consumable_desc(effects: &Effects, i18n: &Localization) -> Vec<String> {
| BuffKind::Lifesteal | BuffKind::Lifesteal
// | BuffKind::SalamanderAspect // | BuffKind::SalamanderAspect
| BuffKind::ImminentCritical | BuffKind::ImminentCritical
| BuffKind::Fury => Cow::Borrowed(""), | BuffKind::Fury
| BuffKind::Sunderer => Cow::Borrowed(""),
}; };
write!(&mut description, "{}", buff_desc).unwrap(); write!(&mut description, "{}", buff_desc).unwrap();
@ -255,7 +256,8 @@ pub fn consumable_desc(effects: &Effects, i18n: &Localization) -> Vec<String> {
| BuffKind::Lifesteal | BuffKind::Lifesteal
// | BuffKind::SalamanderAspect // | BuffKind::SalamanderAspect
| BuffKind::ImminentCritical | BuffKind::ImminentCritical
| BuffKind::Fury => Cow::Borrowed(""), | BuffKind::Fury
| BuffKind::Sunderer => Cow::Borrowed(""),
} }
} else if let BuffKind::Saturation } else if let BuffKind::Saturation
| BuffKind::Regeneration | BuffKind::Regeneration