mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'combat' of https://gitlab.com/veloren/veloren into combat
This commit is contained in:
commit
6836a043af
@ -114,11 +114,31 @@ impl ToolData {
|
||||
recover_duration: Duration::from_millis(400),
|
||||
base_damage: 5,
|
||||
}],
|
||||
Staff(_) => vec![BasicMelee {
|
||||
buildup_duration: Duration::from_millis(400),
|
||||
recover_duration: Duration::from_millis(300),
|
||||
base_damage: 7,
|
||||
}],
|
||||
Staff(_) => vec![
|
||||
BasicMelee {
|
||||
buildup_duration: Duration::from_millis(400),
|
||||
recover_duration: Duration::from_millis(300),
|
||||
base_damage: 7,
|
||||
},
|
||||
BasicRanged {
|
||||
projectile: Projectile {
|
||||
hit_ground: vec![projectile::Effect::Vanish],
|
||||
hit_wall: vec![projectile::Effect::Vanish],
|
||||
hit_entity: vec![
|
||||
projectile::Effect::Damage(HealthChange {
|
||||
// TODO: This should not be fixed (?)
|
||||
amount: -8,
|
||||
cause: HealthSource::Item,
|
||||
}),
|
||||
projectile::Effect::Vanish,
|
||||
],
|
||||
time_left: Duration::from_secs(5),
|
||||
owner: None,
|
||||
},
|
||||
projectile_body: Body::Object(object::Body::BoltFire),
|
||||
recover_duration: Duration::from_millis(800),
|
||||
},
|
||||
],
|
||||
Shield(_) => vec![BasicBlock],
|
||||
Debug(kind) => match kind {
|
||||
DebugKind::Boost => vec![
|
||||
|
@ -91,29 +91,35 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, cause: HealthSourc
|
||||
.write_storage::<comp::CharacterState>()
|
||||
.insert(entity, comp::CharacterState::default());
|
||||
} else {
|
||||
// Replace npc with loot
|
||||
let _ = state
|
||||
.ecs()
|
||||
.write_storage()
|
||||
.insert(entity, Body::Object(object::Body::Pouch));
|
||||
let _ = state.ecs().write_storage().insert(
|
||||
entity,
|
||||
assets::load_expect_cloned::<Item>("common.items.cheese"),
|
||||
);
|
||||
state.ecs().write_storage::<comp::Stats>().remove(entity);
|
||||
state.ecs().write_storage::<comp::Agent>().remove(entity);
|
||||
state
|
||||
.ecs()
|
||||
.write_storage::<comp::LightEmitter>()
|
||||
.remove(entity);
|
||||
state
|
||||
.ecs()
|
||||
.write_storage::<comp::CharacterState>()
|
||||
.remove(entity);
|
||||
state
|
||||
.ecs()
|
||||
.write_storage::<comp::Controller>()
|
||||
.remove(entity);
|
||||
if state.ecs().read_storage::<comp::Agent>().contains(entity) {
|
||||
// Replace npc with loot
|
||||
let _ = state
|
||||
.ecs()
|
||||
.write_storage()
|
||||
.insert(entity, Body::Object(object::Body::Pouch));
|
||||
let _ = state.ecs().write_storage().insert(
|
||||
entity,
|
||||
assets::load_expect_cloned::<Item>("common.items.cheese"),
|
||||
);
|
||||
state.ecs().write_storage::<comp::Stats>().remove(entity);
|
||||
state.ecs().write_storage::<comp::Agent>().remove(entity);
|
||||
state
|
||||
.ecs()
|
||||
.write_storage::<comp::LightEmitter>()
|
||||
.remove(entity);
|
||||
state
|
||||
.ecs()
|
||||
.write_storage::<comp::CharacterState>()
|
||||
.remove(entity);
|
||||
state
|
||||
.ecs()
|
||||
.write_storage::<comp::Controller>()
|
||||
.remove(entity);
|
||||
} else {
|
||||
if let Err(err) = state.delete_entity_recorded(entity) {
|
||||
error!("Failed to delete destroyed entity: {:?}", err);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Add Delete(time_left: Duration) component
|
||||
/*
|
||||
|
@ -23,6 +23,8 @@ impl Animation for AttackAnimation {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let lab = 1.0;
|
||||
let test = (anim_time as f32 * 16.0 * lab as f32).cos();
|
||||
|
||||
let accel_med = 1.0 - (anim_time as f32 * 16.0 * lab as f32).cos();
|
||||
let accel_slow = 1.0 - (anim_time as f32 * 12.0 * lab as f32).cos();
|
||||
let accel_fast = 1.0 - (anim_time as f32 * 24.0 * lab as f32).cos();
|
||||
@ -32,6 +34,10 @@ impl Animation for AttackAnimation {
|
||||
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 12.4).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 12.4).sin());
|
||||
let slower = (((5.0)
|
||||
/ (0.1 + 4.9 * ((anim_time as f32 * lab as f32 * 4.0).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 4.0).sin());
|
||||
|
||||
next.head.offset = Vec3::new(
|
||||
0.0 + skeleton_attr.neck_right,
|
||||
@ -108,29 +114,23 @@ impl Animation for AttackAnimation {
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Hammer(_)) => {
|
||||
next.l_hand.offset =
|
||||
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
|
||||
next.l_hand.ori = Quaternion::rotation_z(-0.8)
|
||||
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
|
||||
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
|
||||
next.l_hand.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.r_hand.offset =
|
||||
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, -2.0);
|
||||
next.r_hand.ori = Quaternion::rotation_z(-0.8)
|
||||
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
|
||||
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
|
||||
next.r_hand.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.main.offset = Vec3::new(
|
||||
-8.0 + accel_slow * 10.0 + skeleton_attr.weapon_x,
|
||||
8.0 + accel_fast * 3.0,
|
||||
0.0,
|
||||
);
|
||||
next.main.ori = Quaternion::rotation_z(-0.8)
|
||||
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
|
||||
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
|
||||
next.l_hand.offset = Vec3::new(0.0, 1.0, 5.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(1.27);
|
||||
next.l_hand.scale = Vec3::one() * 1.04;
|
||||
next.r_hand.offset = Vec3::new(0.0, 0.0, -3.0);
|
||||
next.r_hand.ori = Quaternion::rotation_x(1.27);
|
||||
next.r_hand.scale = Vec3::one() * 1.05;
|
||||
next.main.offset = Vec3::new(0.0, 6.0, -1.0);
|
||||
next.main.ori = Quaternion::rotation_x(-0.3)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.main.scale = Vec3::one();
|
||||
|
||||
next.control.offset = Vec3::new(-6.0, 3.0, 5.0 + slower * 5.0);
|
||||
next.control.ori = Quaternion::rotation_x(-0.2 + slower * 2.0)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(1.4 + 1.57);
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Staff(_)) => {
|
||||
next.l_hand.offset =
|
||||
|
@ -86,7 +86,7 @@ impl Animation for StandAnimation {
|
||||
next.main.offset = Vec3::new(
|
||||
-7.0 + skeleton_attr.weapon_x,
|
||||
-5.0 + skeleton_attr.weapon_y,
|
||||
18.0,
|
||||
15.0,
|
||||
);
|
||||
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
||||
next.main.scale = Vec3::one();
|
||||
|
@ -19,7 +19,7 @@ impl Animation for WieldAnimation {
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let wave_ultra_slow = (anim_time as f32 * 3.0 + PI).sin();
|
||||
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
|
||||
let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos();
|
||||
|
||||
let wave = (anim_time as f32 * 1.0).sin();
|
||||
@ -45,44 +45,46 @@ impl Animation for WieldAnimation {
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Axe(_)) => {
|
||||
next.l_hand.offset = Vec3::new(-6.5, -0.5, 6.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.13) * Quaternion::rotation_z(-0.25);
|
||||
next.l_hand.scale = Vec3::one() * 1.01;
|
||||
next.r_hand.offset = Vec3::new(-3.0, 6.5, 6.0);
|
||||
next.r_hand.ori = Quaternion::rotation_x(0.13)
|
||||
* Quaternion::rotation_z(2.98)
|
||||
* Quaternion::rotation_y(-0.50);
|
||||
next.r_hand.scale = Vec3::one() * 1.01;
|
||||
next.main.offset = Vec3::new(
|
||||
-5.0 + skeleton_attr.weapon_x,
|
||||
8.5 + skeleton_attr.weapon_y,
|
||||
-0.5,
|
||||
);
|
||||
next.main.ori = Quaternion::rotation_x(1.70)
|
||||
* Quaternion::rotation_y(-0.25)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.l_hand.offset = Vec3::new(-4.0, 3.0, 6.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(-0.3)
|
||||
* Quaternion::rotation_z(3.14 - 0.3)
|
||||
* Quaternion::rotation_y(-0.8);
|
||||
next.l_hand.scale = Vec3::one() * 1.08;
|
||||
next.r_hand.offset = Vec3::new(-2.5, 9.0, 4.0);
|
||||
next.r_hand.ori = Quaternion::rotation_x(-0.3)
|
||||
* Quaternion::rotation_z(3.14 - 0.3)
|
||||
* Quaternion::rotation_y(-0.8);
|
||||
next.r_hand.scale = Vec3::one() * 1.06;
|
||||
next.main.offset = Vec3::new(-6.0, 10.0, -1.0);
|
||||
next.main.ori = Quaternion::rotation_x(1.27)
|
||||
* Quaternion::rotation_y(-0.3)
|
||||
* Quaternion::rotation_z(-0.8);
|
||||
next.main.scale = Vec3::one();
|
||||
|
||||
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.control.ori = Quaternion::rotation_x(wave_ultra_slow_cos * 0.1)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(wave_ultra_slow * 0.1);
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Hammer(_)) => {
|
||||
next.l_hand.offset = Vec3::new(-7.0, 4.0, 3.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(1.27 + wave * 0.25)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.l_hand.scale = Vec3::one() * 1.01;
|
||||
next.r_hand.offset = Vec3::new(7.0, 2.5, -1.25);
|
||||
next.r_hand.ori = Quaternion::rotation_x(1.27 + wave * 0.25)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(-0.3);
|
||||
next.r_hand.scale = Vec3::one() * 1.01;
|
||||
next.main.offset = Vec3::new(
|
||||
5.0 + skeleton_attr.weapon_x,
|
||||
8.75 + skeleton_attr.weapon_y,
|
||||
-2.0,
|
||||
);
|
||||
next.main.ori = Quaternion::rotation_x(-0.3)
|
||||
* Quaternion::rotation_y(-1.27)
|
||||
* Quaternion::rotation_z(wave * -0.25);
|
||||
next.l_hand.offset = Vec3::new(-7.0, 4.6, 7.5);
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.3) * Quaternion::rotation_y(0.32);
|
||||
next.l_hand.scale = Vec3::one() * 1.08;
|
||||
next.r_hand.offset = Vec3::new(8.0, 5.75, 4.0);
|
||||
next.r_hand.ori = Quaternion::rotation_x(0.3) * Quaternion::rotation_y(0.22);
|
||||
next.r_hand.scale = Vec3::one() * 1.06;
|
||||
next.main.offset = Vec3::new(6.0, 7.0, 0.0);
|
||||
next.main.ori = Quaternion::rotation_x(0.3)
|
||||
* Quaternion::rotation_y(-1.35)
|
||||
* Quaternion::rotation_z(1.57);
|
||||
next.main.scale = Vec3::one();
|
||||
|
||||
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.control.ori = Quaternion::rotation_x(wave_ultra_slow * 0.15)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(wave_ultra_slow_cos * 0.08);
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Staff(_)) => {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
@ -196,7 +198,7 @@ impl Animation for WieldAnimation {
|
||||
_ => {},
|
||||
}
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 0.0 + wave * -0.08, 0.1) * skeleton_attr.scaler;
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
|
||||
next.torso.ori = Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user