mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Better equip durations, fix roll bug, slow down while attacking, smoother gliding, stronger npcs, giants
This commit is contained in:
parent
e573fbbce5
commit
8010e5afb4
@ -6,7 +6,7 @@ Item(
|
||||
kind: Tool(
|
||||
ToolData (
|
||||
kind: Hammer(BasicHammer),
|
||||
equip_time_millis: 600,
|
||||
equip_time_millis: 500,
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -5,7 +5,7 @@ Item(
|
||||
kind: Tool(
|
||||
ToolData (
|
||||
kind: Sword(Short0),
|
||||
equip_time_millis: 800,
|
||||
equip_time_millis: 400,
|
||||
)
|
||||
),
|
||||
)
|
||||
|
@ -6,7 +6,7 @@ Item(
|
||||
kind: Tool(
|
||||
ToolData (
|
||||
kind: Staff(BasicStaff),
|
||||
equip_time_millis: 800,
|
||||
equip_time_millis: 200,
|
||||
)
|
||||
),
|
||||
)
|
||||
|
@ -5,7 +5,7 @@ Item(
|
||||
kind: Tool(
|
||||
ToolData (
|
||||
kind: Staff(Sceptre),
|
||||
equip_time_millis: 800,
|
||||
equip_time_millis: 400,
|
||||
)
|
||||
),
|
||||
)
|
||||
|
@ -6,7 +6,7 @@ Item(
|
||||
kind: Tool(
|
||||
ToolData (
|
||||
kind: Axe(BasicAxe),
|
||||
equip_time_millis: 700,
|
||||
equip_time_millis: 400,
|
||||
)
|
||||
),
|
||||
)
|
||||
|
@ -6,7 +6,7 @@ Item(
|
||||
kind: Tool(
|
||||
ToolData (
|
||||
kind: Bow(BasicBow),
|
||||
equip_time_millis: 800,
|
||||
equip_time_millis: 400,
|
||||
)
|
||||
),
|
||||
)
|
||||
|
@ -6,7 +6,7 @@ Item(
|
||||
kind: Tool(
|
||||
ToolData (
|
||||
kind: Hammer(BasicHammer),
|
||||
equip_time_millis: 600,
|
||||
equip_time_millis: 500,
|
||||
)
|
||||
),
|
||||
)
|
||||
|
@ -6,7 +6,7 @@ Item(
|
||||
kind: Tool(
|
||||
ToolData (
|
||||
kind: Staff(BasicStaff),
|
||||
equip_time_millis: 800,
|
||||
equip_time_millis: 300,
|
||||
)
|
||||
),
|
||||
)
|
||||
|
@ -6,7 +6,7 @@ Item(
|
||||
kind: Tool(
|
||||
ToolData (
|
||||
kind: Sword(BasicSword),
|
||||
equip_time_millis: 800,
|
||||
equip_time_millis: 300,
|
||||
)
|
||||
),
|
||||
)
|
||||
|
@ -5,7 +5,7 @@ Item(
|
||||
kind: Tool(
|
||||
ToolData (
|
||||
kind: Sword(WoodTraining),
|
||||
equip_time_millis: 800,
|
||||
equip_time_millis: 400,
|
||||
)
|
||||
),
|
||||
)
|
||||
|
@ -5,7 +5,7 @@ Item(
|
||||
kind: Tool(
|
||||
ToolData (
|
||||
kind: Sword(Zweihander0),
|
||||
equip_time_millis: 800,
|
||||
equip_time_millis: 500,
|
||||
)
|
||||
),
|
||||
)
|
||||
|
@ -57,6 +57,7 @@ impl CharacterAbility {
|
||||
CharacterAbility::Roll => {
|
||||
data.physics.on_ground
|
||||
&& data.body.is_humanoid()
|
||||
&& data.vel.0.xy().magnitude_squared() > 0.5
|
||||
&& update
|
||||
.energy
|
||||
.try_change_by(-150, EnergySource::Ability)
|
||||
|
@ -14,7 +14,7 @@ impl CharacterBehavior for Data {
|
||||
fn behavior(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
|
||||
handle_move(&data, &mut update);
|
||||
handle_move(&data, &mut update, 0.4);
|
||||
|
||||
if !data.physics.on_ground
|
||||
|| !(data.inputs.secondary.is_pressed() || data.inputs.primary.is_pressed())
|
||||
|
@ -25,7 +25,7 @@ impl CharacterBehavior for Data {
|
||||
fn behavior(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
|
||||
handle_move(data, &mut update);
|
||||
handle_move(data, &mut update, 0.7);
|
||||
handle_jump(data, &mut update);
|
||||
|
||||
if self.buildup_duration != Duration::default() {
|
||||
|
@ -26,7 +26,7 @@ impl CharacterBehavior for Data {
|
||||
fn behavior(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
|
||||
handle_move(data, &mut update);
|
||||
handle_move(data, &mut update, 0.5);
|
||||
handle_jump(data, &mut update);
|
||||
|
||||
if self.prepare_timer < self.prepare_duration
|
||||
|
@ -16,7 +16,7 @@ impl CharacterBehavior for Data {
|
||||
fn behavior(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
|
||||
handle_move(data, &mut update);
|
||||
handle_move(data, &mut update, 1.0);
|
||||
|
||||
// Still going
|
||||
if self.duration != Duration::default() {
|
||||
|
@ -72,7 +72,7 @@ impl CharacterBehavior for Data {
|
||||
});
|
||||
} else if self.recover_duration != Duration::default() {
|
||||
// Recovery
|
||||
handle_move(data, &mut update);
|
||||
handle_move(data, &mut update, 0.7);
|
||||
update.character = CharacterState::DashMelee(Data {
|
||||
buildup_duration: self.buildup_duration,
|
||||
recover_duration: self
|
||||
|
@ -15,7 +15,7 @@ impl CharacterBehavior for Data {
|
||||
fn behavior(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
|
||||
handle_move(&data, &mut update);
|
||||
handle_move(&data, &mut update, 1.0);
|
||||
handle_jump(&data, &mut update);
|
||||
|
||||
if self.time_left == Duration::default() {
|
||||
|
@ -19,12 +19,14 @@ impl CharacterBehavior for Data {
|
||||
|
||||
// If glide button isn't held or player is on ground, end glide
|
||||
if !data.inputs.glide.is_pressed() || data.physics.on_ground {
|
||||
update.character = CharacterState::Idle {};
|
||||
update.character = CharacterState::Idle;
|
||||
return update;
|
||||
}
|
||||
|
||||
// If there is a wall in front of character go to climb
|
||||
if let Some(_) = data.physics.on_wall {
|
||||
update.character = CharacterState::Climb {};
|
||||
update.character = CharacterState::Climb;
|
||||
return update;
|
||||
}
|
||||
|
||||
// Move player according to movement direction vector
|
||||
@ -38,7 +40,7 @@ impl CharacterBehavior for Data {
|
||||
|
||||
// Determine orientation vector from movement direction vector
|
||||
let ori_dir = Vec2::from(update.vel.0);
|
||||
update.ori.0 = safe_slerp(update.ori.0, ori_dir.into(), 2.0 * data.dt.0);
|
||||
update.ori.0 = safe_slerp(update.ori.0, ori_dir.into(), 0.1);
|
||||
|
||||
// Apply Glide antigrav lift
|
||||
if Vec2::<f32>::from(update.vel.0).magnitude_squared() < GLIDE_SPEED.powf(2.0)
|
||||
@ -53,6 +55,7 @@ impl CharacterBehavior for Data {
|
||||
}
|
||||
|
||||
// Otherwise keep gliding
|
||||
update.character = CharacterState::Glide;
|
||||
update
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ impl CharacterBehavior for Data {
|
||||
fn behavior(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
|
||||
handle_move(data, &mut update);
|
||||
handle_move(data, &mut update, 1.0);
|
||||
handle_jump(data, &mut update);
|
||||
handle_primary_wield(data, &mut update);
|
||||
handle_climb(data, &mut update);
|
||||
|
@ -28,16 +28,16 @@ const BASE_HUMANOID_WATER_SPEED: f32 = 120.0;
|
||||
// const CLIMB_COST: i32 = 5;
|
||||
|
||||
/// Handles updating `Components` to move player based on state of `JoinData`
|
||||
pub fn handle_move(data: &JoinData, update: &mut StateUpdate) {
|
||||
pub fn handle_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32) {
|
||||
if data.physics.in_fluid {
|
||||
swim_move(data, update);
|
||||
swim_move(data, update, efficiency);
|
||||
} else {
|
||||
basic_move(data, update);
|
||||
basic_move(data, update, efficiency);
|
||||
}
|
||||
}
|
||||
|
||||
/// Updates components to move player as if theyre on ground or in air
|
||||
fn basic_move(data: &JoinData, update: &mut StateUpdate) {
|
||||
fn basic_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32) {
|
||||
let (accel, speed): (f32, f32) = if data.physics.on_ground {
|
||||
(BASE_HUMANOID_ACCEL, BASE_HUMANOID_SPEED)
|
||||
} else {
|
||||
@ -46,7 +46,8 @@ fn basic_move(data: &JoinData, update: &mut StateUpdate) {
|
||||
|
||||
// Move player according to move_dir
|
||||
if update.vel.0.magnitude_squared() < speed.powf(2.0) {
|
||||
update.vel.0 = update.vel.0 + Vec2::broadcast(data.dt.0) * data.inputs.move_dir * accel;
|
||||
update.vel.0 =
|
||||
update.vel.0 + Vec2::broadcast(data.dt.0) * data.inputs.move_dir * accel * efficiency;
|
||||
let mag2 = update.vel.0.magnitude_squared();
|
||||
if mag2 > speed.powf(2.0) {
|
||||
update.vel.0 = update.vel.0.normalized() * speed;
|
||||
@ -69,7 +70,7 @@ pub fn handle_orientation(data: &JoinData, update: &mut StateUpdate, strength: f
|
||||
}
|
||||
|
||||
/// Updates components to move player as if theyre swimming
|
||||
fn swim_move(data: &JoinData, update: &mut StateUpdate) {
|
||||
fn swim_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32) {
|
||||
// Update velocity
|
||||
update.vel.0 += Vec2::broadcast(data.dt.0)
|
||||
* data.inputs.move_dir
|
||||
@ -77,7 +78,8 @@ fn swim_move(data: &JoinData, update: &mut StateUpdate) {
|
||||
BASE_HUMANOID_WATER_ACCEL
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
}
|
||||
* efficiency;
|
||||
|
||||
handle_orientation(data, update, if data.physics.on_ground { 9.0 } else { 2.0 });
|
||||
|
||||
|
@ -10,7 +10,7 @@ impl CharacterBehavior for Data {
|
||||
fn behavior(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
|
||||
handle_move(&data, &mut update);
|
||||
handle_move(&data, &mut update, 1.0);
|
||||
handle_jump(&data, &mut update);
|
||||
handle_climb(&data, &mut update);
|
||||
handle_glide(&data, &mut update);
|
||||
|
@ -41,7 +41,7 @@ pub fn safe_slerp(from: vek::Vec3<f32>, to: vek::Vec3<f32>, factor: f32) -> vek:
|
||||
};
|
||||
|
||||
let dot = from.dot(to);
|
||||
if dot > 0.999 {
|
||||
if dot >= 1.0 - 1E-6 {
|
||||
// Close together, just use to
|
||||
return to;
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ impl<'a> System<'a> for Sys {
|
||||
|
||||
// TODO: Remove this and implement scaling or level depending on stuff like
|
||||
// species instead
|
||||
stats.level.set_level(rand::thread_rng().gen_range(1, 4));
|
||||
stats.level.set_level(rand::thread_rng().gen_range(1, 9));
|
||||
|
||||
// Replace stuff if it's a boss
|
||||
if let EntityKind::Boss = entity.kind {
|
||||
@ -337,7 +337,7 @@ impl<'a> System<'a> for Sys {
|
||||
)),
|
||||
};
|
||||
|
||||
stats.level.set_level(rand::thread_rng().gen_range(8, 15));
|
||||
stats.level.set_level(rand::thread_rng().gen_range(30, 35));
|
||||
scale = 2.0 + rand::random::<f32>();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user