Arthropod charge

This commit is contained in:
Snowram 2021-09-07 01:43:10 +02:00
parent 02ed6ffd60
commit 1e6ead4005
12 changed files with 270 additions and 8 deletions

View File

@ -235,6 +235,11 @@
(None, "common.abilities.custom.arthropodbasic.leap"),
],
),
Custom("Arthropod Charge"): (
primary: "common.abilities.custom.arthropodcharge.singlestrike",
secondary: "common.abilities.custom.arthropodcharge.charge",
abilities: [],
),
Custom("Turret"): (
primary: "common.abilities.custom.turret.arrows",
secondary: "common.abilities.custom.turret.arrows",

View File

@ -0,0 +1,27 @@
DashMelee(
energy_cost: 0,
base_damage: 150,
scaled_damage: 600,
base_poise_damage: 25,
scaled_poise_damage: 100,
base_knockback: 10.0,
scaled_knockback: 30.0,
range: 5.0,
angle: 90.0,
energy_drain: 0,
forward_speed: 5.0,
buildup_duration: 0.3,
charge_duration: 4.0,
swing_duration: 0.1,
recover_duration: 0.4,
ori_modifier: 0.3,
charge_through: false,
is_interruptible: false,
damage_kind: Piercing,
damage_effect: Some(Buff((
kind: Bleeding,
dur_secs: 10.0,
strength: DamageFraction(0.1),
chance: 0.1,
))),
)

View File

@ -0,0 +1,34 @@
ComboMelee(
stage_data: [
(
stage: 1,
base_damage: 100,
damage_increase: 0,
base_poise_damage: 28,
poise_damage_increase: 0,
knockback: 3.0,
range: 2.7,
angle: 60.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.4,
forward_movement: 1.0,
damage_kind: Crushing,
damage_effect: Some(Buff((
kind: Poisoned,
dur_secs: 10.0,
strength: DamageFraction(1.0),
chance: 1.0,
))),
),
],
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,
ori_modifier: 0.7,
)

View File

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

View File

@ -266,6 +266,11 @@ fn default_main_tool(body: &Body) -> Item {
)),
},
Body::Arthropod(arthropod) => match arthropod.species {
arthropod::Species::Hornbeetle
| arthropod::Species::Stagbeetle
| arthropod::Species::Antlion => Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.arthropodcharge",
)),
_ => Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.arthropodbasic",
)),

View File

@ -1692,7 +1692,8 @@ impl<'a> AgentData<'a> {
"Quad Low Quick" => Tactic::QuadLowQuick,
"Quad Low Basic" => Tactic::QuadLowBasic,
"Theropod Basic" | "Theropod Bird" => Tactic::Theropod,
"Arthropod Basic" => Tactic::Arthropod,
"Arthropod Basic" => Tactic::ArthropodBasic,
"Arthropod Charge" => Tactic::ArthropodCharge,
"Theropod Charge" => Tactic::CircleCharge {
radius: 6,
circle_time: 1,
@ -1969,9 +1970,20 @@ impl<'a> AgentData<'a> {
Tactic::Theropod => {
self.handle_theropod_attack(agent, controller, &attack_data, tgt_data, read_data)
},
Tactic::Arthropod => {
self.handle_arthropod_attack(agent, controller, &attack_data, tgt_data, read_data)
},
Tactic::ArthropodBasic => self.handle_arthropod_basic_attack(
agent,
controller,
&attack_data,
tgt_data,
read_data,
),
Tactic::ArthropodCharge => self.handle_arthropod_charge_attack(
agent,
controller,
&attack_data,
tgt_data,
read_data,
),
Tactic::Turret => {
self.handle_turret_attack(agent, controller, &attack_data, tgt_data, read_data)
},

View File

@ -1681,7 +1681,47 @@ impl<'a> AgentData<'a> {
self.path_toward_target(agent, controller, tgt_data, read_data, true, false, None);
}
fn handle_arthropod_attack(
fn handle_arthropod_basic_attack(
&self,
agent: &mut Agent,
controller: &mut Controller,
attack_data: &AttackData,
tgt_data: &TargetData,
read_data: &ReadData,
) {
agent.action_state.timer += read_data.dt.0;
dbg!(agent.action_state.timer);
if agent.action_state.timer > 6.0
&& attack_data.dist_sqrd < (1.5 * attack_data.min_attack_dist).powi(2)
{
controller.inputs.move_dir = Vec2::zero();
controller
.actions
.push(ControlAction::basic_input(InputKind::Secondary));
if matches!(self.char_state, CharacterState::SpriteSummon(c) if matches!(c.stage_section, StageSection::Recover))
{
// Reset timer
agent.action_state.timer = 0.0;
}
} else if attack_data.angle < 90.0
&& attack_data.dist_sqrd < (1.5 * attack_data.min_attack_dist).powi(2)
{
controller.inputs.move_dir = Vec2::zero();
controller
.actions
.push(ControlAction::basic_input(InputKind::Primary));
} else if attack_data.angle < 15.0
&& attack_data.dist_sqrd < (6.0 * attack_data.min_attack_dist).powi(2)
{
controller
.actions
.push(ControlAction::basic_input(InputKind::Ability(0)));
} else {
self.path_toward_target(agent, controller, tgt_data, read_data, false, false, None);
}
}
fn handle_arthropod_charge_attack(
&self,
agent: &mut Agent,
controller: &mut Controller,

View File

@ -93,6 +93,8 @@ pub enum Tactic {
BirdLargeBreathe,
BirdLargeFire,
BirdLargeBasic,
ArthropodCharge,
ArthropodBasic,
Minotaur,
ClayGolem,
TidalWarrior,

View File

@ -0,0 +1,85 @@
use super::{super::Animation, ArthropodSkeleton, SkeletonAttr};
//use std::{f32::consts::PI, ops::Mul};
use super::super::vek::*;
use common::states::utils::StageSection;
use std::f32::consts::PI;
pub struct DashAnimation;
impl Animation for DashAnimation {
type Dependency<'a> = (f32, f32, Option<StageSection>, f32);
type Skeleton = ArthropodSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"arthropod_dash\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "arthropod_dash")]
fn update_skeleton_inner<'a>(
skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency<'a>,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let (movement1base, chargemovementbase, movement2base, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powi(4), 0.0, 0.0, 0.0),
Some(StageSection::Charge) => (1.0, 1.0, 0.0, 0.0),
Some(StageSection::Action) => (1.0, 1.0, anim_time.powi(6), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time),
_ => (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 twitch1 = (mirror * movement1base * 9.5).sin();
let twitch1fast = (mirror * movement1base * 25.0).sin();
//let twitch3 = (mirror * movement3 * 4.0).sin();
//let movement1 = mirror * movement1base * pullback;
//let movement2 = mirror * movement2base * pullback;
let movement1abs = movement1base * pullback;
let movement2abs = movement2base * pullback;
let short = ((1.0 / (0.72 + 0.28 * ((anim_time * 16.0_f32 + PI * 0.25).sin()).powi(2)))
.sqrt())
* ((anim_time * 16.0 + PI * 0.25).sin())
* chargemovementbase
* pullback;
let shortalt = (anim_time * 200.0 + PI * 0.25).sin() * chargemovementbase * pullback;
next.chest.scale = Vec3::one();
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_x(movement1abs * -0.4 + movement2abs * 1.4);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
next.mandible_l.position = Vec3::new(-s_a.mandible.0, s_a.mandible.1, s_a.mandible.2);
next.mandible_r.position = Vec3::new(s_a.mandible.0, s_a.mandible.1, s_a.mandible.2);
next.mandible_l.orientation =
Quaternion::rotation_z(movement1abs * 0.5 + movement2abs * -0.7);
next.mandible_r.orientation =
Quaternion::rotation_z(movement1abs * -0.5 + movement2abs * 0.7);
next.wing_fl.position = Vec3::new(-s_a.wing_f.0, s_a.wing_f.1, s_a.wing_f.2);
next.wing_fr.position = Vec3::new(s_a.wing_f.0, s_a.wing_f.1, s_a.wing_f.2);
next.wing_fl.orientation = Quaternion::rotation_x(movement1abs * -0.4 + shortalt * 0.2)
* Quaternion::rotation_y(movement1abs * -0.5 + movement2abs * -0.7)
* Quaternion::rotation_z(movement1abs * 0.2);
next.wing_fr.orientation = Quaternion::rotation_x(movement1abs * -0.4 + shortalt * 0.2)
* Quaternion::rotation_y(movement1abs * 0.5 + movement2abs * 0.7)
* Quaternion::rotation_z(movement1abs * -0.2);
next.wing_bl.position = Vec3::new(-s_a.wing_b.0, s_a.wing_b.1, s_a.wing_b.2);
next.wing_br.position = Vec3::new(s_a.wing_b.0, s_a.wing_b.1, s_a.wing_b.2);
next.wing_bl.orientation = Quaternion::rotation_x(movement1abs * -0.2 + shortalt * 0.2)
* Quaternion::rotation_y(movement1abs * -0.4 + movement2abs * -0.7)
* Quaternion::rotation_z(movement1abs * 0.2);
next.wing_br.orientation = Quaternion::rotation_x(movement1abs * -0.2 + shortalt * 0.2)
* Quaternion::rotation_y(movement1abs * 0.4 + movement2abs * 0.7)
* Quaternion::rotation_z(movement1abs * -0.2);
next
}
}

View File

@ -1,4 +1,5 @@
pub mod alpha;
pub mod dash;
pub mod idle;
pub mod jump;
pub mod leapmelee;
@ -7,8 +8,8 @@ pub mod stunned;
// Reexports
pub use self::{
alpha::AlphaAnimation, idle::IdleAnimation, jump::JumpAnimation, leapmelee::LeapMeleeAnimation,
run::RunAnimation, stunned::StunnedAnimation,
alpha::AlphaAnimation, dash::DashAnimation, idle::IdleAnimation, jump::JumpAnimation,
leapmelee::LeapMeleeAnimation, run::RunAnimation, stunned::StunnedAnimation,
};
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};

View File

@ -110,7 +110,7 @@ impl Animation for RunAnimation {
* Quaternion::rotation_z(s_a.leg_ori.3 + (mixed_vel + PI / 2.0).sin() * 0.2);
next.leg_br.orientation = Quaternion::rotation_x((mixed_vel).sin() * 0.2)
* Quaternion::rotation_y((mixed_vel).sin().min(0.0) * 0.7)
* Quaternion::rotation_z(s_a.leg_ori.3 - (mixed_vel + PI * 1.5).sin() * 0.2);
* Quaternion::rotation_z(-s_a.leg_ori.3 - (mixed_vel + PI * 1.5).sin() * 0.2);
next
}

View File

@ -3604,6 +3604,36 @@ impl FigureMgr {
skeleton_attr,
)
},
CharacterState::DashMelee(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::Charge => {
stage_time / s.static_data.charge_duration.as_secs_f32()
},
StageSection::Action => {
stage_time / s.static_data.swing_duration.as_secs_f32()
},
StageSection::Recover => {
stage_time / s.static_data.recover_duration.as_secs_f32()
},
_ => 0.0,
};
anim::arthropod::DashAnimation::update_skeleton(
&target_base,
(
rel_vel.magnitude(),
time,
Some(s.stage_section),
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 {