Addressed testing feedback

This commit is contained in:
Sam 2023-07-02 20:50:25 -04:00
parent 4fd1626e5f
commit d6fcd893bf
19 changed files with 153 additions and 67 deletions

View File

@ -2,7 +2,7 @@ SelfBuff(
buildup_duration: 0.3,
cast_duration: 0.2,
recover_duration: 0.1,
buff_kind: Reckless,
buff_kind: Berserk,
buff_strength: 0.5,
buff_duration: Some(15.0),
combo_cost: 10,

View File

@ -2,9 +2,9 @@ SelfBuff(
buildup_duration: 0.2,
cast_duration: 0.2,
recover_duration: 0.1,
buff_kind: Lifesteal,
buff_strength: 0.3,
buff_duration: Some(12.0),
buff_kind: Bloodfeast,
buff_strength: 0.1,
buff_duration: Some(15.0),
energy_cost: 0,
combo_cost: 15,
combo_cost: 10,
)

View File

@ -1,9 +1,9 @@
SelfBuff(
buildup_duration: 0.1,
cast_duration: 0.4,
recover_duration: 0.2,
cast_duration: 3.0,
recover_duration: 0.1,
buff_kind: Defiance,
buff_strength: 0.4,
buff_duration: Some(20.0),
buff_strength: 1.0,
buff_duration: Some(3.0),
energy_cost: 20,
)

View File

@ -3,7 +3,7 @@ SelfBuff(
cast_duration: 0.3,
recover_duration: 0.2,
buff_kind: Fury,
buff_strength: 0.4,
buff_strength: 1.0,
buff_duration: Some(15.0),
energy_cost: 20,
)

View File

@ -5,7 +5,7 @@ FinisherMelee(
recover_duration: 0.5,
melee_constructor: (
kind: Slash(
damage: 50,
damage: 10,
poise: 5,
knockback: 0,
energy_regen: 0,
@ -14,8 +14,8 @@ FinisherMelee(
angle: 45.0,
damage_effect: Some(Buff((
kind: Bleeding,
dur_secs: 15.0,
strength: DamageFraction(0.2),
dur_secs: 5.0,
strength: DamageFraction(1.0),
chance: 1.0,
))),
),

View File

@ -5,7 +5,7 @@ FinisherMelee(
recover_duration: 0.5,
melee_constructor: (
kind: Slash(
damage: 50,
damage: 10,
poise: 5,
knockback: 0,
energy_regen: 0,
@ -15,8 +15,8 @@ FinisherMelee(
multi_target: Some(Normal),
damage_effect: Some(Buff((
kind: Bleeding,
dur_secs: 15.0,
strength: DamageFraction(0.2),
dur_secs: 5.0,
strength: DamageFraction(1.0),
chance: 1.0,
))),
),

View File

@ -16,7 +16,7 @@ ComboMelee2(
hit_timing: 0.5,
recover_duration: 0.3,
ori_modifier: 0.6,
additional_combo: 9,
additional_combo: 4,
),
],
energy_cost_per_strike: 10,

View File

@ -96,13 +96,19 @@ buff-title-imminentcritical = Imminent Critical
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.
buff-desc-fury = With your fury, your strikes generate more combo
## Sunderer
buff-title-sunderer = Sunderer
buff-desc-sunderer = Your attacks can break through your foes' defences and are more staggering.
buff-desc-sunderer = Your attacks can break through your foes' defences and refresh you with more energy.
## Sunderer
buff-title-defiance = Defiance
buff-desc-defiance = You can withstand mightier and more staggering blows
buff-desc-defiance = You can withstand mightier and more staggering blows and generate combo by being hit, however you are slower.
## Bloodfeast
buff-title-bloodfeast = Bloodfeast
buff-desc-bloodfeast = You restore life on attacks against bleeding enemies
## Berserk
buff-title-berserk = Berserk
buff-desc-berserk = You are in a berserking rage, causing your attacks to be more powerful and swift, and increasing your speed. However, as a result your defensive capability is less.
## Util
buff-text-over_seconds = over { $dur_secs } seconds
buff-text-for_seconds = for { $dur_secs } seconds

View File

@ -302,7 +302,7 @@ common-abilities-axe-rake = Rake
Drag your axe across your foe, inducing bleeding
common-abilities-axe-bloodfeast = Bloodfeast
.desc =
Your axe thirsts for the blood of your enemies, replenishing you with each strike
Your axe thirsts for the blood of your enemies, replenishing you with each strike against a bleeding enemy
common-abilities-axe-fierce_raze = Fierce Raze
.desc =
A rapid flurry of strikes on your foe
@ -311,7 +311,7 @@ common-abilities-axe-dual_fierce_raze = Fierce Raze
A rapid flurry of strikes on your foe using both of your axes
common-abilities-axe-furor = Furor
.desc =
As your fury rises, your movement and attacks quicken
As your fury rises, your strikes generate more combo
common-abilities-axe-fracture = Fracture
.desc =
A crippling blow that hampers your foe's movement
@ -330,7 +330,7 @@ common-abilities-axe-skull_bash = Skullbash
A strike with the flat of your axe that can stagger
common-abilities-axe-sunder = Sunder
.desc =
By changing your grip, you become able to bypass your enemy's armor
By changing your grip, you become able to bypass your enemy's armor while restoring your energy more effectively
common-abilities-axe-plunder = Plunder
.desc =
Quickly step towards your foe, robbing them of their balance with a strike

View File

@ -176,6 +176,8 @@ lazy_static! {
BuffKind::Fury => "fury",
BuffKind::Sunderer => "sunderer",
BuffKind::Defiance => "defiance",
BuffKind::Bloodfeast => "bloodfeast",
BuffKind::Berserk => "berserk",
};
let mut buff_parser = HashMap::new();
for kind in BuffKind::iter() {

View File

@ -370,7 +370,8 @@ impl Attack {
entity: attacker.entity,
change: *ec
* compute_energy_reward_mod(attacker.inventory, msm)
* strength_modifier,
* strength_modifier
* attacker.stats.map_or(1.0, |s| s.energy_reward_modifier),
});
}
},
@ -519,7 +520,7 @@ impl Attack {
attacker
.and_then(|attacker| attacker.stats)
.iter()
.flat_map(|stats| stats.buffs_on_hit.iter()),
.flat_map(|stats| stats.effects_on_attack.iter()),
)
.filter(|e| e.target.map_or(true, |t| t == target_group))
.filter(|e| !avoid_effect(e))
@ -566,6 +567,9 @@ impl Attack {
false
}
},
CombatRequirement::TargetHasBuff(buff) => {
target.buffs.map_or(false, |buffs| buffs.contains(*buff))
},
});
if requirements_met {
is_applied = true;
@ -586,7 +590,8 @@ impl Attack {
entity: attacker.entity,
change: ec
* compute_energy_reward_mod(attacker.inventory, msm)
* strength_modifier,
* strength_modifier
* attacker.stats.map_or(1.0, |s| s.energy_reward_modifier),
});
}
},
@ -882,6 +887,12 @@ pub enum CombatRequirement {
AnyDamage,
Energy(f32),
Combo(u32),
TargetHasBuff(BuffKind),
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum DamagedEffect {
Combo(i32),
}
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]

View File

@ -1,6 +1,9 @@
#![allow(clippy::nonstandard_macro_braces)] //tmp as of false positive !?
use crate::{
combat::{AttackEffect, CombatBuff, CombatBuffStrength, CombatEffect},
combat::{
AttackEffect, CombatBuff, CombatBuffStrength, CombatEffect, CombatRequirement,
DamagedEffect,
},
comp::{aura::AuraKey, Health, Stats},
resources::{Secs, Time},
uid::Uid,
@ -74,29 +77,47 @@ pub enum BuffKind {
/// Provides immunity to burning and increases movement speed in lava.
/// Movement speed increases linearly with strength, 1.0 is a 100% increase.
// SalamanderAspect, TODO: Readd in second dwarven mine MR
/// Inflict burning on your attack
/// Your attacks cause targets to receive the burning debuff
/// Strength of burning debuff is a fraction of the damage, fraction
/// increases linearly with strength
Flame,
/// Inflict frost on your attack
/// Your attacks cause targets to receive the frozen debuff
/// Strength of frozen debuff is equal to the strength of this buff
Frigid,
/// Gain Lifesteal on your attack
/// Your attacks have lifesteal
/// Strength increases the fraction of damage restored as life
Lifesteal,
/// Your attacks against bleeding targets have lifesteal
/// Strength increases the fraction of damage restored as life
Bloodfeast,
/// Guarantees that the next attack is a critical hit. Does this kind of
/// hackily by adding 100% to the crit, will need to be adjusted if we ever
/// allow double crits instead of treating 100 as a ceiling.
ImminentCritical,
/// Increases attack speed linearly with strength, 1.0 is a 100% increase
/// Increases combo gain, every 1 strength increases combo per strike by 1,
/// rounds to nearest integer
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.
/// Allows attacks to ignore DR and increases energy reward
/// DR penetration is non-linear, 0.5 is 50% penetration and 1.0 is a 67%
/// penetration. Energy reward is increased linearly to strength, 1.0 is a
/// 200 % increase.
Sunderer,
/// Increases damage resistance and poise resistance. Damage resistance is
/// increased by half of poise resistance. Poise resistance increases
/// non-linearly with strength, 0.5 is 50% and 1.0 is 67%.
/// Damage resistance increases non-linearly with strength, 0.5 is 25% and
/// 1.0 is 33%.
/// Increases damage resistance and poise resistance, causes combo to be
/// generated when damaged, and decreases movement speed.
/// Damage resistance increases non-linearly with strength, 0.5 is 50% and
/// 1.0 is 67%. Poise resistance increases non-linearly with strength, 0.5
/// is 50% and 1.0 is 67%. Movement speed decreases linearly with strength,
/// 0.5 is 50% and 1.0 is 33%. Combo generation is linear with strength, 1.0
/// is 5 combo generated on being hit.
Defiance,
/// Increases both attack damage, vulnerability to damage, attack speed, and
/// movement speed Damage increases linearly with strength, 1.0 is a
/// 100% increase. Damage reduction decreases linearly with strength,
/// 1.0 is a 100% Attack speed increases non-linearly with strength, 0.5
/// is a 25% increase, 1.0 is a 33% increase Movement speed increases
/// non-linearly with strength, 0.5 is a 12.5% increase, 1.0 is a 16.7%
/// increase decrease.
Berserk,
// Debuffs
/// Does damage to a creature over time.
/// Strength should be the DPS of the debuff.
@ -163,7 +184,9 @@ impl BuffKind {
| BuffKind::ImminentCritical
| BuffKind::Fury
| BuffKind::Sunderer
| BuffKind::Defiance => true,
| BuffKind::Defiance
| BuffKind::Bloodfeast
| BuffKind::Berserk => true,
BuffKind::Bleeding
| BuffKind::Cursed
| BuffKind::Burning
@ -326,7 +349,7 @@ impl BuffKind {
BuffEffect::AttackDamage(1.0 + data.strength),
],
BuffKind::Polymorphed(body) => vec![BuffEffect::BodyChange(*body)],
BuffKind::Flame => vec![BuffEffect::BuffOnHit(AttackEffect::new(
BuffKind::Flame => vec![BuffEffect::AttackEffect(AttackEffect::new(
None,
CombatEffect::Buff(CombatBuff {
kind: BuffKind::Burning,
@ -335,16 +358,16 @@ impl BuffKind {
chance: 1.0,
}),
))],
BuffKind::Frigid => vec![BuffEffect::BuffOnHit(AttackEffect::new(
BuffKind::Frigid => vec![BuffEffect::AttackEffect(AttackEffect::new(
None,
CombatEffect::Buff(CombatBuff {
kind: BuffKind::Frozen,
dur_secs: data.secondary_duration.map_or(5.0, |dur| dur.0 as f32),
strength: CombatBuffStrength::DamageFraction(data.strength),
strength: CombatBuffStrength::Value(data.strength),
chance: 1.0,
}),
))],
BuffKind::Lifesteal => vec![BuffEffect::BuffOnHit(AttackEffect::new(
BuffKind::Lifesteal => vec![BuffEffect::AttackEffect(AttackEffect::new(
None,
CombatEffect::Lifesteal(data.strength),
))],
@ -352,18 +375,35 @@ impl BuffKind {
BuffEffect::BuffImmunity(BuffKind::Burning),
BuffEffect::SwimSpeed(1.0 + data.strength),
],*/
BuffKind::Bloodfeast => vec![BuffEffect::AttackEffect(
AttackEffect::new(None, CombatEffect::Lifesteal(data.strength))
.with_requirement(CombatRequirement::TargetHasBuff(BuffKind::Bleeding)),
)],
BuffKind::ImminentCritical => vec![BuffEffect::CriticalChance {
kind: ModifierKind::Additive,
val: 1.0,
}],
BuffKind::Fury => vec![BuffEffect::AttackSpeed(1.0 + data.strength)],
BuffKind::Fury => vec![BuffEffect::AttackEffect(
AttackEffect::new(None, CombatEffect::Combo(data.strength.round() as i32))
.with_requirement(CombatRequirement::AnyDamage),
)],
BuffKind::Sunderer => vec![
BuffEffect::AttackPoise(data.strength),
BuffEffect::MitigationsPenetration(nn_scaling(data.strength)),
BuffEffect::EnergyReward(1.0 + 2.0 * data.strength),
],
BuffKind::Defiance => vec![
BuffEffect::DamageReduction(nn_scaling(data.strength) / 2.0),
BuffEffect::DamageReduction(nn_scaling(data.strength)),
BuffEffect::PoiseReduction(nn_scaling(data.strength)),
BuffEffect::MovementSpeed(1.0 - nn_scaling(data.strength)),
BuffEffect::DamagedEffect(DamagedEffect::Combo(
(data.strength * 5.0).round() as i32
)),
],
BuffKind::Berserk => vec![
BuffEffect::DamageReduction(-data.strength),
BuffEffect::AttackDamage(1.0 + data.strength),
BuffEffect::AttackSpeed(1.0 + nn_scaling(data.strength) / 2.0),
BuffEffect::MovementSpeed(1.0 + nn_scaling(data.strength) / 4.0),
],
}
}
@ -492,14 +532,18 @@ pub enum BuffEffect {
},
/// Changes body.
BodyChange(Body),
/// Inflict buff to target
BuffOnHit(AttackEffect),
BuffImmunity(BuffKind),
SwimSpeed(f32),
/// Add an attack effect to attacks made while buff is active
AttackEffect(AttackEffect),
/// Increases poise damage dealt by attacks
AttackPoise(f32),
/// Ignores some damage reduction on target
MitigationsPenetration(f32),
/// Modifies energy rewarded on successful strikes
EnergyReward(f32),
/// Add an effect to the entity when damaged by an attack
DamagedEffect(DamagedEffect),
}
/// Actual de/buff.

View File

@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize};
use specs::{Component, DerefFlaggedStorage};
use std::{error::Error, fmt};
use crate::combat::AttackEffect;
use crate::combat::{AttackEffect, DamagedEffect};
use super::Body;
@ -64,9 +64,11 @@ pub struct Stats {
pub poise_damage_modifier: f32,
pub attack_damage_modifier: f32,
pub crit_chance_modifier: StatsModifier,
pub buffs_on_hit: Vec<AttackEffect>,
pub swim_speed_modifier: f32,
pub effects_on_attack: Vec<AttackEffect>,
pub mitigations_penetration: f32,
pub energy_reward_modifier: f32,
pub effects_on_damaged: Vec<DamagedEffect>,
}
impl Stats {
@ -85,9 +87,11 @@ impl Stats {
poise_damage_modifier: 1.0,
attack_damage_modifier: 1.0,
crit_chance_modifier: StatsModifier::default(),
buffs_on_hit: Vec::new(),
swim_speed_modifier: 1.0,
effects_on_attack: Vec::new(),
mitigations_penetration: 0.0,
energy_reward_modifier: 1.0,
effects_on_damaged: Vec::new(),
}
}

View File

@ -904,7 +904,7 @@ pub fn handle_wallrun(data: &JoinData<'_>, update: &mut StateUpdate) -> bool {
pub fn attempt_swap_equipped_weapons(
data: &JoinData<'_>,
update: &mut StateUpdate,
output_events: &mut OutputEvents,
_output_events: &mut OutputEvents,
) {
if data
.inventory
@ -915,7 +915,6 @@ pub fn attempt_swap_equipped_weapons(
.and_then(|inv| inv.equipped(EquipSlot::InactiveOffhand))
.is_some()
{
loadout_change_hook(data, output_events);
update.swap_equipped_weapons = true;
}
}

View File

@ -678,7 +678,6 @@ fn execute_effect(
*body_override = Some(*b)
}
},
BuffEffect::BuffOnHit(effect) => stat.buffs_on_hit.push(effect.clone()),
BuffEffect::BuffImmunity(buff_kind) => {
if buffs_comp.contains(*buff_kind) {
server_emitter.emit(ServerEvent::Buff {
@ -690,6 +689,7 @@ fn execute_effect(
BuffEffect::SwimSpeed(speed) => {
stat.swim_speed_modifier *= speed;
},
BuffEffect::AttackEffect(effect) => stat.effects_on_attack.push(effect.clone()),
BuffEffect::AttackPoise(p) => {
stat.poise_damage_modifier *= p;
},
@ -697,5 +697,9 @@ fn execute_effect(
stat.mitigations_penetration =
1.0 - ((1.0 - stat.mitigations_penetration) * (1.0 - *mp));
},
BuffEffect::EnergyReward(er) => {
stat.energy_reward_modifier *= er;
},
BuffEffect::DamagedEffect(effect) => stat.effects_on_damaged.push(effect.clone()),
};
}

View File

@ -1539,6 +1539,18 @@ pub fn handle_entity_attacked_hook(
});
}
}
let stats = ecs.read_storage::<Stats>();
if let Some(stats) = stats.get(entity) {
for effect in &stats.effects_on_damaged {
use combat::DamagedEffect;
match effect {
DamagedEffect::Combo(c) => {
server_eventbus.emit_now(ServerEvent::ComboChange { entity, change: *c });
},
}
}
}
}
pub fn handle_change_ability(

View File

@ -124,7 +124,9 @@ pub fn localize_chat_message(
| BuffKind::ImminentCritical
| BuffKind::Fury
| BuffKind::Sunderer
| BuffKind::Defiance => {
| BuffKind::Defiance
| BuffKind::Bloodfeast
| BuffKind::Berserk => {
tracing::error!("Player was killed by a positive buff!");
"hud-outcome-mysterious"
},

View File

@ -5112,18 +5112,12 @@ pub fn get_buff_image(buff: BuffKind, imgs: &Imgs) -> conrod_core::image::Id {
BuffKind::Lifesteal => imgs.buff_plus_0,
// TODO: Get image
// BuffKind::SalamanderAspect => imgs.debuff_burning_0,
// TODO: Get buff image
BuffKind::ImminentCritical => imgs.buff_reckless,
// TODO: Get buff image
BuffKind::Fury => imgs.buff_reckless,
// TODO: Get buff image
BuffKind::Sunderer => imgs.debuff_crippled_0,
// TODO: Get buff image
BuffKind::Defiance => imgs.buff_fortitude_0,
BuffKind::ImminentCritical => imgs.buff_imminentcritical,
BuffKind::Fury => imgs.buff_fury,
BuffKind::Sunderer => imgs.buff_sunderer,
BuffKind::Defiance => imgs.buff_defiance,
BuffKind::Bloodfeast => imgs.buff_plus_0,
BuffKind::Berserk => imgs.buff_reckless,
// Debuffs
BuffKind::Bleeding => imgs.debuff_bleed_0,
BuffKind::Cursed => imgs.debuff_skull_0,
@ -5163,6 +5157,8 @@ pub fn get_buff_title(buff: BuffKind, localized_strings: &Localization) -> Cow<s
BuffKind::Fury => localized_strings.get_msg("buff-title-fury"),
BuffKind::Sunderer => localized_strings.get_msg("buff-title-sunderer"),
BuffKind::Defiance => localized_strings.get_msg("buff-title-defiance"),
BuffKind::Bloodfeast => localized_strings.get_msg("buff-title-bloodfeast"),
BuffKind::Berserk => localized_strings.get_msg("buff-title-berserk"),
// Debuffs
BuffKind::Bleeding => localized_strings.get_msg("buff-title-bleed"),
BuffKind::Cursed => localized_strings.get_msg("buff-title-cursed"),
@ -5207,6 +5203,8 @@ pub fn get_buff_desc(buff: BuffKind, data: BuffData, localized_strings: &Localiz
BuffKind::Fury => localized_strings.get_msg("buff-desc-fury"),
BuffKind::Sunderer => localized_strings.get_msg("buff-desc-sunderer"),
BuffKind::Defiance => localized_strings.get_msg("buff-desc-defiance"),
BuffKind::Bloodfeast => localized_strings.get_msg("buff-desc-bloodfeast"),
BuffKind::Berserk => localized_strings.get_msg("buff-desc-berserk"),
// Debuffs
BuffKind::Bleeding => localized_strings.get_msg("buff-desc-bleed"),
BuffKind::Cursed => localized_strings.get_msg("buff-desc-cursed"),

View File

@ -213,7 +213,9 @@ pub fn consumable_desc(effects: &Effects, i18n: &Localization) -> Vec<String> {
| BuffKind::ImminentCritical
| BuffKind::Fury
| BuffKind::Sunderer
| BuffKind::Defiance => Cow::Borrowed(""),
| BuffKind::Defiance
| BuffKind::Bloodfeast
| BuffKind::Berserk => Cow::Borrowed(""),
};
write!(&mut description, "{}", buff_desc).unwrap();
@ -259,7 +261,9 @@ pub fn consumable_desc(effects: &Effects, i18n: &Localization) -> Vec<String> {
| BuffKind::ImminentCritical
| BuffKind::Fury
| BuffKind::Sunderer
| BuffKind::Defiance => Cow::Borrowed(""),
| BuffKind::Defiance
| BuffKind::Bloodfeast
| BuffKind::Berserk => Cow::Borrowed(""),
}
} else if let BuffKind::Saturation
| BuffKind::Regeneration