mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix Gnarling Speed
This commit is contained in:
parent
c065b689ac
commit
44a56be25b
@ -1,17 +1,17 @@
|
|||||||
BasicMelee(
|
BasicMelee(
|
||||||
energy_cost: 0,
|
energy_cost: 0,
|
||||||
buildup_duration: 0.3,
|
buildup_duration: 0.4,
|
||||||
swing_duration: 0.05,
|
swing_duration: 0.05,
|
||||||
hit_timing: 0.8,
|
hit_timing: 0.8,
|
||||||
recover_duration: 0.45,
|
recover_duration: 0.45,
|
||||||
melee_constructor: (
|
melee_constructor: (
|
||||||
kind: Slash(
|
kind: Slash(
|
||||||
damage: 9,
|
damage: 4,
|
||||||
poise: 5,
|
poise: 5,
|
||||||
knockback: 0,
|
knockback: 0,
|
||||||
energy_regen: 0,
|
energy_regen: 0,
|
||||||
),
|
),
|
||||||
range: 3,
|
range: 2.5,
|
||||||
angle: 30,
|
angle: 30,
|
||||||
),
|
),
|
||||||
ori_modifier: 1.0,
|
ori_modifier: 1.0,
|
||||||
|
@ -5,12 +5,12 @@ BasicRanged(
|
|||||||
projectile: (
|
projectile: (
|
||||||
kind: Pointed,
|
kind: Pointed,
|
||||||
attack: Some((
|
attack: Some((
|
||||||
damage: 4,
|
damage: 2,
|
||||||
energy: 0,
|
energy: 0,
|
||||||
buff: Some((
|
buff: Some((
|
||||||
kind: Bleeding,
|
kind: Bleeding,
|
||||||
dur_secs: 10,
|
dur_secs: 5,
|
||||||
strength: DamageFraction(0.1),
|
strength: DamageFraction(0.4),
|
||||||
chance: 0.1,
|
chance: 0.1,
|
||||||
)),
|
)),
|
||||||
)),
|
)),
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
BasicMelee(
|
BasicMelee(
|
||||||
energy_cost: 0,
|
energy_cost: 0,
|
||||||
buildup_duration: 0.15,
|
buildup_duration: 0.2,
|
||||||
swing_duration: 0.05,
|
swing_duration: 0.05,
|
||||||
hit_timing: 0.4,
|
hit_timing: 0.4,
|
||||||
recover_duration: 0.375,
|
recover_duration: 0.375,
|
||||||
melee_constructor: (
|
melee_constructor: (
|
||||||
kind: Stab(
|
kind: Stab(
|
||||||
damage: 6,
|
damage: 2.5,
|
||||||
poise: 0,
|
poise: 0,
|
||||||
knockback: 0,
|
knockback: 0,
|
||||||
energy_regen: 0,
|
energy_regen: 0,
|
||||||
),
|
),
|
||||||
range: 2,
|
range: 3,
|
||||||
angle: 15,
|
angle: 15,
|
||||||
),
|
),
|
||||||
ori_modifier: 1.0,
|
ori_modifier: 1.0,
|
||||||
|
@ -8,7 +8,7 @@ ItemDef(
|
|||||||
poise_resilience: Some(Normal(1.0)),
|
poise_resilience: Some(Normal(1.0)),
|
||||||
energy_max: Some(2.7),
|
energy_max: Some(2.7),
|
||||||
energy_reward: Some(0.027),
|
energy_reward: Some(0.027),
|
||||||
precision_power: Some(0.025),
|
precision_power: Some(0.150),
|
||||||
)),
|
)),
|
||||||
)),
|
)),
|
||||||
quality: Low,
|
quality: Low,
|
||||||
|
@ -8,7 +8,7 @@ ItemDef(
|
|||||||
poise_resilience: Some(Normal(1.0)),
|
poise_resilience: Some(Normal(1.0)),
|
||||||
energy_max: Some(0.9),
|
energy_max: Some(0.9),
|
||||||
energy_reward: Some(0.009),
|
energy_reward: Some(0.009),
|
||||||
precision_power: Some(0.008),
|
precision_power: Some(0.048),
|
||||||
)),
|
)),
|
||||||
)),
|
)),
|
||||||
quality: Low,
|
quality: Low,
|
||||||
|
@ -8,7 +8,7 @@ ItemDef(
|
|||||||
poise_resilience: Some(Normal(1.0)),
|
poise_resilience: Some(Normal(1.0)),
|
||||||
energy_max: Some(0.9),
|
energy_max: Some(0.9),
|
||||||
energy_reward: Some(0.009),
|
energy_reward: Some(0.009),
|
||||||
precision_power: Some(0.008),
|
precision_power: Some(0.048),
|
||||||
)),
|
)),
|
||||||
)),
|
)),
|
||||||
quality: Low,
|
quality: Low,
|
||||||
|
@ -8,7 +8,7 @@ ItemDef(
|
|||||||
poise_resilience: Some(Normal(1.0)),
|
poise_resilience: Some(Normal(1.0)),
|
||||||
energy_max: Some(1.8),
|
energy_max: Some(1.8),
|
||||||
energy_reward: Some(0.02),
|
energy_reward: Some(0.02),
|
||||||
precision_power: Some(0.016),
|
precision_power: Some(0.096),
|
||||||
)),
|
)),
|
||||||
)),
|
)),
|
||||||
quality: Low,
|
quality: Low,
|
||||||
|
@ -8,7 +8,7 @@ ItemDef(
|
|||||||
poise_resilience: Some(Normal(1.0)),
|
poise_resilience: Some(Normal(1.0)),
|
||||||
energy_max: Some(1.8),
|
energy_max: Some(1.8),
|
||||||
energy_reward: Some(0.02),
|
energy_reward: Some(0.02),
|
||||||
precision_power: Some(0.016),
|
precision_power: Some(0.096),
|
||||||
)),
|
)),
|
||||||
)),
|
)),
|
||||||
quality: Low,
|
quality: Low,
|
||||||
|
@ -8,7 +8,7 @@ ItemDef(
|
|||||||
poise_resilience: Some(Normal(1.0)),
|
poise_resilience: Some(Normal(1.0)),
|
||||||
energy_max: Some(0.4),
|
energy_max: Some(0.4),
|
||||||
energy_reward: Some(0.005),
|
energy_reward: Some(0.005),
|
||||||
precision_power: Some(0.004),
|
precision_power: Some(0.024),
|
||||||
)),
|
)),
|
||||||
)),
|
)),
|
||||||
quality: Low,
|
quality: Low,
|
||||||
|
@ -6,7 +6,7 @@ ItemDef(
|
|||||||
hands: Two,
|
hands: Two,
|
||||||
stats: (
|
stats: (
|
||||||
equip_time_secs: 0.0,
|
equip_time_secs: 0.0,
|
||||||
power: 0.3,
|
power: 1.0,
|
||||||
effect_power: 1.0,
|
effect_power: 1.0,
|
||||||
speed: 1.0,
|
speed: 1.0,
|
||||||
range: 1.0,
|
range: 1.0,
|
||||||
|
@ -6,7 +6,7 @@ ItemDef(
|
|||||||
hands: Two,
|
hands: Two,
|
||||||
stats: (
|
stats: (
|
||||||
equip_time_secs: 0.0,
|
equip_time_secs: 0.0,
|
||||||
power: 0.3,
|
power: 1.0,
|
||||||
effect_power: 0.8,
|
effect_power: 0.8,
|
||||||
speed: 0.6,
|
speed: 0.6,
|
||||||
range: 1.0,
|
range: 1.0,
|
||||||
|
@ -125,6 +125,7 @@ impl Body {
|
|||||||
Body::BipedSmall(biped_small) => match biped_small.species {
|
Body::BipedSmall(biped_small) => match biped_small.species {
|
||||||
biped_small::Species::Haniwa => 65.0,
|
biped_small::Species::Haniwa => 65.0,
|
||||||
biped_small::Species::Boreal => 100.0,
|
biped_small::Species::Boreal => 100.0,
|
||||||
|
biped_small::Species::Gnarling => 70.0,
|
||||||
_ => 80.0,
|
_ => 80.0,
|
||||||
},
|
},
|
||||||
Body::Object(_) => 0.0,
|
Body::Object(_) => 0.0,
|
||||||
|
@ -122,11 +122,11 @@ impl<'a> AgentData<'a> {
|
|||||||
tgt_data: &TargetData,
|
tgt_data: &TargetData,
|
||||||
read_data: &ReadData,
|
read_data: &ReadData,
|
||||||
) {
|
) {
|
||||||
// Handle attacking of agent
|
// Behaviour parameters
|
||||||
if attack_data.in_min_range() && attack_data.angle < 30.0 {
|
const STRAFE_DIST: f32 = 4.5;
|
||||||
controller.push_basic_input(InputKind::Primary);
|
const STRAFE_SPEED_MULT: f32 = 0.75;
|
||||||
controller.inputs.move_dir = Vec2::zero();
|
const STRATE_SPIRAL_MULT: f32 = 0.8; // how quickly they close gap while strafing
|
||||||
}
|
const BACKSTAB_SPEED_MULT: f32 = 0.3;
|
||||||
|
|
||||||
// Handle movement of agent
|
// Handle movement of agent
|
||||||
let target_ori = agent
|
let target_ori = agent
|
||||||
@ -135,9 +135,15 @@ impl<'a> AgentData<'a> {
|
|||||||
.map(|ori| ori.look_vec())
|
.map(|ori| ori.look_vec())
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
let dist = attack_data.dist_sqrd.sqrt();
|
let dist = attack_data.dist_sqrd.sqrt();
|
||||||
|
|
||||||
let in_front_of_target = target_ori.dot(self.pos.0 - tgt_data.pos.0) > 0.0;
|
let in_front_of_target = target_ori.dot(self.pos.0 - tgt_data.pos.0) > 0.0;
|
||||||
if attack_data.dist_sqrd < MAX_PATH_DIST.powi(2) {
|
|
||||||
|
// Handle attacking of agent
|
||||||
|
if attack_data.in_min_range() && attack_data.angle < 30.0 {
|
||||||
|
controller.push_basic_input(InputKind::Primary);
|
||||||
|
controller.inputs.move_dir = Vec2::zero();
|
||||||
|
}
|
||||||
|
|
||||||
|
if attack_data.dist_sqrd < STRAFE_DIST.powi(2) {
|
||||||
// If in front of the target, circle to try and get behind, else just make a
|
// If in front of the target, circle to try and get behind, else just make a
|
||||||
// beeline for the back of the agent
|
// beeline for the back of the agent
|
||||||
let vec_to_target = (tgt_data.pos.0 - self.pos.0).xy();
|
let vec_to_target = (tgt_data.pos.0 - self.pos.0).xy();
|
||||||
@ -159,13 +165,14 @@ impl<'a> AgentData<'a> {
|
|||||||
.iter()
|
.iter()
|
||||||
.find(|move_dir| target_ori.xy().dot(**move_dir) < 0.0)
|
.find(|move_dir| target_ori.xy().dot(**move_dir) < 0.0)
|
||||||
{
|
{
|
||||||
controller.inputs.move_dir = *move_dir;
|
controller.inputs.move_dir =
|
||||||
|
STRAFE_SPEED_MULT * (*move_dir - STRATE_SPIRAL_MULT * target_ori.xy());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Aim for a point a given distance behind the target to prevent sideways
|
// Aim for a point a given distance behind the target to prevent sideways
|
||||||
// movement
|
// movement
|
||||||
let move_target = tgt_data.pos.0.xy() - dist / 2. * target_ori.xy();
|
let move_target = tgt_data.pos.0.xy() - dist / 2. * target_ori.xy();
|
||||||
controller.inputs.move_dir = (move_target - self.pos.0)
|
controller.inputs.move_dir = ((move_target - self.pos.0) * BACKSTAB_SPEED_MULT)
|
||||||
.try_normalized()
|
.try_normalized()
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
}
|
}
|
||||||
@ -189,6 +196,10 @@ impl<'a> AgentData<'a> {
|
|||||||
tgt_data: &TargetData,
|
tgt_data: &TargetData,
|
||||||
read_data: &ReadData,
|
read_data: &ReadData,
|
||||||
) {
|
) {
|
||||||
|
// Behaviour parameters
|
||||||
|
const PREF_DIST: f32 = 30.0;
|
||||||
|
const RETREAT_DIST: f32 = 8.0;
|
||||||
|
|
||||||
let line_of_sight_with_target = || {
|
let line_of_sight_with_target = || {
|
||||||
entities_have_line_of_sight(
|
entities_have_line_of_sight(
|
||||||
self.pos,
|
self.pos,
|
||||||
@ -200,15 +211,14 @@ impl<'a> AgentData<'a> {
|
|||||||
read_data,
|
read_data,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
let elevation = self.pos.0.z - tgt_data.pos.0.z;
|
let elevation = self.pos.0.z - tgt_data.pos.0.z;
|
||||||
const PREF_DIST: f32 = 30_f32;
|
|
||||||
if attack_data.angle_xy < 30.0
|
if attack_data.angle_xy < 30.0
|
||||||
&& (elevation > 10.0 || attack_data.dist_sqrd > PREF_DIST.powi(2))
|
&& (elevation > 10.0 || attack_data.dist_sqrd > PREF_DIST.powi(2))
|
||||||
&& line_of_sight_with_target()
|
&& line_of_sight_with_target()
|
||||||
{
|
{
|
||||||
controller.push_basic_input(InputKind::Primary);
|
controller.push_basic_input(InputKind::Primary);
|
||||||
} else if attack_data.dist_sqrd < (PREF_DIST / 2.).powi(2) {
|
} else if attack_data.dist_sqrd < RETREAT_DIST.powi(2) {
|
||||||
// Attempt to move quickly away from target if too close
|
// Attempt to move quickly away from target if too close
|
||||||
if let Some((bearing, _)) = agent.chaser.chase(
|
if let Some((bearing, _)) = agent.chaser.chase(
|
||||||
&*read_data.terrain,
|
&*read_data.terrain,
|
||||||
|
Loading…
Reference in New Issue
Block a user