mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Generalize rotation time
This commit is contained in:
parent
a27b086401
commit
1337fdaa57
@ -14,4 +14,4 @@ DashMelee(
|
||||
recover_duration: 500,
|
||||
infinite_charge: true,
|
||||
is_interruptible: true,
|
||||
)
|
||||
)
|
||||
|
@ -9,7 +9,7 @@ DashMelee(
|
||||
energy_drain: 0,
|
||||
forward_speed: 2.0,
|
||||
buildup_duration: 500,
|
||||
charge_duration: 1300,
|
||||
charge_duration: 1200,
|
||||
swing_duration: 100,
|
||||
recover_duration: 500,
|
||||
infinite_charge: true,
|
||||
|
@ -7,7 +7,7 @@ LeapMelee(
|
||||
base_damage: 240,
|
||||
knockback: 12.0,
|
||||
range: 4.5,
|
||||
max_angle: 30.0,
|
||||
forward_leap_strength: 30.0,
|
||||
vertical_leap_strength: 18.0,
|
||||
max_angle: 180.0,
|
||||
forward_leap_strength: 40.0,
|
||||
vertical_leap_strength: 10.0,
|
||||
)
|
||||
|
@ -14,4 +14,4 @@ DashMelee(
|
||||
recover_duration: 500,
|
||||
infinite_charge: true,
|
||||
is_interruptible: true,
|
||||
)
|
||||
)
|
||||
|
@ -219,7 +219,9 @@ pub fn handle_forced_movement(
|
||||
|
||||
pub fn handle_orientation(data: &JoinData, update: &mut StateUpdate, rate: f32) {
|
||||
// Set direction based on move direction
|
||||
let ori_dir = if update.character.is_aimed() && data.body.is_humanoid() {
|
||||
let ori_dir = if (update.character.is_aimed() && data.body.is_humanoid())
|
||||
|| update.character.is_attack()
|
||||
{
|
||||
data.inputs.look_dir.xy()
|
||||
} else if !data.inputs.move_dir.is_approx_zero() {
|
||||
data.inputs.move_dir
|
||||
|
@ -392,9 +392,13 @@ impl<'a> System<'a> for Sys {
|
||||
|
||||
let eye_offset = body.map_or(0.0, |b| b.eye_height());
|
||||
|
||||
let tgt_eye_offset =
|
||||
let mut tgt_eye_offset =
|
||||
bodies.get(*target).map_or(0.0, |b| b.eye_height());
|
||||
|
||||
if tactic == Tactic::QuadMedJump {
|
||||
tgt_eye_offset += 2.0;
|
||||
}
|
||||
|
||||
let distance_offset = match tactic {
|
||||
Tactic::Bow => 0.0004 * pos.0.distance_squared(tgt_pos.0),
|
||||
Tactic::Staff => 0.0015 * pos.0.distance_squared(tgt_pos.0),
|
||||
@ -475,12 +479,10 @@ impl<'a> System<'a> for Sys {
|
||||
&& dist_sqrd < (1.5 * MIN_ATTACK_DIST * scale).powf(2.0))
|
||||
|| dist_sqrd < (MIN_ATTACK_DIST * scale).powf(2.0)
|
||||
{
|
||||
controller.actions.push(ControlAction::Wield);
|
||||
// Movement
|
||||
match tactic {
|
||||
Tactic::Wolf | Tactic::Ram => {
|
||||
// Run away from target to get clear
|
||||
controller.actions.push(ControlAction::Unwield);
|
||||
inputs.move_dir = (pos.0 - tgt_pos.0)
|
||||
.xy()
|
||||
.try_normalized()
|
||||
@ -502,7 +504,11 @@ impl<'a> System<'a> for Sys {
|
||||
inputs.move_dir = Vec2::zero();
|
||||
},
|
||||
Tactic::QuadMedJump => {
|
||||
inputs.move_dir = Vec2::zero();
|
||||
inputs.move_dir = (tgt_pos.0 - pos.0)
|
||||
.xy()
|
||||
.try_normalized()
|
||||
.unwrap_or(Vec2::unit_y())
|
||||
* 0.05;
|
||||
},
|
||||
_ => {
|
||||
inputs.move_dir = (tgt_pos.0 - pos.0)
|
||||
@ -601,29 +607,30 @@ impl<'a> System<'a> for Sys {
|
||||
&& dist_sqrd < (16.0 * MIN_ATTACK_DIST * scale).powf(2.0)
|
||||
&& dist_sqrd > (15.0 * MIN_ATTACK_DIST * scale).powf(2.0)
|
||||
{
|
||||
if *powerup < 2.0 {
|
||||
controller.actions.push(ControlAction::Unwield);
|
||||
let movement_interval = match tactic {
|
||||
Tactic::Wolf => 2.0,
|
||||
Tactic::Ram => 1.0,
|
||||
_ => 4.0,
|
||||
};
|
||||
if *powerup < movement_interval {
|
||||
inputs.move_dir = (tgt_pos.0 - pos.0)
|
||||
.xy()
|
||||
.rotated_z(0.45 * PI)
|
||||
.rotated_z(0.47 * PI)
|
||||
.try_normalized()
|
||||
.unwrap_or(Vec2::unit_y());
|
||||
*powerup += dt.0;
|
||||
} else if *powerup < 2.5 {
|
||||
controller.actions.push(ControlAction::Wield);
|
||||
inputs.primary.set_state(true);
|
||||
} else if *powerup < movement_interval + 0.5 {
|
||||
inputs.secondary.set_state(true);
|
||||
*powerup += dt.0;
|
||||
} else if *powerup < 4.5 {
|
||||
controller.actions.push(ControlAction::Unwield);
|
||||
} else if *powerup < 2.0 * movement_interval + 0.5 {
|
||||
inputs.move_dir = (tgt_pos.0 - pos.0)
|
||||
.xy()
|
||||
.rotated_z(-0.45 * PI)
|
||||
.rotated_z(-0.47 * PI)
|
||||
.try_normalized()
|
||||
.unwrap_or(Vec2::unit_y());
|
||||
*powerup += dt.0;
|
||||
} else if *powerup < 5.0 {
|
||||
controller.actions.push(ControlAction::Wield);
|
||||
inputs.primary.set_state(true);
|
||||
} else if *powerup < 2.0 * movement_interval + 1.0 {
|
||||
inputs.secondary.set_state(true);
|
||||
*powerup += dt.0;
|
||||
} else {
|
||||
*powerup = 0.0;
|
||||
|
Loading…
Reference in New Issue
Block a user