-add quadruped_medium/combomelee

-frostfang ability_set
This commit is contained in:
flo666 2023-03-29 19:08:49 +02:00 committed by Sam
parent 5a83f85779
commit c46ea4ae91
9 changed files with 291 additions and 5 deletions

View File

@ -354,6 +354,11 @@
secondary: Simple(None, "common.abilities.custom.quadmedbasic.triplestrike"),
abilities: [],
),
Custom("Frostfang"): (
primary: Simple(None, "common.abilities.custom.frostfang.singlestrike"),
secondary: Simple(None, "common.abilities.custom.frostfang.triplestrike"),
abilities: [],
),
Custom("Roshwalr"): (
primary: Simple(None, "common.abilities.custom.roshwalr.doublehusk"),
secondary: Simple(None, "common.abilities.custom.roshwalr.slowcharge"),

View File

@ -0,0 +1,31 @@
ComboMelee2(
strikes: [
(
melee_constructor: (
kind: Slash(
damage: 20,
poise: 28,
knockback: 3,
energy_regen: 0,
),
range: 2.7,
angle: 60.0,
damage_effect: Some(Buff((
kind: Frozen,
dur_secs: 10.0,
strength: DamageFraction(0.5),
chance: 1.0,
))),
),
buildup_duration: 0.8,
swing_duration: 0.1,
hit_timing: 0.5,
recover_duration: 0.8,
movement: (
swing: Some(Forward(1.0)),
),
ori_modifier: 0.6,
),
],
energy_cost_per_strike: 0,
)

View File

@ -0,0 +1,83 @@
ComboMelee2(
strikes: [
(
melee_constructor: (
kind: Bash(
damage: 10,
poise: 15,
knockback: 5.0,
energy_regen: 0,
),
range: 2.5,
angle: 30.0,
damage_effect: Some(Buff((
kind: Frozen,
dur_secs: 10.0,
strength: DamageFraction(0.5),
chance: 1.0,
))),
),
buildup_duration: 0.9,
swing_duration: 0.07,
hit_timing: 0.5,
recover_duration: 0.4,
movement: (
swing: Some(Forward(1.0)),
),
ori_modifier: 0.7,
),
(
melee_constructor: (
kind: Slash(
damage: 10,
poise: 18,
knockback: 5,
energy_regen: 0,
),
range: 2.5,
angle: 30.0,
damage_effect: Some(Buff((
kind: Frozen,
dur_secs: 10.0,
strength: DamageFraction(0.5),
chance: 1.0,
))),
),
buildup_duration: 0.8,
swing_duration: 0.07,
hit_timing: 0.5,
recover_duration: 0.4,
movement: (
swing: Some(Forward(0.0)),
),
ori_modifier: 0.7,
),
(
melee_constructor: (
kind: Bash(
damage: 10,
poise: 20,
knockback: 5,
energy_regen: 0,
),
range: 2.5,
angle: 30.0,
damage_effect: Some(Buff((
kind: Frozen,
dur_secs: 10.0,
strength: DamageFraction(0.5),
chance: 1.0,
))),
),
buildup_duration: 0.8,
swing_duration: 0.07,
hit_timing: 0.5,
recover_duration: 0.4,
movement: (
swing: Some(Forward(1.0)),
),
ori_modifier: 0.7,
),
],
energy_cost_per_strike: 0,
)

View File

@ -0,0 +1,21 @@
ItemDef(
name: "Frostfang",
description: "testing123",
kind: Tool((
kind: Natural,
hands: Two,
stats: (
equip_time_secs: 0.01,
power: 1.0,
effect_power: 1.0,
speed: 1.0,
crit_chance: 0.0625,
range: 1.0,
energy_efficiency: 1.0,
buff_strength: 1.0,
),
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Frostfang")),
)

View File

@ -574,6 +574,9 @@ fn default_main_tool(body: &Body) -> Item {
quadruped_medium::Species::Akhlut => Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.akhlut",
)),
quadruped_medium::Species::Frostfang => Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.frostfang",
)),
_ => Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.quadmedbasic",
)),

View File

@ -17,9 +17,9 @@ impl Animation for ComboAnimation {
type Skeleton = QuadrupedLowSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"character_combo\0";
const UPDATE_FN: &'static [u8] = b"quadruped_low_combo\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_combo")]
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_low_combo")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(ability_id, stage_section, _ability_info, current_strike, global_time, timer): Self::Dependency<'_>,

View File

@ -0,0 +1,109 @@
use super::{
super::{vek::*, Animation},
QuadrupedMediumSkeleton, SkeletonAttr,
};
use common::states::utils::{AbilityInfo, StageSection};
pub struct ComboAnimation;
impl Animation for ComboAnimation {
type Dependency<'a> = (
Option<&'a str>,
Option<StageSection>,
Option<AbilityInfo>,
usize,
f32,
f32,
);
type Skeleton = QuadrupedMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"quadruped_medium_combo\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_medium_combo")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(ability_id, stage_section, _ability_info, current_strike, global_time, timer): Self::Dependency<'_>,
anim_time: f32,
rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
let _multi_strike_pullback = 1.0
- if matches!(stage_section, Some(StageSection::Recover)) {
anim_time.powi(4)
} else {
0.0
};
for strike in 0..=current_strike {
match ability_id {
Some(
"common.abilities.custom.frostfang.singlestrike"
| "common.abilities.custom.frostfang.triplestrike",
) => {
let (movement1base, movement2base, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0),
Some(StageSection::Action) => (1.0, anim_time.powi(4), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
_ => (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 twitch3 = (mirror * movement3 * 9.0).sin();
let movement1 = mirror * movement1base * pullback;
let movement2 = mirror * movement2base * pullback;
let movement1abs = movement1base * pullback;
let movement2abs = movement2base * pullback;
match strike {
0 | 2 => {
next.head.orientation = Quaternion::rotation_z(twitch3 * -0.7);
next.head.orientation =
Quaternion::rotation_x(movement1abs * 0.35 + movement2abs * -0.9)
* Quaternion::rotation_y(movement1 * 0.7 + movement2 * -1.0);
next.jaw.orientation =
Quaternion::rotation_x(movement1abs * -0.5 + movement2abs * 0.5);
next.torso_front.orientation =
Quaternion::rotation_y(movement1 * -0.08 + movement2 * 0.15)
* Quaternion::rotation_z(movement1 * -0.2 + movement2 * 0.6);
next.torso_back.orientation = Quaternion::rotation_x(0.15)
* Quaternion::rotation_z(movement1 * -0.4 + movement2 * -0.2);
next.tail.orientation = Quaternion::rotation_x(-0.12)
* Quaternion::rotation_z(movement1 * -0.4 + movement2 * -0.2);
},
1 => {
next.head.orientation = Quaternion::rotation_z(twitch3 * 0.2);
next.neck.orientation =
Quaternion::rotation_x(movement1abs * 0.15 + movement2abs * -0.6)
* Quaternion::rotation_y(movement1 * -0.1 + movement2 * 0.15);
next.jaw.orientation =
Quaternion::rotation_x(movement1abs * -0.9 + movement2abs * 0.9);
next.torso_front.orientation =
Quaternion::rotation_y(movement1 * 0.08 + movement2 * -0.15)
* Quaternion::rotation_z(movement1 * 0.2 + movement2 * -0.3);
next.torso_back.orientation = Quaternion::rotation_x(0.15)
* Quaternion::rotation_z(movement1 * 0.4 + movement2 * 0.2);
next.tail.orientation = Quaternion::rotation_x(-0.12)
* Quaternion::rotation_z(movement1 * 0.4 + movement2 * 0.2);
},
_ => {},
}
},
_ => {},
}
}
next
}
}

View File

@ -1,5 +1,6 @@
pub mod alpha;
pub mod beta;
pub mod combomelee;
pub mod dash;
pub mod feed;
pub mod hoof;
@ -12,9 +13,10 @@ pub mod stunned;
// Reexports
pub use self::{
alpha::AlphaAnimation, beta::BetaAnimation, dash::DashAnimation, feed::FeedAnimation,
hoof::HoofAnimation, idle::IdleAnimation, jump::JumpAnimation, leapmelee::LeapMeleeAnimation,
run::RunAnimation, shockwave::ShockwaveAnimation, stunned::StunnedAnimation,
alpha::AlphaAnimation, beta::BetaAnimation, combomelee::ComboAnimation, dash::DashAnimation,
feed::FeedAnimation, hoof::HoofAnimation, idle::IdleAnimation, jump::JumpAnimation,
leapmelee::LeapMeleeAnimation, run::RunAnimation, shockwave::ShockwaveAnimation,
stunned::StunnedAnimation,
};
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};

View File

@ -2685,6 +2685,38 @@ impl FigureMgr {
),
}
},
CharacterState::ComboMelee2(s) => {
let timer = s.timer.as_secs_f32();
let current_strike = s.completed_strikes % s.static_data.strikes.len();
let strike_data = s.static_data.strikes[current_strike];
let progress = match s.stage_section {
StageSection::Buildup => {
timer / strike_data.buildup_duration.as_secs_f32()
},
StageSection::Action => {
timer / strike_data.swing_duration.as_secs_f32()
},
StageSection::Recover => {
timer / strike_data.recover_duration.as_secs_f32()
},
_ => 0.0,
};
anim::quadruped_medium::ComboAnimation::update_skeleton(
&target_base,
(
ability_id,
Some(s.stage_section),
Some(s.static_data.ability_info),
current_strike,
time,
state.state_time,
),
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 {