Assigns a ToolKind to bipedlarge weapons

This commit is contained in:
unknown 2020-09-26 18:44:29 +02:00 committed by Robin Gilh
parent 0e628ef67f
commit d2f91bc3a0
28 changed files with 332 additions and 42 deletions

View File

@ -0,0 +1,13 @@
ItemDef(
name: "Lizardman bow",
description: "Placeholder",
kind: Tool(
(
kind: Bow("LizardmanBow"),
stats: (
equip_time_millis: 500,
power: 1.00,
),
)
),
)

View File

@ -0,0 +1,13 @@
ItemDef(
name: "Cyclops Hammer",
description: "Placeholder",
kind: Tool(
(
kind: Hammer("CyclopsHammer"),
stats: (
equip_time_millis: 500,
power: 1.00,
),
)
),
)

View File

@ -0,0 +1,13 @@
ItemDef(
name: "Ogre Hammer",
description: "Placeholder",
kind: Tool(
(
kind: Hammer("OgreHammer"),
stats: (
equip_time_millis: 500,
power: 1.00,
),
)
),
)

View File

@ -0,0 +1,13 @@
ItemDef(
name: "Troll Hammer",
description: "Placeholder",
kind: Tool(
(
kind: Hammer("TrollHammer"),
stats: (
equip_time_millis: 500,
power: 1.00,
),
)
),
)

View File

@ -0,0 +1,13 @@
ItemDef(
name: "Wendigo Hammer",
description: "Placeholder",
kind: Tool(
(
kind: Hammer("WendigoHammer"),
stats: (
equip_time_millis: 500,
power: 1.00,
),
)
),
)

View File

@ -0,0 +1,13 @@
ItemDef(
name: "Lizardman Staff",
description: "Placeholder",
kind: Tool(
(
kind: Staff("LizardmanStaff"),
stats: (
equip_time_millis: 500,
power: 1.00,
),
)
),
)

View File

@ -0,0 +1,13 @@
ItemDef(
name: "Ogre Staff",
description: "Placeholder",
kind: Tool(
(
kind: Staff("OgreStaff"),
stats: (
equip_time_millis: 500,
power: 1.00,
),
)
),
)

View File

@ -0,0 +1,13 @@
ItemDef(
name: "Dullahan Sword",
description: "Placehoder",
kind: Tool(
(
kind: Sword("DullahanSword"),
stats: (
equip_time_millis: 500,
power: 1.00,
),
)
),
)

View File

@ -0,0 +1,13 @@
ItemDef(
name: "Lizardman Sword",
description: "Placehoder",
kind: Tool(
(
kind: Sword("LizardmanSword"),
stats: (
equip_time_millis: 500,
power: 1.00,
),
)
),
)

View File

@ -26,7 +26,7 @@
),
main: (
offset: (-5.0, -5.5, -5.0),
central: ("npc.ogre.male.hammer"),
central: ("weapon.hammer.2hhammer_ogre"),
)
),
(Ogre, Female): (
@ -56,7 +56,7 @@
),
main: (
offset: (-2.5, -5.5, -5.0),
central: ("npc.ogre.female.main"),
central: ("weapon.hammer.2hhammer_ogre"),
)
),
(Cyclops, Male): (
@ -86,7 +86,7 @@
),
main: (
offset: (-5.0, -6.5, -4.0),
central: ("npc.cyclops.male.hammer"),
central: ("weapon.hammer.2hhammer_cyclops-0"),
)
),
(Cyclops, Female): (
@ -116,7 +116,7 @@
),
main: (
offset: (-5.0, -6.5, -4.0),
central: ("npc.cyclops.female.hammer"),
central: ("weapon.hammer.2hhammer_cyclops-0"),
)
),
(Wendigo, Male): (
@ -146,7 +146,7 @@
),
main: (
offset: (-5.0, -6.5, -4.0),
central: ("npc.wendigo.male.hammer"),
central: ("weapon.hammer.2hhammer_wendigo"),
)
),
(Wendigo, Female): (
@ -176,7 +176,7 @@
),
main: (
offset: (-5.0, -6.5, -4.0),
central: ("npc.wendigo.male.hammer"),
central: ("weapon.hammer.2hhammer_wendigo"),
)
),
(Troll, Male): (
@ -206,7 +206,7 @@
),
main: (
offset: (-5.0, -6.5, -4.0),
central: ("npc.troll.male.hammer"),
central: ("weapon.hammer.2hhammer_troll"),
)
),
(Troll, Female): (
@ -236,7 +236,7 @@
),
main: (
offset: (-5.0, -6.5, -4.0),
central: ("npc.troll.female.hammer"),
central: ("weapon.hammer.2hhammer_troll"),
)
),
(Dullahan, Male): (
@ -266,7 +266,7 @@
),
main: (
offset: (-5.0, -6.5, -4.0),
central: ("npc.cyclops.male.hammer"),
central: ("weapon.sword.greatsword_2h_dullahan"),
)
),
(Dullahan, Female): (
@ -296,7 +296,7 @@
),
main: (
offset: (-5.0, -6.5, -4.0),
central: ("npc.cyclops.male.hammer"),
central: ("weapon.sword.greatsword_2h_dullahan"),
)
),
(Werewolf, Male): (
@ -386,7 +386,7 @@
),
main: (
offset: (-1.5, -9.0, -10.0),
central: ("npc.lizardman_occult.male.weapon"),
central: ("weapon.staff.firestaff_lizardman"),
)
),
(Occultlizardman, Female): (
@ -415,8 +415,8 @@
central: ("armor.empty"),
),
main: (
offset: (-1.5, -9.0, -10.0),
central: ("npc.lizardman_occult.female.weapon"),
offset: (-5.5, -2.0, -10.0),
central: ("weapon.staff.firestaff_lizardman"),
)
),
(Mightylizardman, Male): (
@ -446,7 +446,7 @@
),
main: (
offset: (-1.5, -9.0, -10.0),
central: ("npc.lizardman_mighty.male.weapon"),
central: ("weapon.sword.long_2h_lizardman"),
)
),
(Mightylizardman, Female): (
@ -476,7 +476,7 @@
),
main: (
offset: (-1.5, -9.0, -10.0),
central: ("npc.lizardman_mighty.female.weapon"),
central: ("weapon.sword.long_2h_lizardman"),
)
),
(Slylizardman, Male): (
@ -506,7 +506,7 @@
),
main: (
offset: (-1.5, -9.0, -10.0),
central: ("npc.lizardman_sly.male.weapon"),
central: ("weapon.bow.longbow_lizardman"),
)
),
(Slylizardman, Female): (
@ -536,7 +536,7 @@
),
main: (
offset: (-1.5, -9.0, -10.0),
central: ("npc.lizardman_sly.female.weapon"),
central: ("weapon.bow.longbow_lizardman"),
)
),
})

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,6 @@
use crate::comp::{
golem,
biped_large,
item::{Item, ItemKind},
Alignment, Body, CharacterAbility, ItemConfig, Loadout,
};
@ -72,7 +73,6 @@ impl LoadoutBuilder {
mut main_tool: Option<Item>,
is_giant: bool,
) -> Self {
#![allow(clippy::single_match)] // For when this is done to more than just golems.
match body {
Body::Golem(golem) => match golem.species {
golem::Species::StoneGolem => {
@ -81,6 +81,54 @@ impl LoadoutBuilder {
));
},
},
Body::BipedLarge(biped_large) => match (biped_large.species, biped_large.body_type) {
(biped_large::Species::Occultlizardman, _) => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.staff.lizardman_staff",
));
},
(biped_large::Species::Mightylizardman, _) => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.sword.lizardman_sword",
));
},
(biped_large::Species::Slylizardman, _) => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.bow.lizardman_bow",
));
},
(biped_large::Species::Ogre, biped_large::BodyType::Male) => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.hammer.ogre_hammer",
));
},
(biped_large::Species::Ogre, biped_large::BodyType::Female) => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.staff.ogre_staff",
));
},
(biped_large::Species::Troll, _) => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.hammer.troll_hammer",
));
},
(biped_large::Species::Wendigo, _) => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.hammer.wendigo_hammer",
));
},
(biped_large::Species::Cyclops, _) => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.hammer.cyclops_hammer",
));
},
(biped_large::Species::Dullahan, _) => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.sword.dullahan_sword",
));
},
_ => {},
},
Body::Humanoid(_) => {
if is_giant {
main_tool = Some(Item::new_from_asset_expect(
@ -259,6 +307,23 @@ impl LoadoutBuilder {
tabard: None,
},
},
Body::BipedLarge(_) => Loadout {
active_item,
second_item: None,
shoulder: None,
chest: None,
belt: None,
hand: None,
pants: None,
foot: None,
back: None,
ring: None,
neck: None,
lantern: None,
glider: None,
head: None,
tabard: None,
},
_ => LoadoutBuilder::animal(body).build(),
};

View File

@ -316,10 +316,9 @@ impl<'a> System<'a> for Sys {
Some(ToolKind::Bow(_)) => Tactic::RangedPowerup,
Some(ToolKind::Staff(_)) => Tactic::Staff,
Some(ToolKind::NpcWeapon(kind)) => {
if kind == "StoneGolemsFist" {
Tactic::StoneGolemBoss
} else {
Tactic::Melee
match kind.as_str() {
"StoneGolemsFist" => Tactic::StoneGolemBoss,
_ => Tactic::Melee,
}
},
_ => Tactic::Melee,

View File

@ -2,12 +2,13 @@ use super::{
super::{vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::comp::item::{Hands, ToolKind};
use std::{f32::consts::PI, ops::Mul};
pub struct WieldAnimation;
impl Animation for WieldAnimation {
type Dependency = (f32, f64);
type Dependency = (Option<ToolKind>, Option<ToolKind>, f32, f64);
type Skeleton = BipedLargeSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -16,7 +17,7 @@ impl Animation for WieldAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_wield")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, global_time): Self::Dependency,
(active_tool_kind, second_tool_kind, velocity, global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
@ -312,11 +313,131 @@ impl Animation for WieldAnimation {
Quaternion::rotation_x(-0.5 + footrotr * 0.85) * Quaternion::rotation_y(0.0);
next.foot_r.scale = Vec3::one() / 8.0;
next.control.position = Vec3::new(7.0, 9.0, -10.0);
next.control.orientation = Quaternion::rotation_x(test * 0.02)
* Quaternion::rotation_y(test * 0.02)
* Quaternion::rotation_z(test * 0.02);
next.control.scale = Vec3::one();
}
match active_tool_kind {
Some(ToolKind::Bow(_)) => {
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0 - 7.0,
skeleton_attr.hand.1 - 7.0,
skeleton_attr.hand.2 + 10.0,
);
next.hand_l.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0 - 7.0,
skeleton_attr.hand.1 - 7.0,
skeleton_attr.hand.2 + 10.0,
);
next.hand_r.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
next.hand_r.scale = Vec3::one() * 1.02;
next.hand_r.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
next.hand_r.scale = Vec3::one() * 1.02;
next.control.position = Vec3::new(7.0, 9.0, -10.0);
next.control.orientation = Quaternion::rotation_x(test * 0.02)
* Quaternion::rotation_y(test * 0.02)
* Quaternion::rotation_z(test * 0.02);
next.control.scale = Vec3::one();
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(-1.57)
* Quaternion::rotation_z(1.0);
next.main.scale = Vec3::one() * 1.02;
},
Some(ToolKind::Hammer(_)) => {
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0 - 7.0,
skeleton_attr.hand.1 - 7.0,
skeleton_attr.hand.2 + 10.0,
);
next.hand_l.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0 - 7.0,
skeleton_attr.hand.1 - 7.0,
skeleton_attr.hand.2 + 10.0,
);
next.hand_r.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
next.hand_r.scale = Vec3::one() * 1.02;
next.control.position = Vec3::new(7.0, 9.0, -10.0);
next.control.orientation = Quaternion::rotation_x(test * 0.02)
* Quaternion::rotation_y(test * 0.02)
* Quaternion::rotation_z(test * 0.02);
next.control.scale = Vec3::one();
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(-1.57)
* Quaternion::rotation_z(1.0);
next.main.scale = Vec3::one() * 1.02;
},
Some(ToolKind::Staff(_)) => {
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0 - 7.0,
skeleton_attr.hand.1 - 7.0,
skeleton_attr.hand.2 + 10.0,
);
next.hand_l.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0 - 7.0,
skeleton_attr.hand.1 - 7.0,
skeleton_attr.hand.2 + 10.0,
);
next.hand_r.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
next.hand_r.scale = Vec3::one() * 1.02;
next.hand_r.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
next.hand_r.scale = Vec3::one() * 1.02;
next.control.position = Vec3::new(7.0, 9.0, -10.0);
next.control.orientation = Quaternion::rotation_x(test * 0.02)
* Quaternion::rotation_y(test * 0.02)
* Quaternion::rotation_z(test * 0.02);
next.control.scale = Vec3::one();
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(-1.57)
* Quaternion::rotation_z(1.0);
next.main.scale = Vec3::one() * 1.02;
},
Some(ToolKind::Sword(_)) => {
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0 - 7.0,
skeleton_attr.hand.1 - 7.0,
skeleton_attr.hand.2 + 10.0,
);
next.hand_l.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0 - 7.0,
skeleton_attr.hand.1 - 7.0,
skeleton_attr.hand.2 + 10.0,
);
next.hand_r.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
next.hand_r.scale = Vec3::one() * 1.02;
next.hand_r.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
next.hand_r.scale = Vec3::one() * 1.02;
next.control.position = Vec3::new(7.0, 9.0, -10.0);
next.control.orientation = Quaternion::rotation_x(test * 0.02)
* Quaternion::rotation_y(test * 0.02)
* Quaternion::rotation_z(test * 0.02);
next.control.scale = Vec3::one();
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(-1.57)
* Quaternion::rotation_z(1.0);
next.main.scale = Vec3::one() * 1.02;
},
_ => {},
}
next

View File

@ -2250,7 +2250,7 @@ impl FigureMgr {
CharacterState::Wielding { .. } => {
anim::biped_large::WieldAnimation::update_skeleton(
&target_base,
(vel.0.magnitude(), time),
(active_tool_kind, second_tool_kind, vel.0.magnitude(), time),
state.state_time,
&mut state_animation_rate,
skeleton_attr,