mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fracture now scales with combo and consumes only half of combo
This commit is contained in:
parent
42e804578e
commit
9a6cb01da3
@ -1,28 +1,29 @@
|
||||
ComboMelee2(
|
||||
strikes: [
|
||||
(
|
||||
melee_constructor: (
|
||||
kind: Slash(
|
||||
damage: 16,
|
||||
poise: 10,
|
||||
knockback: 0,
|
||||
energy_regen: 0,
|
||||
),
|
||||
range: 3.0,
|
||||
angle: 45.0,
|
||||
damage_effect: Some(Buff((
|
||||
kind: Crippled,
|
||||
dur_secs: 10.0,
|
||||
strength: Value(1.0),
|
||||
chance: 1.0,
|
||||
))),
|
||||
),
|
||||
buildup_duration: 0.2,
|
||||
swing_duration: 0.1,
|
||||
hit_timing: 0.5,
|
||||
recover_duration: 0.3,
|
||||
ori_modifier: 0.6,
|
||||
FinisherMelee(
|
||||
energy_cost: 0,
|
||||
buildup_duration: 0.2,
|
||||
swing_duration: 0.1,
|
||||
recover_duration: 0.3,
|
||||
melee_constructor: (
|
||||
kind: Slash(
|
||||
damage: 16,
|
||||
poise: 10,
|
||||
knockback: 0,
|
||||
energy_regen: 0,
|
||||
),
|
||||
],
|
||||
energy_cost_per_strike: 15,
|
||||
range: 3.0,
|
||||
angle: 45.0,
|
||||
damage_effect: Some(Buff((
|
||||
kind: Crippled,
|
||||
dur_secs: 10.0,
|
||||
strength: Value(0.1),
|
||||
chance: 1.0,
|
||||
))),
|
||||
),
|
||||
minimum_combo: 1,
|
||||
scaling: Some((
|
||||
target: Buff,
|
||||
kind: Linear,
|
||||
max_factor: 10,
|
||||
)),
|
||||
combo_consumption: Half,
|
||||
)
|
@ -23,7 +23,7 @@ use crate::{
|
||||
resources::Secs,
|
||||
states::{
|
||||
behavior::JoinData,
|
||||
utils::{AbilityInfo, ScalingKind, StageSection},
|
||||
utils::{AbilityInfo, ComboConsumption, ScalingKind, StageSection},
|
||||
*,
|
||||
},
|
||||
terrain::SpriteKind,
|
||||
@ -950,6 +950,8 @@ pub enum CharacterAbility {
|
||||
minimum_combo: u32,
|
||||
scaling: Option<finisher_melee::Scaling>,
|
||||
#[serde(default)]
|
||||
combo_consumption: ComboConsumption,
|
||||
#[serde(default)]
|
||||
meta: AbilityMeta,
|
||||
},
|
||||
DiveMelee {
|
||||
@ -1603,6 +1605,7 @@ impl CharacterAbility {
|
||||
ref mut melee_constructor,
|
||||
minimum_combo: _,
|
||||
scaling: _,
|
||||
combo_consumption: _,
|
||||
meta: _,
|
||||
} => {
|
||||
*buildup_duration /= stats.speed;
|
||||
@ -2846,6 +2849,7 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
|
||||
melee_constructor,
|
||||
minimum_combo,
|
||||
scaling,
|
||||
combo_consumption,
|
||||
meta: _,
|
||||
} => CharacterState::FinisherMelee(finisher_melee::Data {
|
||||
static_data: finisher_melee::StaticData {
|
||||
@ -2856,6 +2860,7 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
|
||||
scaling: *scaling,
|
||||
minimum_combo: *minimum_combo,
|
||||
combo_on_use: data.combo.map_or(0, |c| c.counter()),
|
||||
combo_consumption: *combo_consumption,
|
||||
ability_info,
|
||||
},
|
||||
timer: Duration::default(),
|
||||
|
@ -1,7 +1,6 @@
|
||||
use crate::{
|
||||
combat::{CombatBuff, CombatEffect},
|
||||
comp::{character_state::OutputEvents, CharacterState, MeleeConstructor, StateUpdate},
|
||||
event::ServerEvent,
|
||||
states::{
|
||||
behavior::{CharacterBehavior, JoinData},
|
||||
utils::*,
|
||||
@ -27,6 +26,7 @@ pub struct StaticData {
|
||||
pub minimum_combo: u32,
|
||||
/// Amount of combo when ability was activated
|
||||
pub combo_on_use: u32,
|
||||
pub combo_consumption: ComboConsumption,
|
||||
/// What key is used to press ability
|
||||
pub ability_info: AbilityInfo,
|
||||
}
|
||||
@ -74,19 +74,19 @@ impl CharacterBehavior for Data {
|
||||
c.exhausted = true;
|
||||
}
|
||||
|
||||
// Consume combo
|
||||
output_events.emit_server(ServerEvent::ComboChange {
|
||||
entity: data.entity,
|
||||
change: -(self.static_data.combo_on_use as i32),
|
||||
});
|
||||
|
||||
self.static_data
|
||||
.combo_consumption
|
||||
.consume(data, output_events);
|
||||
let mut melee_constructor = self.static_data.melee_constructor;
|
||||
|
||||
if let Some(scaling) = self.static_data.scaling {
|
||||
let scaling_factor = scaling.kind.factor(
|
||||
self.static_data.combo_on_use as f32,
|
||||
self.static_data.minimum_combo as f32,
|
||||
);
|
||||
let scaling_factor = scaling
|
||||
.kind
|
||||
.factor(
|
||||
self.static_data.combo_on_use as f32,
|
||||
self.static_data.minimum_combo as f32,
|
||||
)
|
||||
.min(scaling.max_factor);
|
||||
match scaling.target {
|
||||
ScalingTarget::Attack => {
|
||||
melee_constructor =
|
||||
@ -149,8 +149,9 @@ pub enum ScalingTarget {
|
||||
Buff,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Scaling {
|
||||
pub target: ScalingTarget,
|
||||
pub kind: ScalingKind,
|
||||
pub max_factor: f32,
|
||||
}
|
||||
|
@ -1615,3 +1615,27 @@ impl ScalingKind {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum ComboConsumption {
|
||||
All,
|
||||
Half,
|
||||
}
|
||||
|
||||
impl ComboConsumption {
|
||||
pub fn consume(&self, data: &JoinData, output_events: &mut OutputEvents) {
|
||||
let combo = data.combo.map_or(0, |c| c.counter());
|
||||
let to_consume = match self {
|
||||
Self::All => combo,
|
||||
Self::Half => (combo + 1) / 2,
|
||||
};
|
||||
output_events.emit_server(ServerEvent::ComboChange {
|
||||
entity: data.entity,
|
||||
change: -(to_consume as i32),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ComboConsumption {
|
||||
fn default() -> Self { Self::All }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user