Breathe and stun anims

This commit is contained in:
Snowram 2021-04-12 00:22:08 +02:00
parent eb98360183
commit fd177c9669
30 changed files with 609 additions and 107 deletions

View File

@ -0,0 +1,14 @@
BasicBeam(
buildup_duration: 0.4,
recover_duration: 0.25,
beam_duration: 0.5,
damage: 50,
tick_rate: 3.0,
range: 15.0,
max_angle: 22.5,
damage_effect: None,
energy_regen: 0,
energy_drain: 0,
orientation_behavior: Normal,
specifier: Flamethrower,
)

View File

@ -0,0 +1,53 @@
ComboMelee(
stage_data: [
(
stage: 1,
base_damage: 100,
damage_increase: 0,
base_poise_damage: 0,
poise_damage_increase: 0,
knockback: 5.0,
range: 4.5,
angle: 30.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.1,
base_recover_duration: 0.3,
forward_movement: 2.0,
),
(
stage: 2,
base_damage: 80,
damage_increase: 0,
base_poise_damage: 0,
poise_damage_increase: 0,
knockback: 5.0,
range: 3.5,
angle: 30.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.1,
base_recover_duration: 0.3,
forward_movement: 1.5,
),
(
stage: 3,
base_damage: 130,
damage_increase: 0,
base_poise_damage: 0,
poise_damage_increase: 0,
knockback: 10.0,
range: 3.5,
angle: 30.0,
base_buildup_duration: 0.65,
base_swing_duration: 0.1,
base_recover_duration: 0.3,
forward_movement: 1.5,
),
],
initial_energy_gain: 0,
max_energy_gain: 0,
energy_increase: 0,
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
)

View File

@ -207,6 +207,11 @@
(None, "common.abilities.unique.mindflayer.summonminions"),
],
),
Unique(BirdLargeBreathe): (
primary: "common.abilities.unique.birdlargebreathe.flamethrower",
secondary: "common.abilities.unique.birdlargebreathe.triplestrike",
abilities: [],
),
Debug: (
primary: "common.abilities.debug.forwardboost",
secondary: "common.abilities.debug.upboost",

View File

@ -0,0 +1,18 @@
ItemDef(
name: "Bird Large Breathe",
description: "testing123",
kind: Tool((
kind: Unique(BirdLargeBreathe),
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
power: 1.0,
poise_strength: 1.0,
speed: 1.0,
crit_chance: 0.0625,
crit_mult: 1.9142857,
)),
)),
quality: Low,
tags: [],
)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -122,7 +122,6 @@ impl<'a, BodyMeta, SpeciesMeta> core::ops::Index<&'a Body> for AllBodies<BodyMet
Body::BirdLarge(_) => &self.bird_large.body,
Body::FishMedium(_) => &self.fish_medium.body,
Body::Dragon(_) => &self.dragon.body,
Body::BirdLarge(_) => &self.bird_large.body,
Body::FishSmall(_) => &self.fish_small.body,
Body::BipedLarge(_) => &self.biped_large.body,
Body::BipedSmall(_) => &self.biped_small.body,
@ -433,7 +432,7 @@ impl Body {
},
Body::FishMedium(_) => 50,
Body::Dragon(_) => 5000,
Body::BirdLarge(_) => 50,
Body::BirdLarge(_) => 9999999,
Body::FishSmall(_) => 20,
Body::BipedLarge(biped_large) => match biped_large.species {
biped_large::Species::Ogre => 2500,

View File

@ -60,10 +60,7 @@ impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies<SpeciesMeta>
}
}
pub const ALL_SPECIES: [Species; 2] = [
Species::Phoenix,
Species::Cockatrice,
];
pub const ALL_SPECIES: [Species; 2] = [Species::Phoenix, Species::Cockatrice];
impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> {
type IntoIter = std::iter::Copied<std::slice::Iter<'static, Self::Item>>;

View File

@ -441,4 +441,5 @@ pub enum UniqueKind {
ObjectTurret,
WoodenSpear,
MindflayerStaff,
BirdLargeBreathe,
}

View File

@ -1,6 +1,6 @@
use crate::{
comp::{
biped_large, biped_small, golem,
biped_large, biped_small, bird_large, golem,
inventory::{
loadout::Loadout,
slot::{ArmorSlot, EquipSlot},
@ -333,6 +333,14 @@ impl LoadoutBuilder {
));
},
},
Body::BirdLarge(bird_large) => match (bird_large.species, bird_large.body_type) {
(bird_large::Species::Cockatrice, _) => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.birdlargebreathe",
));
},
_ => {},
},
_ => {},
};
}

View File

@ -0,0 +1,87 @@
use super::{
super::{vek::*, Animation},
BirdLargeSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
pub struct AlphaAnimation;
impl Animation for AlphaAnimation {
type Dependency = (Option<StageSection>, f32, f32);
type Skeleton = BirdLargeSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"bird_large_alpha\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_large_alpha")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(stage_section, _global_time, _timer): Self::Dependency,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let (move1base, move2base, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(4.0)),
_ => (0.0, 0.0, 0.0),
};
let wave_slow_cos = (anim_time * 4.5).cos();
let pullback = 1.0 - move3;
let move1 = move1base * pullback;
let move2 = move2base * pullback;
next.head.scale = Vec3::one() * 0.98;
next.neck.scale = Vec3::one() * 1.02;
next.beak.scale = Vec3::one() * 0.98;
next.leg_l.scale = Vec3::one() / 8.0 * 0.98;
next.leg_r.scale = Vec3::one() / 8.0 * 0.98;
next.foot_l.scale = Vec3::one() * 1.02;
next.foot_r.scale = Vec3::one() * 1.02;
next.chest.scale = Vec3::one() * s_a.scaler / 8.0;
next.chest.position =
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06) * s_a.scaler / 8.0;
next.chest.orientation = Quaternion::rotation_x(move1 * 0.5 - move2 * 0.8);
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
next.neck.orientation = Quaternion::rotation_x(move1 * 0.5 - move2 * 0.8);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_x(move1 * 0.5 - move2 * 0.8);
next.beak.position = Vec3::new(0.0, s_a.beak.0, s_a.beak.1);
next.beak.orientation = Quaternion::rotation_x(wave_slow_cos * -0.02 - 0.02);
next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
next.tail_front.orientation = Quaternion::rotation_x(-move1 * 0.2);
next.tail_rear.position = Vec3::new(0.0, s_a.tail_rear.0, s_a.tail_rear.1);
next.tail_rear.orientation = Quaternion::rotation_x(0.0);
next.wing_in_l.position = Vec3::new(-s_a.wing_in.0, s_a.wing_in.1, s_a.wing_in.2);
next.wing_in_r.position = Vec3::new(s_a.wing_in.0, s_a.wing_in.1, s_a.wing_in.2);
next.wing_in_l.orientation =
Quaternion::rotation_y(-1.0 + wave_slow_cos * 0.06) * Quaternion::rotation_z(0.2);
next.wing_in_r.orientation =
Quaternion::rotation_y(1.0 - wave_slow_cos * 0.06) * Quaternion::rotation_z(-0.2);
next.wing_mid_l.position = Vec3::new(-s_a.wing_mid.0, s_a.wing_mid.1, s_a.wing_mid.2);
next.wing_mid_r.position = Vec3::new(s_a.wing_mid.0, s_a.wing_mid.1, s_a.wing_mid.2);
next.wing_mid_l.orientation = Quaternion::rotation_y(-0.1) * Quaternion::rotation_z(0.7);
next.wing_mid_r.orientation = Quaternion::rotation_y(0.1) * Quaternion::rotation_z(-0.7);
next.wing_out_l.position = Vec3::new(-s_a.wing_out.0, s_a.wing_out.1, s_a.wing_out.2);
next.wing_out_r.position = Vec3::new(s_a.wing_out.0, s_a.wing_out.1, s_a.wing_out.2);
next.wing_out_l.orientation = Quaternion::rotation_y(-0.2) * Quaternion::rotation_z(0.2);
next.wing_out_r.orientation = Quaternion::rotation_y(0.2) * Quaternion::rotation_z(-0.2);
next
}
}

View File

@ -0,0 +1,137 @@
use super::{
super::{vek::*, Animation},
BirdLargeSkeleton, SkeletonAttr,
};
use common::{states::utils::StageSection, util::Dir};
pub struct BreatheAnimation;
type BreatheAnimationDependency = (
f32,
f32,
Vec3<f32>,
Vec3<f32>,
Option<StageSection>,
f32,
Dir,
bool,
);
impl Animation for BreatheAnimation {
type Dependency = BreatheAnimationDependency;
type Skeleton = BirdLargeSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"bird_large_breathe\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_large_breathe")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, global_time, orientation, last_ori, stage_section, timer, look_dir, on_ground): Self::Dependency,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let (movement1base, movement2base, movement3, twitch) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0),
Some(StageSection::Cast) => (1.0, anim_time.min(1.0).powf(0.1), 0.0, anim_time),
Some(StageSection::Recover) => (1.0, 1.0, anim_time, 1.0),
_ => (0.0, 0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement3;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum();
let twitch2 = mirror * (twitch * 20.0).sin() * pullback;
let movement1abs = movement1base * pullback;
let movement2abs = movement2base * pullback;
let wave_slow_cos = (anim_time * 4.5).cos();
next.head.scale = Vec3::one() * 0.98;
next.neck.scale = Vec3::one() * 1.02;
next.beak.scale = Vec3::one() * 0.98;
next.leg_l.scale = Vec3::one() / 8.0 * 0.98;
next.leg_r.scale = Vec3::one() / 8.0 * 0.98;
next.foot_l.scale = Vec3::one() * 1.02;
next.foot_r.scale = Vec3::one() * 1.02;
next.chest.scale = Vec3::one() * s_a.scaler / 8.0;
next.chest.position = Vec3::new(
0.0,
s_a.chest.0,
s_a.chest.1 + wave_slow_cos * 0.06 + twitch2 * 0.1,
) * s_a.scaler
/ 8.0;
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
next.neck.orientation = Quaternion::rotation_x(movement1abs * 0.5 - movement2abs * 0.5);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation =
Quaternion::rotation_x(movement1abs * 0.5 - movement2abs * 0.5 + look_dir.z * 0.4);
next.beak.position = Vec3::new(0.0, s_a.beak.0, s_a.beak.1);
next.beak.orientation = Quaternion::rotation_x(movement1abs * -0.7 + twitch2 * 0.1);
if on_ground {
next.chest.orientation =
Quaternion::rotation_x(movement1abs * 0.1 - movement2abs * 0.1);
next.wing_in_l.position = Vec3::new(-s_a.wing_in.0, s_a.wing_in.1, s_a.wing_in.2);
next.wing_in_r.position = Vec3::new(s_a.wing_in.0, s_a.wing_in.1, s_a.wing_in.2);
next.wing_in_l.orientation =
Quaternion::rotation_y(-1.0 + movement1abs * 0.8 - movement2abs * 0.4)
* Quaternion::rotation_z(0.2 - movement1abs * 0.8 + movement2abs * 0.4);
next.wing_in_r.orientation =
Quaternion::rotation_y(1.0 - movement1abs * 0.8 + movement2abs * 0.4)
* Quaternion::rotation_z(-0.2 + movement1abs * 0.8 - movement2abs * 0.4);
next.wing_mid_l.position = Vec3::new(-s_a.wing_mid.0, s_a.wing_mid.1, s_a.wing_mid.2);
next.wing_mid_r.position = Vec3::new(s_a.wing_mid.0, s_a.wing_mid.1, s_a.wing_mid.2);
next.wing_mid_l.orientation =
Quaternion::rotation_y(-0.1) * Quaternion::rotation_z(0.7);
next.wing_mid_r.orientation =
Quaternion::rotation_y(0.1) * Quaternion::rotation_z(-0.7);
next.wing_out_l.position = Vec3::new(-s_a.wing_out.0, s_a.wing_out.1, s_a.wing_out.2);
next.wing_out_r.position = Vec3::new(s_a.wing_out.0, s_a.wing_out.1, s_a.wing_out.2);
next.wing_out_l.orientation =
Quaternion::rotation_y(-0.2) * Quaternion::rotation_z(0.2);
next.wing_out_r.orientation =
Quaternion::rotation_y(0.2) * Quaternion::rotation_z(-0.2);
next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
next.tail_front.orientation =
Quaternion::rotation_x(-movement1abs * 0.1 + movement2abs * 0.1 + twitch2 * 0.02);
next.tail_rear.position = Vec3::new(0.0, s_a.tail_rear.0, s_a.tail_rear.1);
next.tail_rear.orientation =
Quaternion::rotation_x(-movement1abs * 0.1 + movement2abs * 0.1 + twitch2 * 0.02);
} else {
let ori: Vec2<f32> = Vec2::from(orientation);
let last_ori = Vec2::from(last_ori);
let tilt = if ::vek::Vec2::new(ori, last_ori)
.map(|o| o.magnitude_squared())
.map(|m| m > 0.001 && m.is_finite())
.reduce_and()
&& ori.angle_between(last_ori).is_finite()
{
ori.angle_between(last_ori).min(0.2)
* last_ori.determine_side(Vec2::zero(), ori).signum()
} else {
0.0
} * 1.3;
next.chest.orientation =
Quaternion::rotation_x(movement1abs * 0.1 - movement2abs * 0.1)
* Quaternion::rotation_y(tilt * 1.8);
}
next
}
}

View File

@ -42,15 +42,15 @@ impl Animation for FeedAnimation {
next.head.scale = Vec3::one() * 0.98;
next.neck.scale = Vec3::one() * 1.02;
next.beak.scale = Vec3::one() * 0.98;
next.leg_l.scale = Vec3::one() * 0.98;
next.leg_r.scale = Vec3::one() * 0.98;
next.foot_l.scale = Vec3::one() * 0.98;
next.foot_r.scale = Vec3::one() * 0.98;
next.chest.scale = Vec3::one() * s_a.scaler / 4.0;
next.leg_l.scale = Vec3::one() / 8.0 * 0.98;
next.leg_r.scale = Vec3::one() / 8.0 * 0.98;
next.foot_l.scale = Vec3::one() * 1.02;
next.foot_r.scale = Vec3::one() * 1.02;
next.chest.scale = Vec3::one() * s_a.scaler / 8.0;
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06 - 1.8)
* s_a.scaler
/ 4.0;
/ 8.0;
next.chest.orientation = Quaternion::rotation_x(-0.5);
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
@ -72,9 +72,11 @@ impl Animation for FeedAnimation {
next.wing_in_r.position = Vec3::new(s_a.wing_in.0, s_a.wing_in.1, s_a.wing_in.2);
next.wing_in_l.orientation =
Quaternion::rotation_y(-s_a.wings_angle + 0.3 + wave_fast * 0.08) * Quaternion::rotation_z(0.2);
Quaternion::rotation_y(-s_a.wings_angle + 0.3 + wave_fast * 0.08)
* Quaternion::rotation_z(0.2);
next.wing_in_r.orientation =
Quaternion::rotation_y(s_a.wings_angle - 0.3 - wave_fast * 0.08) * Quaternion::rotation_z(-0.2);
Quaternion::rotation_y(s_a.wings_angle - 0.3 - wave_fast * 0.08)
* Quaternion::rotation_z(-0.2);
next.wing_mid_l.position = Vec3::new(-s_a.wing_mid.0, s_a.wing_mid.1, s_a.wing_mid.2);
next.wing_mid_r.position = Vec3::new(s_a.wing_mid.0, s_a.wing_mid.1, s_a.wing_mid.2);
@ -86,9 +88,9 @@ impl Animation for FeedAnimation {
next.wing_out_l.orientation = Quaternion::rotation_y(-0.2) * Quaternion::rotation_z(0.2);
next.wing_out_r.orientation = Quaternion::rotation_y(0.2) * Quaternion::rotation_z(-0.2);
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 - wave_slow_cos * 0.06);
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2) / 8.0;
next.leg_l.orientation = Quaternion::rotation_x(0.5);
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 - wave_slow_cos * 0.06);
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2) / 8.0;
next.leg_r.orientation = Quaternion::rotation_x(0.5);
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);

View File

@ -15,7 +15,7 @@ impl Animation for FlyAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_large_fly")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, orientation, last_ori, _global_time, avg_vel, _acc_vel): Self::Dependency,
(velocity, orientation, last_ori, _global_time, _avg_vel, _acc_vel): Self::Dependency,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
@ -60,25 +60,27 @@ impl Animation for FlyAnimation {
next.head.scale = Vec3::one() * 0.98;
next.neck.scale = Vec3::one() * 1.02;
next.beak.scale = Vec3::one() * 0.98;
next.leg_l.scale = Vec3::one() * 0.98;
next.leg_r.scale = Vec3::one() * 0.98;
next.foot_l.scale = Vec3::one() * 0.98;
next.foot_r.scale = Vec3::one() * 0.98;
next.chest.scale = Vec3::one() * s_a.scaler / 4.0;
next.leg_l.scale = Vec3::one() / 8.0 * 0.98;
next.leg_r.scale = Vec3::one() / 8.0 * 0.98;
next.foot_l.scale = Vec3::one() * 1.02;
next.foot_r.scale = Vec3::one() * 1.02;
next.chest.scale = Vec3::one() * s_a.scaler / 8.0;
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
next.neck.orientation =
Quaternion::rotation_x((-0.4 + 0.2 * velocity.xy().magnitude() / 5.0).max(-0.4));
Quaternion::rotation_x((-0.4 + 0.2 * velocity.xy().magnitude() / 5.0).min(0.15));
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation =
Quaternion::rotation_x((-0.6 + 0.2 * velocity.xy().magnitude() / 5.0).max(-0.6) + fast * 0.05);
next.head.orientation = Quaternion::rotation_x(
(-0.6 + 0.2 * velocity.xy().magnitude() / 5.0).min(-0.3) + fast * 0.05,
);
next.beak.position = Vec3::new(0.0, s_a.beak.0, s_a.beak.1);
if velocity.z > 2.0 || velocity.xy().magnitude() < 1.8 {
next.chest.position =
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 - flap4 * 1.5) * s_a.scaler / 4.0;
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 - flap4 * 1.5) * s_a.scaler / 8.0;
next.chest.orientation = Quaternion::rotation_x(
(0.8 - 0.8 * velocity.xy().magnitude() / 5.0).max(-0.2) - flap1 * 0.2,
) * Quaternion::rotation_y(tilt * 1.8 + fast * 0.01);
@ -108,14 +110,14 @@ impl Animation for FlyAnimation {
next.tail_rear.orientation =
Quaternion::rotation_x(-flap3 * 0.3) * Quaternion::rotation_z(-tilt * 1.0);
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2);
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 - flap4 * 1.5) / 8.0;
next.leg_l.orientation = Quaternion::rotation_x(
(-1.0 - 0.8 * velocity.xy().magnitude() / 5.0).max(-0.8) + flap1 * -0.1,
);
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2);
(-1.0 * velocity.xy().magnitude() / 5.0).max(-1.0) + flap1 * -0.1,
) * Quaternion::rotation_y(tilt * 1.6 + fast * 0.01);
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 - flap4 * 1.5) / 8.0;
next.leg_r.orientation = Quaternion::rotation_x(
(-1.0 - 0.8 * velocity.xy().magnitude() / 5.0).max(-0.8) + flap1 * -0.1,
);
(-1.0 * velocity.xy().magnitude() / 5.0).max(-1.0) + flap1 * -0.1,
) * Quaternion::rotation_y(tilt * 1.6 + fast * 0.01);
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(flap1 * -0.05);
@ -123,7 +125,7 @@ impl Animation for FlyAnimation {
next.foot_r.orientation = Quaternion::rotation_x(flap1 * -0.05);
} else {
next.chest.position =
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + slow * 0.05) * s_a.scaler / 4.0;
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + slow * 0.05) * s_a.scaler / 8.0;
next.chest.orientation =
Quaternion::rotation_x(-0.2 + slow * 0.05 + (0.8 * velocity.z / 80.0).min(0.8))
* Quaternion::rotation_y(tilt * 1.8 + fast * 0.01);
@ -157,10 +159,12 @@ impl Animation for FlyAnimation {
next.tail_rear.orientation =
Quaternion::rotation_x(-0.2 + slow * 0.08) * Quaternion::rotation_z(-tilt * 1.0);
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2);
next.leg_l.orientation = Quaternion::rotation_x(-1.0 + slow * -0.05);
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2);
next.leg_r.orientation = Quaternion::rotation_x(-1.0 + slow * -0.05);
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + slow * 0.05) / 8.0;
next.leg_l.orientation = Quaternion::rotation_x(-1.0 + slow * -0.05)
* Quaternion::rotation_y(tilt * 1.6 + fast * 0.01);
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + slow * 0.05) / 8.0;
next.leg_r.orientation = Quaternion::rotation_x(-1.0 + slow * -0.05)
* Quaternion::rotation_y(tilt * 1.6 + fast * 0.01);
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(slow * -0.05);

View File

@ -40,14 +40,15 @@ impl Animation for IdleAnimation {
next.head.scale = Vec3::one() * 0.98;
next.neck.scale = Vec3::one() * 1.02;
next.beak.scale = Vec3::one() * 0.98;
next.leg_l.scale = Vec3::one() * 0.98;
next.leg_r.scale = Vec3::one() * 0.98;
next.foot_l.scale = Vec3::one() * 0.98;
next.foot_r.scale = Vec3::one() * 0.98;
next.chest.scale = Vec3::one() * s_a.scaler / 4.0;
next.leg_l.scale = Vec3::one() / 8.0 * 0.98;
next.leg_r.scale = Vec3::one() / 8.0 * 0.98;
next.foot_l.scale = Vec3::one() * 1.02;
next.foot_r.scale = Vec3::one() * 1.02;
next.chest.scale = Vec3::one() * s_a.scaler / 8.0;
next.chest.position =
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06) * s_a.scaler / 4.0;
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06 + 1.5)
* s_a.scaler
/ 8.0;
next.chest.orientation = Quaternion::rotation_x(0.0);
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
@ -83,9 +84,9 @@ impl Animation for IdleAnimation {
next.wing_out_l.orientation = Quaternion::rotation_y(-0.2) * Quaternion::rotation_z(0.2);
next.wing_out_r.orientation = Quaternion::rotation_y(0.2) * Quaternion::rotation_z(-0.2);
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 - wave_slow_cos * 0.06);
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2) / 8.0;
next.leg_l.orientation = Quaternion::rotation_x(0.0);
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 - wave_slow_cos * 0.06);
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2) / 8.0;
next.leg_r.orientation = Quaternion::rotation_x(0.0);
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);

View File

@ -1,10 +1,16 @@
pub mod alpha;
pub mod breathe;
pub mod feed;
pub mod fly;
pub mod idle;
pub mod run;
pub mod stunned;
// Reexports
pub use self::{feed::FeedAnimation, fly::FlyAnimation, idle::IdleAnimation, run::RunAnimation};
pub use self::{
alpha::AlphaAnimation, breathe::BreatheAnimation, feed::FeedAnimation, fly::FlyAnimation,
idle::IdleAnimation, run::RunAnimation, stunned::StunnedAnimation,
};
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
use common::comp::{self};
@ -58,8 +64,8 @@ impl Skeleton for BirdLargeSkeleton {
let wing_mid_r_mat = wing_in_r_mat * Mat4::<f32>::from(self.wing_mid_r);
let wing_out_l_mat = wing_mid_l_mat * Mat4::<f32>::from(self.wing_out_l);
let wing_out_r_mat = wing_mid_r_mat * Mat4::<f32>::from(self.wing_out_r);
let leg_l_mat = chest_mat * Mat4::<f32>::from(self.leg_l);
let leg_r_mat = chest_mat * Mat4::<f32>::from(self.leg_r);
let leg_l_mat = base_mat * Mat4::<f32>::from(self.leg_l);
let leg_r_mat = base_mat * Mat4::<f32>::from(self.leg_r);
let foot_l_mat = leg_l_mat * Mat4::<f32>::from(self.foot_l);
let foot_r_mat = leg_r_mat * Mat4::<f32>::from(self.foot_r);
@ -99,7 +105,6 @@ pub struct SkeletonAttr {
foot: (f32, f32, f32),
scaler: f32,
wings_angle: f32,
flight_angle: f32,
}
impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
@ -129,7 +134,6 @@ impl Default for SkeletonAttr {
foot: (0.0, 0.0, 0.0),
scaler: 0.0,
wings_angle: 0.0,
flight_angle: 0.0,
}
}
}
@ -176,11 +180,11 @@ impl<'a> From<&'a Body> for SkeletonAttr {
},
leg: match (body.species, body.body_type) {
(Phoenix, _) => (2.5, -2.5, -3.5),
(Cockatrice, _) => (2.5, 2.5, -3.5),
(Cockatrice, _) => (3.5, 2.5, 13.0),
},
foot: match (body.species, body.body_type) {
(Phoenix, _) => (0.0, -0.5, -0.5),
(Cockatrice, _) => (1.5, -3.0, -3.0),
(Cockatrice, _) => (0.5, -3.0, -3.0),
},
scaler: match (body.species, body.body_type) {
(Phoenix, _) => (1.0),
@ -190,10 +194,6 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Phoenix, _) => (1.3),
(Cockatrice, _) => (0.9),
},
flight_angle: match (body.species, body.body_type) {
(Phoenix, _) => (-0.5),
(Cockatrice, _) => (1.0),
},
}
}
}

View File

@ -16,7 +16,7 @@ impl Animation for RunAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_large_run")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, orientation, last_ori, _global_time, avg_vel, acc_vel): Self::Dependency,
(velocity, orientation, last_ori, _global_time, _avg_vel, acc_vel): Self::Dependency,
_anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
@ -64,11 +64,11 @@ impl Animation for RunAnimation {
next.head.scale = Vec3::one() * 0.98;
next.neck.scale = Vec3::one() * 1.02;
next.beak.scale = Vec3::one() * 0.98;
next.leg_l.scale = Vec3::one() * 0.98;
next.leg_r.scale = Vec3::one() * 0.98;
next.foot_l.scale = Vec3::one() * 0.98;
next.foot_r.scale = Vec3::one() * 0.98;
next.chest.scale = Vec3::one() * s_a.scaler / 4.0;
next.leg_l.scale = Vec3::one() / 8.0 * 0.98;
next.leg_r.scale = Vec3::one() / 8.0 * 0.98;
next.foot_l.scale = Vec3::one() * 1.02;
next.foot_r.scale = Vec3::one() * 1.02;
next.chest.scale = Vec3::one() * s_a.scaler / 8.0;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_x(-0.1 * speednorm + short * -0.05)
@ -88,7 +88,7 @@ impl Animation for RunAnimation {
s_a.chest.0,
s_a.chest.1 + short * 0.5 + 0.5 * speednorm,
) * s_a.scaler
/ 4.0;
/ 8.0;
next.chest.orientation = Quaternion::rotation_x(short * 0.07)
* Quaternion::rotation_y(tilt * 0.8)
* Quaternion::rotation_z(shortalt * 0.10);
@ -102,8 +102,10 @@ impl Animation for RunAnimation {
next.wing_in_l.position = Vec3::new(-s_a.wing_in.0, s_a.wing_in.1, s_a.wing_in.2);
next.wing_in_r.position = Vec3::new(s_a.wing_in.0, s_a.wing_in.1, s_a.wing_in.2);
next.wing_in_l.orientation = Quaternion::rotation_y(-s_a.wings_angle) * Quaternion::rotation_z(0.2);
next.wing_in_r.orientation = Quaternion::rotation_y(s_a.wings_angle) * Quaternion::rotation_z(-0.2);
next.wing_in_l.orientation =
Quaternion::rotation_y(-s_a.wings_angle) * Quaternion::rotation_z(0.2);
next.wing_in_r.orientation =
Quaternion::rotation_y(s_a.wings_angle) * Quaternion::rotation_z(-0.2);
next.wing_mid_l.position = Vec3::new(-s_a.wing_mid.0, s_a.wing_mid.1, s_a.wing_mid.2);
next.wing_mid_r.position = Vec3::new(s_a.wing_mid.0, s_a.wing_mid.1, s_a.wing_mid.2);
@ -121,7 +123,7 @@ impl Animation for RunAnimation {
-s_a.leg.0 + speednorm * 1.5,
s_a.leg.1 + foot1b * -2.3,
s_a.leg.2,
);
) / 8.0;
next.leg_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1a * 0.15)
* Quaternion::rotation_y(tilt * 0.5);
@ -129,7 +131,7 @@ impl Animation for RunAnimation {
s_a.leg.0 + speednorm * -1.5,
s_a.leg.1 + foot2b * -2.3,
s_a.leg.2,
);
) / 8.0;
next.leg_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2a * 0.15)
* Quaternion::rotation_y(tilt * 0.5);

View File

@ -0,0 +1,111 @@
use super::{
super::{vek::*, Animation},
BirdLargeSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
use std::ops::Mul;
pub struct StunnedAnimation;
impl Animation for StunnedAnimation {
type Dependency = (f32, f32, Option<StageSection>, f32);
type Skeleton = BirdLargeSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"bird_large_stunned\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_large_stunned")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let duck_head_look = Vec2::new(
(global_time / 2.0 + anim_time / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
(global_time / 2.0 + anim_time / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
);
let wave_slow_cos = (anim_time * 4.5).cos();
let (movement1base, movement2, twitch) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.1), 0.0, anim_time),
Some(StageSection::Recover) => (1.0, anim_time.powf(4.0), 1.0),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement2;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum();
let twitch2 = mirror * (twitch * 20.0).sin() * pullback;
let movement1abs = movement1base * pullback;
next.head.scale = Vec3::one() * 0.98;
next.neck.scale = Vec3::one() * 1.02;
next.beak.scale = Vec3::one() * 0.98;
next.leg_l.scale = Vec3::one() / 8.0 * 0.98;
next.leg_r.scale = Vec3::one() / 8.0 * 0.98;
next.foot_l.scale = Vec3::one() * 1.02;
next.foot_r.scale = Vec3::one() * 1.02;
next.chest.scale = Vec3::one() * s_a.scaler / 8.0;
next.chest.position =
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06) * s_a.scaler / 8.0;
next.chest.orientation = Quaternion::rotation_x(movement1base * 0.5);
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
next.neck.orientation = Quaternion::rotation_x(0.0);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(twitch2 * 0.8)
* Quaternion::rotation_x(-duck_head_look.y.abs() + wave_slow_cos * 0.01);
next.beak.position = Vec3::new(0.0, s_a.beak.0, s_a.beak.1);
next.beak.orientation = Quaternion::rotation_x(-movement1abs * 0.8);
next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
next.tail_front.orientation = Quaternion::rotation_x(0.0);
next.tail_rear.position = Vec3::new(0.0, s_a.tail_rear.0, s_a.tail_rear.1);
next.tail_rear.orientation = Quaternion::rotation_x(0.0);
next.wing_in_l.position = Vec3::new(-s_a.wing_in.0, s_a.wing_in.1, s_a.wing_in.2);
next.wing_in_r.position = Vec3::new(s_a.wing_in.0, s_a.wing_in.1, s_a.wing_in.2);
next.wing_in_l.orientation = Quaternion::rotation_y(wave_slow_cos * 0.06 + twitch2 * 0.8)
* Quaternion::rotation_z(0.2 - movement1abs);
next.wing_in_r.orientation = Quaternion::rotation_y(wave_slow_cos * 0.06 - twitch2 * 0.8)
* Quaternion::rotation_z(-0.2 + movement1abs);
next.wing_mid_l.position = Vec3::new(-s_a.wing_mid.0, s_a.wing_mid.1, s_a.wing_mid.2);
next.wing_mid_r.position = Vec3::new(s_a.wing_mid.0, s_a.wing_mid.1, s_a.wing_mid.2);
next.wing_mid_l.orientation = Quaternion::rotation_y(-0.1) * Quaternion::rotation_z(0.7);
next.wing_mid_r.orientation = Quaternion::rotation_y(0.1) * Quaternion::rotation_z(-0.7);
next.wing_out_l.position = Vec3::new(-s_a.wing_out.0, s_a.wing_out.1, s_a.wing_out.2);
next.wing_out_r.position = Vec3::new(s_a.wing_out.0, s_a.wing_out.1, s_a.wing_out.2);
next.wing_out_l.orientation = Quaternion::rotation_y(-0.2) * Quaternion::rotation_z(0.2);
next.wing_out_r.orientation = Quaternion::rotation_y(0.2) * Quaternion::rotation_z(-0.2);
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2) / 8.0;
next.leg_l.orientation = Quaternion::rotation_x(movement1abs * 0.8);
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2) / 8.0;
next.leg_r.orientation = Quaternion::rotation_x(0.0);
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(0.0);
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(0.0);
next
}
}

View File

@ -3334,7 +3334,7 @@ impl BirdLargeLateralSpec {
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
},
};
let lateral = graceful_load_segment(&spec.wing_in_l.lateral.0);
let lateral = graceful_load_segment_flipped(&spec.wing_in_l.lateral.0, true);
(lateral, Vec3::from(spec.wing_in_l.offset))
}
@ -3366,7 +3366,7 @@ impl BirdLargeLateralSpec {
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
},
};
let lateral = graceful_load_segment(&spec.wing_mid_l.lateral.0);
let lateral = graceful_load_segment_flipped(&spec.wing_mid_l.lateral.0, true);
(lateral, Vec3::from(spec.wing_mid_l.offset))
}
@ -3398,7 +3398,7 @@ impl BirdLargeLateralSpec {
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
},
};
let lateral = graceful_load_segment(&spec.wing_out_l.lateral.0);
let lateral = graceful_load_segment_flipped(&spec.wing_out_l.lateral.0, true);
(lateral, Vec3::from(spec.wing_out_l.offset))
}
@ -3430,7 +3430,7 @@ impl BirdLargeLateralSpec {
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
},
};
let lateral = graceful_load_segment(&spec.leg_l.lateral.0);
let lateral = graceful_load_segment_flipped(&spec.leg_l.lateral.0, true);
(lateral, Vec3::from(spec.leg_l.offset))
}
@ -3462,7 +3462,7 @@ impl BirdLargeLateralSpec {
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
},
};
let lateral = graceful_load_segment(&spec.foot_l.lateral.0);
let lateral = graceful_load_segment_flipped(&spec.foot_l.lateral.0, true);
(lateral, Vec3::from(spec.foot_l.offset))
}

View File

@ -3359,7 +3359,100 @@ impl FigureMgr {
skeleton_attr,
)
},
CharacterState::BasicBeam(s) => {
let stage_time = s.timer.as_secs_f32();
let stage_progress = match s.stage_section {
StageSection::Buildup => {
stage_time / s.static_data.buildup_duration.as_secs_f32()
},
StageSection::Cast => s.timer.as_secs_f32(),
StageSection::Recover => {
stage_time / s.static_data.recover_duration.as_secs_f32()
},
_ => 0.0,
};
anim::bird_large::BreatheAnimation::update_skeleton(
&target_base,
(
rel_vel.magnitude(),
time,
ori * anim::vek::Vec3::<f32>::unit_y(),
state.last_ori * anim::vek::Vec3::<f32>::unit_y(),
Some(s.stage_section),
state.state_time,
look_dir,
physics.on_ground,
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
)
},
CharacterState::ComboMelee(s) => {
let stage_index = (s.stage - 1) as usize;
let stage_time = s.timer.as_secs_f32();
let stage_progress = match s.stage_section {
StageSection::Buildup => {
stage_time
/ s.static_data.stage_data[stage_index]
.base_buildup_duration
.as_secs_f32()
},
StageSection::Swing => {
stage_time
/ s.static_data.stage_data[stage_index]
.base_swing_duration
.as_secs_f32()
},
StageSection::Recover => {
stage_time
/ s.static_data.stage_data[stage_index]
.base_recover_duration
.as_secs_f32()
},
_ => 0.0,
};
anim::bird_large::AlphaAnimation::update_skeleton(
&target_base,
(Some(s.stage_section), time, state.state_time),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
)
},
CharacterState::Stunned(s) => {
let stage_time = s.timer.as_secs_f32();
let stage_progress = match s.stage_section {
StageSection::Buildup => {
stage_time / s.static_data.buildup_duration.as_secs_f32()
},
StageSection::Recover => {
stage_time / s.static_data.recover_duration.as_secs_f32()
},
_ => 0.0,
};
match s.static_data.poise_state {
PoiseState::Normal
| PoiseState::Interrupted
| PoiseState::Stunned
| PoiseState::Dazed
| PoiseState::KnockedDown => {
anim::bird_large::StunnedAnimation::update_skeleton(
&target_base,
(
rel_vel.magnitude(),
time,
Some(s.stage_section),
state.state_time,
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
)
},
}
},
// TODO!
_ => target_base,
};

View File

@ -282,7 +282,7 @@ pub fn apply_caves_supplement<'a>(
},
_ => {
is_hostile = true;
let species = match dynamic_rng.gen_range(0..4) {
let species = match dynamic_rng.gen_range(0..5) {
0 => comp::biped_large::Species::Ogre,
1 => comp::biped_large::Species::Cyclops,
2 => comp::biped_large::Species::Wendigo,

View File

@ -1,8 +1,8 @@
use crate::{column::ColumnSample, sim::SimChunk, IndexRef, CONFIG};
use common::{
comp::{
biped_large, bird_medium, bird_large, fish_medium, fish_small, quadruped_low, quadruped_medium,
quadruped_small, theropod, Alignment,
biped_large, bird_large, bird_medium, fish_medium, fish_small, quadruped_low,
quadruped_medium, quadruped_small, theropod, Alignment,
},
generation::{ChunkSupplement, EntityInfo},
terrain::Block,