mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Mobility abilities
This commit is contained in:
parent
500e0ae3d0
commit
5d643f430a
@ -1,25 +1,12 @@
|
||||
// TODO: Make actual ability, just for testing right now
|
||||
BasicMelee(
|
||||
energy_cost: 50,
|
||||
buildup_duration: 0.3,
|
||||
swing_duration: 0.1,
|
||||
recover_duration: 0.2,
|
||||
melee_constructor: (
|
||||
kind: Stab(
|
||||
damage: 10,
|
||||
poise: 0,
|
||||
knockback: 0,
|
||||
energy_regen: 0,
|
||||
),
|
||||
range: 5.0,
|
||||
angle: 10.0,
|
||||
),
|
||||
ori_modifier: 1.0,
|
||||
SelfBuff(
|
||||
buildup_duration: 0.15,
|
||||
cast_duration: 0.4,
|
||||
recover_duration: 0.25,
|
||||
buff_kind: Hastened,
|
||||
buff_strength: 0.5,
|
||||
buff_duration: Some(20.0),
|
||||
energy_cost: 40,
|
||||
meta: (
|
||||
kind: Some(Sword(Balanced)),
|
||||
capabilities: (
|
||||
// Block
|
||||
bits: 0b00000010,
|
||||
),
|
||||
kind: Some(Sword(Mobility)),
|
||||
),
|
||||
)
|
||||
)
|
@ -1,25 +1,81 @@
|
||||
// TODO: Make actual ability, just for testing right now
|
||||
BasicMelee(
|
||||
energy_cost: 50,
|
||||
buildup_duration: 0.3,
|
||||
swing_duration: 0.1,
|
||||
recover_duration: 0.2,
|
||||
melee_constructor: (
|
||||
kind: Stab(
|
||||
damage: 10,
|
||||
poise: 0,
|
||||
knockback: 0,
|
||||
energy_regen: 0,
|
||||
ComboMelee2(
|
||||
strikes: [
|
||||
(
|
||||
melee_constructor: (
|
||||
kind: Slash(
|
||||
damage: 10,
|
||||
poise: 0,
|
||||
knockback: 0,
|
||||
energy_regen: 5,
|
||||
),
|
||||
range: 3.0,
|
||||
angle: 45.0,
|
||||
),
|
||||
buildup_duration: 0.3,
|
||||
swing_duration: 0.1,
|
||||
hit_timing: 0.5,
|
||||
recover_duration: 0.5,
|
||||
ori_modifier: 0.6,
|
||||
),
|
||||
range: 5.0,
|
||||
angle: 10.0,
|
||||
),
|
||||
ori_modifier: 1.0,
|
||||
(
|
||||
melee_constructor: (
|
||||
kind: Slash(
|
||||
damage: 14,
|
||||
poise: 0,
|
||||
knockback: 0,
|
||||
energy_regen: 8,
|
||||
),
|
||||
range: 3.0,
|
||||
angle: 45.0,
|
||||
),
|
||||
buildup_duration: 0.3,
|
||||
swing_duration: 0.1,
|
||||
hit_timing: 0.5,
|
||||
recover_duration: 0.3,
|
||||
ori_modifier: 0.6,
|
||||
),
|
||||
(
|
||||
melee_constructor: (
|
||||
kind: Slash(
|
||||
damage: 9,
|
||||
poise: 0,
|
||||
knockback: 0,
|
||||
energy_regen: 10,
|
||||
),
|
||||
range: 3.0,
|
||||
angle: 45.0,
|
||||
),
|
||||
buildup_duration: 0.2,
|
||||
swing_duration: 0.05,
|
||||
hit_timing: 0.5,
|
||||
recover_duration: 0.1,
|
||||
ori_modifier: 0.6,
|
||||
),
|
||||
(
|
||||
melee_constructor: (
|
||||
kind: Slash(
|
||||
damage: 12,
|
||||
poise: 0,
|
||||
knockback: 0,
|
||||
energy_regen: 10,
|
||||
),
|
||||
range: 3.0,
|
||||
angle: 45.0,
|
||||
),
|
||||
buildup_duration: 0.2,
|
||||
swing_duration: 0.05,
|
||||
hit_timing: 0.5,
|
||||
recover_duration: 0.4,
|
||||
ori_modifier: 0.6,
|
||||
),
|
||||
],
|
||||
is_stance: true,
|
||||
energy_cost_per_strike: 10,
|
||||
meta: (
|
||||
kind: Some(Sword(Balanced)),
|
||||
kind: Some(Sword(Mobility)),
|
||||
capabilities: (
|
||||
// Block
|
||||
bits: 0b00000010,
|
||||
// Rolling can interrupt attack
|
||||
bits: 0b00000001,
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
@ -1,25 +1,31 @@
|
||||
// TODO: Make actual ability, just for testing right now
|
||||
BasicMelee(
|
||||
energy_cost: 50,
|
||||
buildup_duration: 0.3,
|
||||
swing_duration: 0.1,
|
||||
recover_duration: 0.2,
|
||||
melee_constructor: (
|
||||
kind: Stab(
|
||||
damage: 10,
|
||||
poise: 0,
|
||||
knockback: 0,
|
||||
energy_regen: 0,
|
||||
ComboMelee2(
|
||||
strikes: [
|
||||
(
|
||||
melee_constructor: (
|
||||
kind: Slash(
|
||||
damage: 15,
|
||||
poise: 0,
|
||||
knockback: 0,
|
||||
energy_regen: 10,
|
||||
),
|
||||
range: 6.0,
|
||||
angle: 5.0,
|
||||
),
|
||||
buildup_duration: 0.2,
|
||||
swing_duration: 0.1,
|
||||
hit_timing: 0.6,
|
||||
recover_duration: 0.4,
|
||||
movement: (
|
||||
buildup: Some(Sideways(2.0)),
|
||||
swing: None,
|
||||
recover: None,
|
||||
),
|
||||
ori_modifier: 0.6,
|
||||
),
|
||||
range: 5.0,
|
||||
angle: 10.0,
|
||||
),
|
||||
ori_modifier: 1.0,
|
||||
],
|
||||
is_stance: false,
|
||||
energy_cost_per_strike: 15,
|
||||
meta: (
|
||||
kind: Some(Sword(Balanced)),
|
||||
capabilities: (
|
||||
// Block
|
||||
bits: 0b00000010,
|
||||
),
|
||||
kind: Some(Sword(Mobility)),
|
||||
),
|
||||
)
|
||||
)
|
@ -23,6 +23,7 @@ use core::hash::BuildHasherDefault;
|
||||
use fxhash::FxHasher64;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{
|
||||
f32::consts::PI,
|
||||
ops::{Add, Div},
|
||||
time::Duration,
|
||||
};
|
||||
@ -428,6 +429,29 @@ pub fn handle_forced_movement(
|
||||
Vec2::broadcast(data.dt.0) * accel * -Vec2::from(update.ori) * strength;
|
||||
}
|
||||
},
|
||||
ForcedMovement::Sideways(strength) => {
|
||||
let strength = strength * data.stats.move_speed_modifier * data.stats.friction_modifier;
|
||||
if let Some(accel) = data.physics.on_ground.map(|block| {
|
||||
// FRIC_GROUND temporarily used to normalize things around expected values
|
||||
data.body.base_accel() * block.get_traction() * block.get_friction() / FRIC_GROUND
|
||||
}) {
|
||||
let direction = {
|
||||
// Left if positive, else right
|
||||
let side = Vec2::from(update.ori)
|
||||
.rotated_z(PI / 2.)
|
||||
.dot(data.inputs.move_dir)
|
||||
.signum();
|
||||
if side > 0.0 {
|
||||
Vec2::from(update.ori).rotated_z(PI / 2.)
|
||||
} else {
|
||||
-Vec2::from(update.ori).rotated_z(PI / 2.)
|
||||
}
|
||||
};
|
||||
|
||||
update.vel.0 +=
|
||||
Vec2::broadcast(data.dt.0) * accel * direction * strength;
|
||||
}
|
||||
},
|
||||
ForcedMovement::Leap {
|
||||
vertical,
|
||||
forward,
|
||||
@ -1216,6 +1240,7 @@ pub enum StageSection {
|
||||
pub enum ForcedMovement {
|
||||
Forward(f32),
|
||||
Reverse(f32),
|
||||
Sideways(f32),
|
||||
Leap {
|
||||
vertical: f32,
|
||||
forward: f32,
|
||||
|
Loading…
Reference in New Issue
Block a user