mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'silentium/combat-tweeks' into 'master'
Silentium/combat tweaks See merge request veloren/veloren!1261
This commit is contained in:
commit
fbac12d28f
22
Cargo.lock
generated
22
Cargo.lock
generated
@ -3119,11 +3119,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro-error"
|
name = "proc-macro-error"
|
||||||
version = "1.0.3"
|
version = "1.0.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fc175e9777c3116627248584e8f8b3e2987405cabe1c0adf7d1dd28f09dc7880"
|
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-error-attr 1.0.3",
|
"proc-macro-error-attr 1.0.4",
|
||||||
"proc-macro2 1.0.18",
|
"proc-macro2 1.0.18",
|
||||||
"quote 1.0.7",
|
"quote 1.0.7",
|
||||||
"syn 1.0.33",
|
"syn 1.0.33",
|
||||||
@ -3145,14 +3145,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro-error-attr"
|
name = "proc-macro-error-attr"
|
||||||
version = "1.0.3"
|
version = "1.0.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3cc9795ca17eb581285ec44936da7fc2335a3f34f2ddd13118b6f4d515435c50"
|
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.18",
|
"proc-macro2 1.0.18",
|
||||||
"quote 1.0.7",
|
"quote 1.0.7",
|
||||||
"syn 1.0.33",
|
|
||||||
"syn-mid",
|
|
||||||
"version_check 0.9.2",
|
"version_check 0.9.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -3995,9 +3993,9 @@ checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "structopt"
|
name = "structopt"
|
||||||
version = "0.3.15"
|
version = "0.3.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "de2f5e239ee807089b62adce73e48c625e0ed80df02c7ab3f068f5db5281065c"
|
checksum = "de5472fb24d7e80ae84a7801b7978f95a19ec32cb1876faea59ab711eb901976"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
@ -4006,12 +4004,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "structopt-derive"
|
name = "structopt-derive"
|
||||||
version = "0.4.8"
|
version = "0.4.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "510413f9de616762a4fbeab62509bf15c729603b72d7cd71280fbca431b1c118"
|
checksum = "1e0eb37335aeeebe51be42e2dc07f031163fbabfa6ac67d7ea68b5c2f68d5f99"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck",
|
"heck",
|
||||||
"proc-macro-error 1.0.3",
|
"proc-macro-error 1.0.4",
|
||||||
"proc-macro2 1.0.18",
|
"proc-macro2 1.0.18",
|
||||||
"quote 1.0.7",
|
"quote 1.0.7",
|
||||||
"syn 1.0.33",
|
"syn 1.0.33",
|
||||||
|
@ -112,7 +112,7 @@ impl Body {
|
|||||||
pub fn radius(&self) -> f32 {
|
pub fn radius(&self) -> f32 {
|
||||||
// TODO: Improve these values (some might be reliant on more info in inner type)
|
// TODO: Improve these values (some might be reliant on more info in inner type)
|
||||||
match self {
|
match self {
|
||||||
Body::Humanoid(_) => 0.5,
|
Body::Humanoid(_) => 0.2,
|
||||||
Body::QuadrupedSmall(_) => 0.3,
|
Body::QuadrupedSmall(_) => 0.3,
|
||||||
Body::QuadrupedMedium(_) => 0.9,
|
Body::QuadrupedMedium(_) => 0.9,
|
||||||
Body::Critter(_) => 0.2,
|
Body::Critter(_) => 0.2,
|
||||||
@ -128,8 +128,29 @@ impl Body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: currently assumes sphericality
|
pub fn height(&self) -> f32 {
|
||||||
pub fn height(&self) -> f32 { self.radius() * 2.0 }
|
match self {
|
||||||
|
Body::Humanoid(humanoid) => match humanoid.species {
|
||||||
|
humanoid::Species::Danari => 0.8,
|
||||||
|
humanoid::Species::Dwarf => 0.9,
|
||||||
|
humanoid::Species::Orc => 1.14,
|
||||||
|
humanoid::Species::Undead => 0.95,
|
||||||
|
_ => 1.0,
|
||||||
|
},
|
||||||
|
Body::QuadrupedSmall(_) => 0.6,
|
||||||
|
Body::QuadrupedMedium(_) => 0.5,
|
||||||
|
Body::Critter(_) => 0.4,
|
||||||
|
Body::BirdMedium(_) => 1.2,
|
||||||
|
Body::FishMedium(_) => 1.0,
|
||||||
|
Body::Dragon(_) => 5.0,
|
||||||
|
Body::BirdSmall(_) => 0.4,
|
||||||
|
Body::FishSmall(_) => 0.4,
|
||||||
|
Body::BipedLarge(_) => 4.0,
|
||||||
|
Body::Golem(_) => 5.0,
|
||||||
|
Body::QuadrupedLow(_) => 0.5,
|
||||||
|
Body::Object(_) => 0.6,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn base_health(&self) -> u32 {
|
pub fn base_health(&self) -> u32 {
|
||||||
match self {
|
match self {
|
||||||
|
@ -142,7 +142,7 @@ impl Tool {
|
|||||||
recover_duration: Duration::from_millis(300),
|
recover_duration: Duration::from_millis(300),
|
||||||
base_healthchange: (-120.0 * self.base_power()) as i32,
|
base_healthchange: (-120.0 * self.base_power()) as i32,
|
||||||
range: 3.5,
|
range: 3.5,
|
||||||
max_angle: 60.0,
|
max_angle: 20.0,
|
||||||
},
|
},
|
||||||
LeapMelee {
|
LeapMelee {
|
||||||
energy_cost: 800,
|
energy_cost: 800,
|
||||||
@ -157,8 +157,8 @@ impl Tool {
|
|||||||
buildup_duration: Duration::from_millis(700),
|
buildup_duration: Duration::from_millis(700),
|
||||||
recover_duration: Duration::from_millis(150),
|
recover_duration: Duration::from_millis(150),
|
||||||
base_healthchange: (-50.0 * self.base_power()) as i32,
|
base_healthchange: (-50.0 * self.base_power()) as i32,
|
||||||
range: 3.0,
|
range: 3.5,
|
||||||
max_angle: 60.0,
|
max_angle: 20.0,
|
||||||
}],
|
}],
|
||||||
Bow(_) => vec![
|
Bow(_) => vec![
|
||||||
BasicRanged {
|
BasicRanged {
|
||||||
@ -171,7 +171,7 @@ impl Tool {
|
|||||||
hit_entity: vec![
|
hit_entity: vec![
|
||||||
projectile::Effect::Damage((-40.0 * self.base_power()) as i32),
|
projectile::Effect::Damage((-40.0 * self.base_power()) as i32),
|
||||||
projectile::Effect::Knockback(10.0),
|
projectile::Effect::Knockback(10.0),
|
||||||
projectile::Effect::RewardEnergy(100),
|
projectile::Effect::RewardEnergy(50),
|
||||||
projectile::Effect::Vanish,
|
projectile::Effect::Vanish,
|
||||||
],
|
],
|
||||||
time_left: Duration::from_secs(15),
|
time_left: Duration::from_secs(15),
|
||||||
@ -202,7 +202,7 @@ impl Tool {
|
|||||||
recover_duration: Duration::from_millis(400),
|
recover_duration: Duration::from_millis(400),
|
||||||
base_healthchange: (-50.0 * self.base_power()) as i32,
|
base_healthchange: (-50.0 * self.base_power()) as i32,
|
||||||
range: 3.5,
|
range: 3.5,
|
||||||
max_angle: 60.0,
|
max_angle: 20.0,
|
||||||
},
|
},
|
||||||
DashMelee {
|
DashMelee {
|
||||||
energy_cost: 700,
|
energy_cost: 700,
|
||||||
@ -219,8 +219,8 @@ impl Tool {
|
|||||||
buildup_duration: Duration::from_millis(0),
|
buildup_duration: Duration::from_millis(0),
|
||||||
recover_duration: Duration::from_millis(300),
|
recover_duration: Duration::from_millis(300),
|
||||||
base_healthchange: (-10.0 * self.base_power()) as i32,
|
base_healthchange: (-10.0 * self.base_power()) as i32,
|
||||||
range: 10.0,
|
range: 5.0,
|
||||||
max_angle: 45.0,
|
max_angle: 20.0,
|
||||||
},
|
},
|
||||||
BasicMelee {
|
BasicMelee {
|
||||||
energy_cost: 350,
|
energy_cost: 350,
|
||||||
@ -238,8 +238,8 @@ impl Tool {
|
|||||||
buildup_duration: Duration::from_millis(100),
|
buildup_duration: Duration::from_millis(100),
|
||||||
recover_duration: Duration::from_millis(300),
|
recover_duration: Duration::from_millis(300),
|
||||||
base_healthchange: (-40.0 * self.base_power()) as i32,
|
base_healthchange: (-40.0 * self.base_power()) as i32,
|
||||||
range: 10.0,
|
range: 3.5,
|
||||||
max_angle: 45.0,
|
max_angle: 20.0,
|
||||||
},
|
},
|
||||||
BasicRanged {
|
BasicRanged {
|
||||||
energy_cost: 0,
|
energy_cost: 0,
|
||||||
@ -261,7 +261,6 @@ impl Tool {
|
|||||||
col: (0.85, 0.5, 0.11).into(),
|
col: (0.85, 0.5, 0.11).into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
|
|
||||||
projectile_gravity: None,
|
projectile_gravity: None,
|
||||||
},
|
},
|
||||||
BasicRanged {
|
BasicRanged {
|
||||||
@ -349,8 +348,8 @@ impl Tool {
|
|||||||
buildup_duration: Duration::from_millis(0),
|
buildup_duration: Duration::from_millis(0),
|
||||||
recover_duration: Duration::from_millis(1000),
|
recover_duration: Duration::from_millis(1000),
|
||||||
base_healthchange: -20,
|
base_healthchange: -20,
|
||||||
range: 5.0,
|
range: 3.5,
|
||||||
max_angle: 60.0,
|
max_angle: 15.0,
|
||||||
}],
|
}],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ impl LoadoutBuilder {
|
|||||||
recover_duration: Duration::from_millis(100),
|
recover_duration: Duration::from_millis(100),
|
||||||
base_healthchange: -(body.base_dmg() as i32),
|
base_healthchange: -(body.base_dmg() as i32),
|
||||||
range: body.base_range(),
|
range: body.base_range(),
|
||||||
max_angle: 80.0,
|
max_angle: 20.0,
|
||||||
}),
|
}),
|
||||||
ability2: None,
|
ability2: None,
|
||||||
ability3: None,
|
ability3: None,
|
||||||
|
@ -85,7 +85,7 @@ impl CharacterBehavior for Data {
|
|||||||
if let Some(attack) = data.attacking {
|
if let Some(attack) = data.attacking {
|
||||||
if attack.applied && attack.hit_count > 0 {
|
if attack.applied && attack.hit_count > 0 {
|
||||||
data.updater.remove::<Attacking>(data.entity);
|
data.updater.remove::<Attacking>(data.entity);
|
||||||
update.energy.change_by(100, EnergySource::HitEnemy);
|
update.energy.change_by(50, EnergySource::HitEnemy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
comp::{Attacking, CharacterState, EnergySource, StateUpdate},
|
comp::{Attacking, CharacterState, StateUpdate},
|
||||||
states::utils::*,
|
states::utils::*,
|
||||||
sys::character_behavior::*,
|
sys::character_behavior::*,
|
||||||
};
|
};
|
||||||
@ -57,7 +57,7 @@ impl CharacterBehavior for Data {
|
|||||||
data.updater.insert(data.entity, Attacking {
|
data.updater.insert(data.entity, Attacking {
|
||||||
base_healthchange: -(self.base_damage as i32),
|
base_healthchange: -(self.base_damage as i32),
|
||||||
range: 3.5,
|
range: 3.5,
|
||||||
max_angle: 180_f32.to_radians(),
|
max_angle: 45_f32.to_radians(),
|
||||||
applied: false,
|
applied: false,
|
||||||
hit_count: 0,
|
hit_count: 0,
|
||||||
knockback: 0.0,
|
knockback: 0.0,
|
||||||
@ -90,14 +90,6 @@ impl CharacterBehavior for Data {
|
|||||||
data.updater.remove::<Attacking>(data.entity);
|
data.updater.remove::<Attacking>(data.entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grant energy on successful hit
|
|
||||||
if let Some(attack) = data.attacking {
|
|
||||||
if attack.applied && attack.hit_count > 0 {
|
|
||||||
data.updater.remove::<Attacking>(data.entity);
|
|
||||||
update.energy.change_by(100, EnergySource::HitEnemy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
update
|
update
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
comp::{Attacking, CharacterState, EnergySource, StateUpdate},
|
comp::{Attacking, CharacterState, StateUpdate},
|
||||||
states::utils::*,
|
states::utils::*,
|
||||||
sys::character_behavior::*,
|
sys::character_behavior::*,
|
||||||
};
|
};
|
||||||
@ -110,14 +110,6 @@ impl CharacterBehavior for Data {
|
|||||||
data.updater.remove::<Attacking>(data.entity);
|
data.updater.remove::<Attacking>(data.entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grant energy on successful hit
|
|
||||||
if let Some(attack) = data.attacking {
|
|
||||||
if attack.applied && attack.hit_count > 0 {
|
|
||||||
data.updater.remove::<Attacking>(data.entity);
|
|
||||||
update.energy.change_by(100, EnergySource::HitEnemy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
update
|
update
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,14 +133,6 @@ impl CharacterBehavior for Data {
|
|||||||
data.updater.remove::<Attacking>(data.entity);
|
data.updater.remove::<Attacking>(data.entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grant energy on successful hit
|
|
||||||
if let Some(attack) = data.attacking {
|
|
||||||
if attack.applied && attack.hit_count > 0 {
|
|
||||||
data.updater.remove::<Attacking>(data.entity);
|
|
||||||
update.energy.change_by(10, EnergySource::HitEnemy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
update
|
update
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,8 @@ impl CharacterBehavior for Data {
|
|||||||
fn behavior(&self, data: &JoinData) -> StateUpdate {
|
fn behavior(&self, data: &JoinData) -> StateUpdate {
|
||||||
let mut update = StateUpdate::from(data);
|
let mut update = StateUpdate::from(data);
|
||||||
|
|
||||||
|
handle_move(data, &mut update, 0.3);
|
||||||
|
|
||||||
#[allow(clippy::or_fun_call)] // TODO: Pending review in #587
|
#[allow(clippy::or_fun_call)] // TODO: Pending review in #587
|
||||||
let stage_time_active = self
|
let stage_time_active = self
|
||||||
.stage_time_active
|
.stage_time_active
|
||||||
@ -109,16 +111,6 @@ impl CharacterBehavior for Data {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Handle hit applied
|
|
||||||
if let Some(attack) = data.attacking {
|
|
||||||
if attack.applied && attack.hit_count > 0 {
|
|
||||||
// Take energy on successful hit
|
|
||||||
update.energy.change_by(100, EnergySource::HitEnemy);
|
|
||||||
// Always remove component
|
|
||||||
data.updater.remove::<Attacking>(data.entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handling movement
|
// Handling movement
|
||||||
if stage_time_active < Duration::from_millis(STAGE_DURATION / 3) {
|
if stage_time_active < Duration::from_millis(STAGE_DURATION / 3) {
|
||||||
let adjusted_accel = match (self.stage, data.physics.touch_entity.is_none()) {
|
let adjusted_accel = match (self.stage, data.physics.touch_entity.is_none()) {
|
||||||
@ -130,12 +122,7 @@ impl CharacterBehavior for Data {
|
|||||||
|
|
||||||
// Move player forward while in first third of each stage
|
// Move player forward while in first third of each stage
|
||||||
if update.vel.0.magnitude_squared() < BASE_SPEED.powf(2.0) {
|
if update.vel.0.magnitude_squared() < BASE_SPEED.powf(2.0) {
|
||||||
update.vel.0 += data.dt.0
|
update.vel.0 += data.dt.0 * (adjusted_accel * Vec3::from(data.ori.0.xy()));
|
||||||
* (if data.physics.on_ground {
|
|
||||||
Vec3::new(0.0, 0.0, 500.0) // Jump upwards if on ground
|
|
||||||
} else {
|
|
||||||
Vec3::one()
|
|
||||||
} + adjusted_accel * Vec3::from(data.ori.0.xy()));
|
|
||||||
let mag2 = update.vel.0.magnitude_squared();
|
let mag2 = update.vel.0.magnitude_squared();
|
||||||
if mag2 > BASE_SPEED.powf(2.0) {
|
if mag2 > BASE_SPEED.powf(2.0) {
|
||||||
update.vel.0 = update.vel.0.normalized() * BASE_SPEED;
|
update.vel.0 = update.vel.0.normalized() * BASE_SPEED;
|
||||||
@ -155,14 +142,16 @@ impl CharacterBehavior for Data {
|
|||||||
Stage::Third => (self.base_damage as f32 * 1.5) as u32,
|
Stage::Third => (self.base_damage as f32 * 1.5) as u32,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
update.vel.0 = Vec3::new(data.inputs.move_dir.x, data.inputs.move_dir.y, 0.0) * 5.0;
|
||||||
|
|
||||||
// Try to deal damage in second half of stage
|
// Try to deal damage in second half of stage
|
||||||
data.updater.insert(data.entity, Attacking {
|
data.updater.insert(data.entity, Attacking {
|
||||||
base_healthchange: -(dmg as i32),
|
base_healthchange: -(dmg as i32),
|
||||||
range: 3.5,
|
range: 3.5,
|
||||||
max_angle: 180_f32.to_radians(),
|
max_angle: 45_f32.to_radians(),
|
||||||
applied: false,
|
applied: false,
|
||||||
hit_count: 0,
|
hit_count: 0,
|
||||||
knockback: 16.0,
|
knockback: 10.0,
|
||||||
});
|
});
|
||||||
|
|
||||||
CharacterState::TripleStrike(Data {
|
CharacterState::TripleStrike(Data {
|
||||||
@ -187,6 +176,8 @@ impl CharacterBehavior for Data {
|
|||||||
// Player messed up inputs, don't transition
|
// Player messed up inputs, don't transition
|
||||||
else { None };
|
else { None };
|
||||||
|
|
||||||
|
update.vel.0 = Vec3::new(data.inputs.move_dir.x, data.inputs.move_dir.y, 0.0) * 5.0;
|
||||||
|
|
||||||
if let Some(stage) = next_stage {
|
if let Some(stage) = next_stage {
|
||||||
CharacterState::TripleStrike(Data {
|
CharacterState::TripleStrike(Data {
|
||||||
base_damage: self.base_damage,
|
base_damage: self.base_damage,
|
||||||
@ -220,7 +211,7 @@ impl CharacterBehavior for Data {
|
|||||||
if let Some(attack) = data.attacking {
|
if let Some(attack) = data.attacking {
|
||||||
if attack.applied && attack.hit_count > 0 {
|
if attack.applied && attack.hit_count > 0 {
|
||||||
data.updater.remove::<Attacking>(data.entity);
|
data.updater.remove::<Attacking>(data.entity);
|
||||||
update.energy.change_by(100, EnergySource::HitEnemy);
|
update.energy.change_by(50, EnergySource::HitEnemy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,7 +471,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
|
|
||||||
let diff = Vec2::<f32>::from(pos.0 - pos_other.0);
|
let diff = Vec2::<f32>::from(pos.0 - pos_other.0);
|
||||||
|
|
||||||
let collision_dist = 0.95 * (scale + scale_other);
|
let collision_dist = 0.55 * (scale + scale_other);
|
||||||
|
|
||||||
if diff.magnitude_squared() > 0.0
|
if diff.magnitude_squared() > 0.0
|
||||||
&& diff.magnitude_squared() < collision_dist.powf(2.0)
|
&& diff.magnitude_squared() < collision_dist.powf(2.0)
|
||||||
|
@ -137,9 +137,9 @@ impl<'a> System<'a> for Sys {
|
|||||||
energy_cost: 0,
|
energy_cost: 0,
|
||||||
buildup_duration: Duration::from_millis(0),
|
buildup_duration: Duration::from_millis(0),
|
||||||
recover_duration: Duration::from_millis(400),
|
recover_duration: Duration::from_millis(400),
|
||||||
base_healthchange: -60,
|
base_healthchange: -40,
|
||||||
range: 5.0,
|
range: 3.5,
|
||||||
max_angle: 80.0,
|
max_angle: 15.0,
|
||||||
}),
|
}),
|
||||||
ability2: None,
|
ability2: None,
|
||||||
ability3: None,
|
ability3: None,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user