Makes summon range inclusive

This commit is contained in:
Snowram 2021-06-11 03:15:58 +02:00 committed by Robin Gilh
parent cb0566299a
commit f2c7836161
6 changed files with 32 additions and 23 deletions

View File

@ -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,
)

View File

@ -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;

View File

@ -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,

View File

@ -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

View File

@ -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 {

View File

@ -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::<f32>()),
pos.0.map(|e| e + rng.gen_range(-0.25..0.25)),
)
},
);