mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Addressed comments
This commit is contained in:
parent
04175bab09
commit
05623eb8bd
@ -128,6 +128,7 @@ pub enum CharacterAbility {
|
||||
base_damage: u32,
|
||||
range: f32,
|
||||
max_angle: f32,
|
||||
knockback: f32,
|
||||
leap_speed: f32,
|
||||
leap_vert_speed: f32,
|
||||
},
|
||||
@ -470,6 +471,7 @@ impl From<&CharacterAbility> for CharacterState {
|
||||
base_damage,
|
||||
range,
|
||||
max_angle,
|
||||
knockback,
|
||||
leap_speed,
|
||||
leap_vert_speed,
|
||||
} => CharacterState::LeapMelee(leap_melee::Data {
|
||||
@ -481,6 +483,7 @@ impl From<&CharacterAbility> for CharacterState {
|
||||
base_damage: *base_damage,
|
||||
range: *range,
|
||||
max_angle: *max_angle,
|
||||
knockback: *knockback,
|
||||
leap_speed: *leap_speed,
|
||||
leap_vert_speed: *leap_vert_speed,
|
||||
}),
|
||||
@ -590,7 +593,6 @@ impl From<&CharacterAbility> for CharacterState {
|
||||
current_rep,
|
||||
leap,
|
||||
} => CharacterState::RepeaterRanged(repeater_ranged::Data {
|
||||
exhausted: false,
|
||||
prepare_timer: Duration::default(),
|
||||
holdable: *holdable,
|
||||
movement_duration: *movement_duration,
|
||||
@ -603,7 +605,6 @@ impl From<&CharacterAbility> for CharacterState {
|
||||
projectile_speed: *projectile_speed,
|
||||
repetitions: *repetitions,
|
||||
current_rep: *current_rep,
|
||||
initialize: true,
|
||||
leap: *leap,
|
||||
}),
|
||||
CharacterAbility::GroundShockwave {
|
||||
|
@ -227,15 +227,18 @@ impl Tool {
|
||||
num_spins: 1,
|
||||
},
|
||||
LeapMelee {
|
||||
energy_cost: 300,
|
||||
energy_cost: 450,
|
||||
movement_duration: Duration::from_millis(200),
|
||||
buildup_duration: Duration::from_millis(1000),
|
||||
recover_duration: Duration::from_millis(600),
|
||||
base_damage: (170.0 * self.base_power()) as u32,
|
||||
base_damage: (160.0 * self.base_power()) as u32,
|
||||
range: 3.5,
|
||||
max_angle: 50.0,
|
||||
leap_speed: 20.0,
|
||||
leap_vert_speed: 16.0,
|
||||
max_angle: 120.0,
|
||||
knockback: 15.0,
|
||||
//leap_speed: 20.0,
|
||||
leap_speed: 16.0,
|
||||
leap_vert_speed: 6.0,
|
||||
//leap_vert_speed: 16.0,
|
||||
},
|
||||
],
|
||||
Hammer(_) => vec![
|
||||
@ -269,8 +272,11 @@ impl Tool {
|
||||
base_damage: (240.0 * self.base_power()) as u32,
|
||||
range: 4.5,
|
||||
max_angle: 360.0,
|
||||
knockback: 25.0,
|
||||
leap_speed: 24.0,
|
||||
leap_vert_speed: 8.0,
|
||||
//leap_speed: 24.0,
|
||||
leap_vert_speed: 4.0,
|
||||
//leap_vert_speed: 8.0,
|
||||
},
|
||||
],
|
||||
Farming(_) => vec![BasicMelee {
|
||||
@ -322,11 +328,11 @@ impl Tool {
|
||||
max_projectile_speed: 500.0,
|
||||
},
|
||||
RepeaterRanged {
|
||||
energy_cost: 200,
|
||||
energy_cost: 10,
|
||||
holdable: true,
|
||||
movement_duration: Duration::from_millis(200),
|
||||
prepare_duration: Duration::from_millis(500),
|
||||
recover_duration: Duration::from_millis(1000),
|
||||
prepare_duration: Duration::from_millis(50),
|
||||
recover_duration: Duration::from_millis(500),
|
||||
projectile: Projectile {
|
||||
hit_solid: vec![projectile::Effect::Stick],
|
||||
hit_entity: vec![
|
||||
@ -343,7 +349,7 @@ impl Tool {
|
||||
projectile_light: None,
|
||||
projectile_gravity: Some(Gravity(0.2)),
|
||||
projectile_speed: 100.0,
|
||||
repetitions: 4,
|
||||
repetitions: 5,
|
||||
current_rep: 0,
|
||||
leap: true,
|
||||
},
|
||||
|
@ -42,7 +42,7 @@ impl CharacterBehavior for Data {
|
||||
handle_jump(data, &mut update);
|
||||
|
||||
if self.prepare_duration != Duration::default() {
|
||||
// Prepare (draw the bow)
|
||||
// Prepare (draw back weapon)
|
||||
update.character = CharacterState::ChargedMelee(Data {
|
||||
exhausted: self.exhausted,
|
||||
energy_drain: self.energy_drain,
|
||||
|
@ -24,6 +24,8 @@ pub struct Data {
|
||||
pub range: f32,
|
||||
/// Max angle (45.0 will give you a 90.0 angle window)
|
||||
pub max_angle: f32,
|
||||
/// Knockback
|
||||
pub knockback: f32,
|
||||
/// Leap speed
|
||||
pub leap_speed: f32,
|
||||
/// Leap vertical speed?
|
||||
@ -44,12 +46,11 @@ impl CharacterBehavior for Data {
|
||||
|
||||
if self.movement_duration != Duration::default() {
|
||||
// Jumping
|
||||
//update.vel.0 = Vec3::new(data.inputs.look_dir.x, data.inputs.look_dir.y, 8.0)
|
||||
update.vel.0 = Vec3::new(
|
||||
data.inputs.look_dir.x,
|
||||
data.inputs.look_dir.y,
|
||||
self.leap_vert_speed,
|
||||
) * ((self.movement_duration.as_millis() as f32) / 250.0)
|
||||
) * (2.0)
|
||||
+ (update.vel.0 * Vec3::new(2.0, 2.0, 0.0)
|
||||
+ 0.25 * data.inputs.move_dir.try_normalized().unwrap_or_default())
|
||||
.try_normalized()
|
||||
@ -68,6 +69,7 @@ impl CharacterBehavior for Data {
|
||||
exhausted: false,
|
||||
range: self.range,
|
||||
max_angle: self.max_angle,
|
||||
knockback: self.knockback,
|
||||
leap_speed: self.leap_speed,
|
||||
leap_vert_speed: self.leap_vert_speed,
|
||||
initialize: false,
|
||||
@ -85,6 +87,7 @@ impl CharacterBehavior for Data {
|
||||
exhausted: false,
|
||||
range: self.range,
|
||||
max_angle: self.max_angle,
|
||||
knockback: self.knockback,
|
||||
leap_speed: self.leap_speed,
|
||||
leap_vert_speed: self.leap_vert_speed,
|
||||
initialize: false,
|
||||
@ -95,11 +98,10 @@ impl CharacterBehavior for Data {
|
||||
base_damage: self.base_damage,
|
||||
base_heal: 0,
|
||||
range: self.range,
|
||||
//range: 4.5,
|
||||
max_angle: self.max_angle.to_radians(),
|
||||
applied: false,
|
||||
hit_count: 0,
|
||||
knockback: 25.0,
|
||||
knockback: self.knockback,
|
||||
});
|
||||
|
||||
update.character = CharacterState::LeapMelee(Data {
|
||||
@ -110,6 +112,7 @@ impl CharacterBehavior for Data {
|
||||
exhausted: true,
|
||||
range: self.range,
|
||||
max_angle: self.max_angle,
|
||||
knockback: self.knockback,
|
||||
leap_speed: self.leap_speed,
|
||||
leap_vert_speed: self.leap_vert_speed,
|
||||
initialize: false,
|
||||
@ -128,6 +131,7 @@ impl CharacterBehavior for Data {
|
||||
exhausted: true,
|
||||
range: self.range,
|
||||
max_angle: self.max_angle,
|
||||
knockback: self.knockback,
|
||||
leap_speed: self.leap_speed,
|
||||
leap_vert_speed: self.leap_vert_speed,
|
||||
initialize: false,
|
||||
|
@ -3,6 +3,7 @@ use crate::{
|
||||
event::ServerEvent,
|
||||
states::utils::*,
|
||||
sys::character_behavior::*,
|
||||
util::dir::*,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::time::Duration;
|
||||
@ -25,13 +26,10 @@ pub struct Data {
|
||||
pub projectile_light: Option<LightEmitter>,
|
||||
pub projectile_gravity: Option<Gravity>,
|
||||
pub projectile_speed: f32,
|
||||
/// Whether the attack fired already
|
||||
pub exhausted: bool,
|
||||
/// How many times to repeat
|
||||
pub repetitions: u32,
|
||||
/// Current repetition
|
||||
pub current_rep: u32,
|
||||
pub initialize: bool,
|
||||
/// Whether there should be a jump
|
||||
pub leap: bool,
|
||||
}
|
||||
@ -43,7 +41,7 @@ impl CharacterBehavior for Data {
|
||||
handle_move(data, &mut update, 1.0);
|
||||
handle_jump(data, &mut update);
|
||||
|
||||
if !self.exhausted
|
||||
if self.current_rep <= self.repetitions
|
||||
&& if self.holdable {
|
||||
data.inputs.holding_ability_key() || self.prepare_timer < self.prepare_duration
|
||||
} else {
|
||||
@ -62,10 +60,8 @@ impl CharacterBehavior for Data {
|
||||
projectile_light: self.projectile_light,
|
||||
projectile_gravity: self.projectile_gravity,
|
||||
projectile_speed: self.projectile_speed,
|
||||
exhausted: false,
|
||||
repetitions: self.repetitions,
|
||||
current_rep: self.current_rep,
|
||||
initialize: false,
|
||||
leap: self.leap,
|
||||
});
|
||||
} else if self.movement_duration != Duration::default() {
|
||||
@ -88,18 +84,58 @@ impl CharacterBehavior for Data {
|
||||
projectile_light: self.projectile_light,
|
||||
projectile_gravity: self.projectile_gravity,
|
||||
projectile_speed: self.projectile_speed,
|
||||
exhausted: false,
|
||||
repetitions: self.repetitions,
|
||||
current_rep: self.current_rep,
|
||||
initialize: false,
|
||||
leap: self.leap,
|
||||
});
|
||||
} else if !self.exhausted && self.current_rep < self.repetitions {
|
||||
} else if self.recover_duration != Duration::default() {
|
||||
// Hover
|
||||
update.vel.0 = Vec3::new(data.vel.0[0], data.vel.0[1], 0.0);
|
||||
|
||||
// Recovery
|
||||
update.character = CharacterState::RepeaterRanged(Data {
|
||||
movement_duration: Duration::default(),
|
||||
prepare_timer: self.prepare_timer,
|
||||
holdable: self.holdable,
|
||||
prepare_duration: self.prepare_duration,
|
||||
recover_duration: self
|
||||
.recover_duration
|
||||
.checked_sub(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
projectile: self.projectile.clone(),
|
||||
projectile_body: self.projectile_body,
|
||||
projectile_light: self.projectile_light,
|
||||
projectile_gravity: self.projectile_gravity,
|
||||
projectile_speed: self.projectile_speed,
|
||||
repetitions: self.repetitions,
|
||||
current_rep: self.current_rep,
|
||||
leap: self.leap,
|
||||
});
|
||||
} else if self.current_rep < self.repetitions {
|
||||
// Hover
|
||||
update.vel.0 = Vec3::new(data.vel.0[0], data.vel.0[1], 0.0);
|
||||
|
||||
// Fire
|
||||
let mut projectile = self.projectile.clone();
|
||||
projectile.owner = Some(*data.uid);
|
||||
update.server_events.push_front(ServerEvent::Shoot {
|
||||
entity: data.entity,
|
||||
dir: data.inputs.look_dir,
|
||||
dir: Dir::from_unnormalized(Vec3::new(
|
||||
data.inputs.look_dir[0]
|
||||
+ (if self.current_rep % 2 == 0 {
|
||||
self.current_rep as f32 / 400.0
|
||||
} else {
|
||||
-1.0 * self.current_rep as f32 / 400.0
|
||||
}),
|
||||
data.inputs.look_dir[1]
|
||||
+ (if self.current_rep % 2 == 0 {
|
||||
-1.0 * self.current_rep as f32 / 400.0
|
||||
} else {
|
||||
self.current_rep as f32 / 400.0
|
||||
}),
|
||||
data.inputs.look_dir[2],
|
||||
))
|
||||
.expect("That didn't work"),
|
||||
body: self.projectile_body,
|
||||
projectile,
|
||||
light: self.projectile_light,
|
||||
@ -122,32 +158,8 @@ impl CharacterBehavior for Data {
|
||||
projectile_light: self.projectile_light,
|
||||
projectile_gravity: self.projectile_gravity,
|
||||
projectile_speed: self.projectile_speed,
|
||||
exhausted: false,
|
||||
repetitions: self.repetitions,
|
||||
current_rep: self.current_rep + 1,
|
||||
initialize: false,
|
||||
leap: self.leap,
|
||||
});
|
||||
} else if self.recover_duration != Duration::default() {
|
||||
// Recovery
|
||||
update.character = CharacterState::RepeaterRanged(Data {
|
||||
movement_duration: Duration::default(),
|
||||
prepare_timer: self.prepare_timer,
|
||||
holdable: self.holdable,
|
||||
prepare_duration: self.prepare_duration,
|
||||
recover_duration: self
|
||||
.recover_duration
|
||||
.checked_sub(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
projectile: self.projectile.clone(),
|
||||
projectile_body: self.projectile_body,
|
||||
projectile_light: self.projectile_light,
|
||||
projectile_gravity: self.projectile_gravity,
|
||||
projectile_speed: self.projectile_speed,
|
||||
exhausted: true,
|
||||
repetitions: self.repetitions,
|
||||
current_rep: 0,
|
||||
initialize: false,
|
||||
leap: self.leap,
|
||||
});
|
||||
return update;
|
||||
|
@ -1,5 +1,5 @@
|
||||
mod color;
|
||||
mod dir;
|
||||
pub mod dir;
|
||||
mod option;
|
||||
pub mod userdata_dir;
|
||||
|
||||
|
@ -696,7 +696,6 @@ impl<'a> Widget for Skillbar<'a> {
|
||||
Some(ToolKind::Sword(_)) => self.imgs.twohsword_m2,
|
||||
Some(ToolKind::Dagger(_)) => self.imgs.onehdagger_m2,
|
||||
Some(ToolKind::Shield(_)) => self.imgs.onehshield_m2,
|
||||
//Some(ToolKind::Hammer(_)) => self.imgs.hammerleap,
|
||||
Some(ToolKind::Hammer(_)) => self.imgs.hammergolf,
|
||||
Some(ToolKind::Axe(_)) => self.imgs.axespin,
|
||||
Some(ToolKind::Bow(_)) => self.imgs.bow_m2,
|
||||
|
@ -136,7 +136,7 @@ impl<'a> SlotKey<HotbarSource<'a>, HotbarImageSource<'a>> for HotbarSlot {
|
||||
),
|
||||
HotbarImage::AxeLeapSlash => (
|
||||
image_key,
|
||||
(energy.current() < 300).then_some(Color::Rgba(0.3, 0.3, 0.3, 0.8)),
|
||||
(energy.current() < 450).then_some(Color::Rgba(0.3, 0.3, 0.3, 0.8)),
|
||||
),
|
||||
HotbarImage::BowJumpBurst => (
|
||||
image_key,
|
||||
|
@ -901,7 +901,7 @@ impl FigureMgr {
|
||||
}
|
||||
},
|
||||
CharacterState::RepeaterRanged(data) => {
|
||||
if data.exhausted {
|
||||
if data.current_rep != 0 {
|
||||
anim::character::ShootAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(active_tool_kind, second_tool_kind, vel.0.magnitude(), time),
|
||||
|
Loading…
Reference in New Issue
Block a user