From f2c78361619f11dc95c1f2f3c2faffd529b060ec Mon Sep 17 00:00:00 2001 From: Snowram Date: Fri, 11 Jun 2021 03:15:58 +0200 Subject: [PATCH] Makes summon range inclusive --- .../abilities/custom/birdlargebasic/dash.ron | 10 ++++---- assets/voxygen/shaders/particle-vert.glsl | 5 ++-- common/src/comp/body.rs | 4 ++-- common/src/states/basic_summon.rs | 2 +- server/src/sys/agent.rs | 24 ++++++++++++++----- voxygen/src/scene/particle.rs | 10 ++++---- 6 files changed, 32 insertions(+), 23 deletions(-) diff --git a/assets/common/abilities/custom/birdlargebasic/dash.ron b/assets/common/abilities/custom/birdlargebasic/dash.ron index 2421a1dd02..8741cc774a 100644 --- a/assets/common/abilities/custom/birdlargebasic/dash.ron +++ b/assets/common/abilities/custom/birdlargebasic/dash.ron @@ -4,17 +4,17 @@ DashMelee( scaled_damage: 150, base_poise_damage: 50, scaled_poise_damage: 100, - base_knockback: 12.0, - scaled_knockback: 17.0, - range: 6.0, + base_knockback: 6.0, + scaled_knockback: 12.0, + range: 2.0, angle: 20.0, energy_drain: 0, forward_speed: 1.5, buildup_duration: 0.5, - charge_duration: 1.2, + charge_duration: 3.0, swing_duration: 0.1, recover_duration: 1.1, - charge_through: true, + charge_through: false, is_interruptible: false, damage_kind: Crushing, ) diff --git a/assets/voxygen/shaders/particle-vert.glsl b/assets/voxygen/shaders/particle-vert.glsl index bb3cc72945..3cd9721a47 100644 --- a/assets/voxygen/shaders/particle-vert.glsl +++ b/assets/voxygen/shaders/particle-vert.glsl @@ -545,12 +545,11 @@ void main() { ); break; case TORNADO: - f_reflect = 0.0; // Fire doesn't reflect light, it emits it + f_reflect = 0.0; attr = Attr( - //vec3(sin(lifetime * 400.0) * 3.0 * percent(), cos(lifetime * 400.0) * 3.0 * percent(), lifetime * 5.0), spiral_motion(vec3(0, 0, 5), abs(rand0) + abs(rand1) * percent() * 3.0, percent(), 15.0 * abs(rand2), rand3), vec3((2.5 * (1 - slow_start(0.05)))), - vec4(1.2 + 0.5 * percent(), 1.2 + 0.5 * percent(), 1.2 + 0.5 * percent(), 2.5), + vec4(vec3(1.2 + 0.5 * percent()), 1), spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9) ); break; diff --git a/common/src/comp/body.rs b/common/src/comp/body.rs index 7b1765ebed..470763465a 100644 --- a/common/src/comp/body.rs +++ b/common/src/comp/body.rs @@ -473,7 +473,7 @@ impl Body { Body::FishMedium(_) => 250, Body::Dragon(_) => 5000, Body::BirdLarge(bird_large) => match bird_large.species { - bird_large::Species::Roc => 2400, + bird_large::Species::Roc => 2800, _ => 3000, }, Body::FishSmall(_) => 20, @@ -595,7 +595,7 @@ impl Body { Body::FishMedium(_) => 10, Body::Dragon(_) => 500, Body::BirdLarge(bird_large) => match bird_large.species { - bird_large::Species::Roc => 100, + bird_large::Species::Roc => 110, _ => 120, }, Body::FishSmall(_) => 10, diff --git a/common/src/states/basic_summon.rs b/common/src/states/basic_summon.rs index 44c71b9f47..9ff74f016b 100644 --- a/common/src/states/basic_summon.rs +++ b/common/src/states/basic_summon.rs @@ -122,7 +122,7 @@ impl CharacterBehavior for Data { self.summon_count as f32 / self.static_data.summon_amount as f32; let length = rand::thread_rng().gen_range( - self.static_data.summon_distance.0..self.static_data.summon_distance.1, + self.static_data.summon_distance.0..=self.static_data.summon_distance.1, ); // Summon in a clockwise fashion diff --git a/server/src/sys/agent.rs b/server/src/sys/agent.rs index 33d181693c..448af696d9 100644 --- a/server/src/sys/agent.rs +++ b/server/src/sys/agent.rs @@ -3286,6 +3286,7 @@ impl<'a> AgentData<'a> { tgt_data: &TargetData, read_data: &ReadData, ) { + // If higher than 2 blocks if !read_data .terrain .ray(self.pos.0, self.pos.0 - (Vec3::unit_z() * 2.0)) @@ -3294,7 +3295,7 @@ impl<'a> AgentData<'a> { .1 .map_or(true, |b| b.is_some()) { - // Fly to target + // Fly to target and land controller .actions .push(ControlAction::basic_input(InputKind::Fly)); @@ -3302,26 +3303,35 @@ impl<'a> AgentData<'a> { controller.inputs.move_dir = move_dir.xy().try_normalized().unwrap_or_else(Vec2::zero) * 2.0; controller.inputs.move_z = move_dir.z - 0.5; - } else if agent.action_state.timer > 7.0 { + // If near a target and timer higher than 7 + } else if agent.action_state.timer > 6.0 + && attack_data.dist_sqrd < (3.0 * attack_data.min_attack_dist).powi(2) + { + // Cast tornadoes controller .actions .push(ControlAction::basic_input(InputKind::Ability(0))); // Reset timer agent.action_state.timer = 0.0; + // If near and in front of target and timer lower than 6 } else if attack_data.angle < 90.0 && attack_data.dist_sqrd < (1.5 * attack_data.min_attack_dist).powi(2) - && agent.action_state.timer < 6.0 + && agent.action_state.timer < 5.0 { + // Basic strike controller.inputs.move_dir = Vec2::zero(); controller .actions .push(ControlAction::basic_input(InputKind::Secondary)); + // Increase timer agent.action_state.timer += read_data.dt.0; + // If far from the target and timer lower than 6 } else if attack_data.dist_sqrd < (3.0 * attack_data.min_attack_dist).powi(2) - && attack_data.dist_sqrd > (2.0 * attack_data.min_attack_dist).powi(2) - && attack_data.angle < 90.0 - && agent.action_state.timer < 6.0 + && attack_data.dist_sqrd > (1.5 * attack_data.min_attack_dist).powi(2) + && attack_data.angle < 60.0 + && agent.action_state.timer < 5.0 { + // Dash controller .actions .push(ControlAction::basic_input(InputKind::Primary)); @@ -3331,7 +3341,9 @@ impl<'a> AgentData<'a> { .try_normalized() .unwrap_or_else(Vec2::unit_y); agent.action_state.timer += read_data.dt.0; + // If very far from the player } else if attack_data.dist_sqrd < MAX_PATH_DIST.powi(2) { + // Walk to the player self.path_toward_target(agent, controller, tgt_data, read_data, true, None); agent.action_state.timer += read_data.dt.0; } else { diff --git a/voxygen/src/scene/particle.rs b/voxygen/src/scene/particle.rs index d21640e0d6..76bd714891 100644 --- a/voxygen/src/scene/particle.rs +++ b/voxygen/src/scene/particle.rs @@ -324,7 +324,7 @@ impl ParticleMgr { self.maintain_boltnature_particles(scene_data, pos, vel) }, Body::Object(object::Body::Tornado) => { - self.maintain_tornado_particles(scene_data, pos, vel) + self.maintain_tornado_particles(scene_data, pos) }, Body::Object( object::Body::Bomb @@ -501,12 +501,11 @@ impl ParticleMgr { ); } - fn maintain_tornado_particles(&mut self, scene_data: &SceneData, pos: &Pos, vel: Option<&Vel>) { + fn maintain_tornado_particles(&mut self, scene_data: &SceneData, pos: &Pos) { let time = scene_data.state.get_time(); - let dt = scene_data.state.get_delta_time(); let mut rng = thread_rng(); - // nature + // air particles self.particles.resize_with( self.particles.len() + usize::from(self.scheduler.heartbeats(Duration::from_millis(5))), || { @@ -514,8 +513,7 @@ impl ParticleMgr { Duration::from_millis(1000), time, ParticleMode::Tornado, - pos.0.map(|e| e + rng.gen_range(-0.25..0.25)) - + vel.map_or(Vec3::zero(), |v| -v.0 * dt * rng.gen::()), + pos.0.map(|e| e + rng.gen_range(-0.25..0.25)), ) }, );