Merge branch 'slipped/animtweaks' into 'master'

1h weapons

See merge request veloren/veloren!2117
This commit is contained in:
Samuel Keiffer 2021-04-14 03:02:22 +00:00
commit 6f9f28af18
77 changed files with 2361 additions and 1113 deletions

View File

@ -32,6 +32,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added --sql-log-mode profile/trace parameter to veloren-server-cli
- Added /disconnect_all_players admin command
- Added disconnectall CLI command
- One handed weapons can now be used and found in the world
### Changed

View File

@ -3,7 +3,7 @@ SpinMelee(
swing_duration: 0.6,
recover_duration: 0.2,
base_damage: 70,
base_poise_damage: 55,
base_poise_damage: 25,
knockback: ( strength: 0.0, direction: Away),
range: 3.5,
damage_effect: None,

View File

@ -9,7 +9,7 @@ DashMelee(
range: 5.0,
angle: 45.0,
energy_drain: 600,
forward_speed: 4.0,
forward_speed: 3.0,
buildup_duration: 0.25,
charge_duration: 0.6,
swing_duration: 0.1,

View File

@ -1,5 +1,9 @@
[
//2h
(1.0, Item("common.items.weapons.axe.bloodsteel_axe-0")),
(1.0, Item("common.items.weapons.axe.bloodsteel_axe-1")),
(1.0, Item("common.items.weapons.axe.bloodsteel_axe-2")),
//1h
(1.0, Item("common.items.weapons.axe_1h.bloodsteel-0")),
(1.0, Item("common.items.weapons.axe_1h.bloodsteel-1")),
]

View File

@ -1,5 +1,9 @@
[
//2h
(1.0, Item("common.items.weapons.axe.bronze_axe-0")),
(1.0, Item("common.items.weapons.axe.bronze_axe-1")),
(1.0, Item("common.items.weapons.axe.bronze_axe-2")),
//1h
(1.0, Item("common.items.weapons.axe_1h.bronze-0")),
(1.0, Item("common.items.weapons.axe_1h.bronze-1")),
]

View File

@ -1,4 +1,8 @@
[
//2h
(1.0, Item("common.items.weapons.axe.cobalt_axe-0")),
(1.0, Item("common.items.weapons.axe.cobalt_axe-1")),
//1h
(1.0, Item("common.items.weapons.axe_1h.cobalt-0")),
(1.0, Item("common.items.weapons.axe_1h.cobalt-1")),
]

View File

@ -1,4 +1,5 @@
[
//2h
(1.0, Item("common.items.weapons.axe.iron_axe-0")),
(1.0, Item("common.items.weapons.axe.iron_axe-1")),
(1.0, Item("common.items.weapons.axe.iron_axe-2")),
@ -9,4 +10,9 @@
(1.0, Item("common.items.weapons.axe.iron_axe-7")),
(1.0, Item("common.items.weapons.axe.iron_axe-8")),
(1.0, Item("common.items.weapons.axe.iron_axe-9")),
//1h
(1.0, Item("common.items.weapons.axe_1h.iron-0")),
(1.0, Item("common.items.weapons.axe_1h.iron-1")),
(1.0, Item("common.items.weapons.axe_1h.iron-2")),
(1.0, Item("common.items.weapons.axe_1h.iron-3")),
]

View File

@ -1,4 +1,5 @@
[
//2h
(1.0, Item("common.items.weapons.axe.steel_axe-0")),
(1.0, Item("common.items.weapons.axe.steel_axe-1")),
(1.0, Item("common.items.weapons.axe.steel_axe-2")),
@ -6,4 +7,8 @@
(1.0, Item("common.items.weapons.axe.steel_axe-4")),
(1.0, Item("common.items.weapons.axe.steel_axe-5")),
(1.0, Item("common.items.weapons.axe.steel_axe-6")),
//1h
(1.0, Item("common.items.weapons.axe_1h.steel-0")),
(1.0, Item("common.items.weapons.axe_1h.steel-1")),
(1.0, Item("common.items.weapons.axe_1h.steel-2")),
]

View File

@ -1,4 +1,8 @@
[
//2h
(1.0, Item("common.items.weapons.hammer.runic_hammer")),
(1.0, Item("common.items.weapons.hammer.ramshead_hammer")),
//1h
(1.0, Item("common.items.weapons.hammer_1h.bloodsteel-0")),
(1.0, Item("common.items.weapons.hammer_1h.bloodsteel-1")),
]

View File

@ -1,4 +1,8 @@
[
//2h
(1.0, Item("common.items.weapons.hammer.bronze_hammer-0")),
(1.0, Item("common.items.weapons.hammer.bronze_hammer-1")),
//1h
(1.0, Item("common.items.weapons.hammer_1h.bronze-0")),
(1.0, Item("common.items.weapons.hammer_1h.bronze-1")),
]

View File

@ -1,4 +1,8 @@
[
//2h
(1.0, Item("common.items.weapons.hammer.cobalt_hammer-0")),
(1.0, Item("common.items.weapons.hammer.cobalt_hammer-1")),
//1h
(1.0, Item("common.items.weapons.hammer_1h.cobalt-0")),
(1.0, Item("common.items.weapons.hammer_1h.cobalt-1")),
]

View File

@ -1,4 +1,5 @@
[
//2h
(1.0, Item("common.items.weapons.hammer.iron_hammer-0")),
(1.0, Item("common.items.weapons.hammer.iron_hammer-1")),
(1.0, Item("common.items.weapons.hammer.iron_hammer-2")),
@ -8,4 +9,8 @@
(1.0, Item("common.items.weapons.hammer.iron_hammer-6")),
(1.0, Item("common.items.weapons.hammer.iron_hammer-7")),
(1.0, Item("common.items.weapons.hammer.iron_hammer-8")),
//1h
(1.0, Item("common.items.weapons.hammer_1h.iron-0")),
(1.0, Item("common.items.weapons.hammer_1h.iron-1")),
(1.0, Item("common.items.weapons.hammer_1h.iron-2")),
]

View File

@ -1,8 +1,13 @@
[
//2h
(1.0, Item("common.items.weapons.hammer.steel_hammer-0")),
(1.0, Item("common.items.weapons.hammer.steel_hammer-1")),
(1.0, Item("common.items.weapons.hammer.steel_hammer-2")),
(1.0, Item("common.items.weapons.hammer.steel_hammer-3")),
(1.0, Item("common.items.weapons.hammer.steel_hammer-4")),
(1.0, Item("common.items.weapons.hammer.steel_hammer-5")),
//1h
(1.0, Item("common.items.weapons.hammer_1h.steel-0")),
(1.0, Item("common.items.weapons.hammer_1h.steel-1")),
(1.0, Item("common.items.weapons.hammer_1h.steel-2")),
]

View File

@ -1,6 +1,10 @@
[
//2h
(1.0, Item("common.items.weapons.hammer.stone_hammer-0")),
(1.0, Item("common.items.weapons.hammer.stone_hammer-1")),
(1.0, Item("common.items.weapons.hammer.stone_hammer-2")),
(1.0, Item("common.items.weapons.hammer.stone_hammer-3")),
//1h
(1.0, Item("common.items.weapons.hammer_1h.stone-0")),
(1.0, Item("common.items.weapons.hammer_1h.stone-1")),
]

View File

@ -1,5 +1,10 @@
[
//2h
(1.0, Item("common.items.weapons.sword.bloodsteel-0")),
(1.0, Item("common.items.weapons.sword.bloodsteel-1")),
(1.0, Item("common.items.weapons.sword.bloodsteel-2")),
//1h
(1.0, Item("common.items.weapons.sword_1h.bloodsteel-0")),
(1.0, Item("common.items.weapons.sword_1h.bloodsteel-1")),
(1.0, Item("common.items.weapons.sword_1h.bloodsteel-2")),
]

View File

@ -1,5 +1,10 @@
[
//2h
(1.0, Item("common.items.weapons.sword.bronze-0")),
(1.0, Item("common.items.weapons.sword.bronze-1")),
(1.0, Item("common.items.weapons.sword.bronze-2")),
//1h
(1.0, Item("common.items.weapons.sword_1h.bronze-0")),
(1.0, Item("common.items.weapons.sword_1h.bronze-1")),
(1.0, Item("common.items.weapons.sword_1h.bronze-2")),
]

View File

@ -1,6 +1,12 @@
[
//2h
(1.0, Item("common.items.weapons.sword.cobalt-0")),
(1.0, Item("common.items.weapons.sword.cobalt-1")),
(1.0, Item("common.items.weapons.sword.cobalt-2")),
(1.0, Item("common.items.weapons.sword.cobalt-3")),
//1h
(1.0, Item("common.items.weapons.sword_1h.cobalt-0")),
(1.0, Item("common.items.weapons.sword_1h.cobalt-1")),
(1.0, Item("common.items.weapons.sword_1h.cobalt-2")),
(1.0, Item("common.items.weapons.sword_1h.cobalt-3")),
]

View File

@ -1,4 +1,5 @@
[
//2h
(1.0, Item("common.items.weapons.sword.iron-0")),
(1.0, Item("common.items.weapons.sword.iron-1")),
(1.0, Item("common.items.weapons.sword.iron-2")),
@ -10,4 +11,10 @@
(1.0, Item("common.items.weapons.sword.iron-8")),
(1.0, Item("common.items.weapons.sword.iron-9")),
(1.0, Item("common.items.weapons.sword.iron-10")),
//1h
(1.0, Item("common.items.weapons.sword_1h.iron-0")),
(1.0, Item("common.items.weapons.sword_1h.iron-1")),
(1.0, Item("common.items.weapons.sword_1h.iron-2")),
(1.0, Item("common.items.weapons.sword_1h.iron-3")),
(1.0, Item("common.items.weapons.sword_1h.iron-4")),
]

View File

@ -1,4 +1,5 @@
[
//2h
(1.0, Item("common.items.weapons.sword.steel-0")),
(1.0, Item("common.items.weapons.sword.steel-1")),
(1.0, Item("common.items.weapons.sword.steel-2")),
@ -8,4 +9,9 @@
(1.0, Item("common.items.weapons.sword.steel-6")),
(1.0, Item("common.items.weapons.sword.steel-7")),
(1.0, Item("common.items.weapons.sword.steel-8")),
//1h
(1.0, Item("common.items.weapons.sword_1h.steel-0")),
(1.0, Item("common.items.weapons.sword_1h.steel-1")),
(1.0, Item("common.items.weapons.sword_1h.steel-2")),
(1.0, Item("common.items.weapons.sword_1h.steel-3")),
]

View File

@ -190,7 +190,7 @@
"hud.skill.sw_dash_cost_title": "Coste de Atravesar",
"hud.skill.sw_dash_cost": "Disminuye el coste inicial de Atravesar en un 25%{SP}",
"hud.skill.sw_dash_speed_title": "Velocidad de Atravesar",
"hud.skill.sw_dash_speed": "Aumenta la velocidad al atravesar en un 30%{SP}",
"hud.skill.sw_dash_speed": "Aumenta la velocidad al atravesar en un 15%{SP}",
"hud.skill.sw_dash_inf_title": "Atravesar Infinito",
"hud.skill.sw_dash_inf": "Te permite hacer atravesar durante todo el tiempo que tengas energía{SP}",
"hud.skill.sw_dash_scale_title": "Intensidad de daño de Atravesar",

View File

@ -190,7 +190,7 @@
"hud.skill.sw_dash_cost_title": "Coût d'Endurance de la Ruée",
"hud.skill.sw_dash_cost": "Diminue de 25% le coût en endurance initial de la ruée{SP}",
"hud.skill.sw_dash_speed_title": "Vitesse de la Ruée",
"hud.skill.sw_dash_speed": "Augmente de 30% la vitesse de course durant la ruée{SP}",
"hud.skill.sw_dash_speed": "Augmente de 15% la vitesse de course durant la ruée{SP}",
"hud.skill.sw_dash_inf_title": "Ruée Infinie",
"hud.skill.sw_dash_inf": "Vous permet de vous élancer en ruée tant que vous avez de l'endurance{SP}",
"hud.skill.sw_dash_scale_title": "Progression des Dégâts de la Ruée",

View File

@ -190,7 +190,7 @@
"hud.skill.sw_dash_cost_title": "ダッシュ コスト",
"hud.skill.sw_dash_cost": "ダッシュ攻撃の初期スタミナ消費を25%減少 {SP}",
"hud.skill.sw_dash_speed_title": "ダッシュ 速度",
"hud.skill.sw_dash_speed": "ダッシュ攻撃の速度を30%増加 {SP}",
"hud.skill.sw_dash_speed": "ダッシュ攻撃の速度を15%増加 {SP}",
"hud.skill.sw_dash_inf_title": "無限ダッシュ攻撃",
"hud.skill.sw_dash_inf": "エネルギーの続く限りダッシュ攻撃する {SP}",
"hud.skill.sw_dash_scale_title": "ダッシュ ダメージ増量",

View File

@ -186,7 +186,7 @@
"hud.skill.sw_dash_cost_title": "Custo da Investida",
"hud.skill.sw_dash_cost": "Reduz custo inicial da investida em 25%{SP}",
"hud.skill.sw_dash_speed_title": "Velocidade de Investida",
"hud.skill.sw_dash_speed": "Aumenta a velocidade durante a investida em 30%{SP}",
"hud.skill.sw_dash_speed": "Aumenta a velocidade durante a investida em 15%{SP}",
"hud.skill.sw_dash_inf_title": "Investida do Infinito",
"hud.skill.sw_dash_inf": "Você consegue investir contanto que possua energia para tal{SP}",
"hud.skill.sw_dash_scale_title": "Investida Acumulada",

View File

@ -195,7 +195,7 @@
"hud.skill.sw_dash_cost_title": "Енергозатрати на випад",
"hud.skill.sw_dash_cost": "Зменшує початкову енергетичну ціну випаду на 25%{SP}",
"hud.skill.sw_dash_speed_title": "Швидкість випаду",
"hud.skill.sw_dash_speed": "Збільшує швидкість руху під час випаду 30%{SP}",
"hud.skill.sw_dash_speed": "Збільшує швидкість руху під час випаду 15%{SP}",
"hud.skill.sw_dash_inf_title": "Необмежений випад",
"hud.skill.sw_dash_inf": "Дозволяє нестись в випаді доки не закінчиться енергія{SP}",
"hud.skill.sw_dash_scale_title": "Приріст ушкодження випадом",

View File

@ -165,91 +165,91 @@
),
// 1h Swords
"common.items.weapons.sword_1h.bloodsteel-0": (
vox_spec: ("weapon.sword_1h.bloodsteel-0", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.bloodsteel-0", (-2.5, -3.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.bloodsteel-1": (
vox_spec: ("weapon.sword_1h.bloodsteel-1", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.bloodsteel-1", (-1.5, -3.0, -3.0)),
color: None
),
"common.items.weapons.sword_1h.bloodsteel-2": (
vox_spec: ("weapon.sword_1h.bloodsteel-2", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.bloodsteel-2", (-1.5, -3.0, -3.0)),
color: None
),
"common.items.weapons.sword_1h.bronze-0": (
vox_spec: ("weapon.sword_1h.bronze-0", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.bronze-0", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.bronze-1": (
vox_spec: ("weapon.sword_1h.bronze-1", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.bronze-1", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.bronze-2": (
vox_spec: ("weapon.sword_1h.bronze-2", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.bronze-2", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.cobalt-0": (
vox_spec: ("weapon.sword_1h.cobalt-0", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.cobalt-0", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.cobalt-1": (
vox_spec: ("weapon.sword_1h.cobalt-1", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.cobalt-1", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.cobalt-2": (
vox_spec: ("weapon.sword_1h.cobalt-2", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.cobalt-2", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.cobalt-3": (
vox_spec: ("weapon.sword_1h.cobalt-3", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.cobalt-3", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.iron-0": (
vox_spec: ("weapon.sword_1h.iron-0", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.iron-0", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.iron-1": (
vox_spec: ("weapon.sword_1h.iron-1", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.iron-1", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.iron-2": (
vox_spec: ("weapon.sword_1h.iron-2", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.iron-2", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.iron-3": (
vox_spec: ("weapon.sword_1h.iron-3", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.iron-3", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.iron-4": (
vox_spec: ("weapon.sword_1h.iron-4", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.iron-4", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.obsidian-0": (
vox_spec: ("weapon.sword_1h.obsidian-0", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.obsidian-0", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.orichalcum-0": (
vox_spec: ("weapon.sword_1h.orichalcum-0", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.orichalcum-0", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.orichalcum-1": (
vox_spec: ("weapon.sword_1h.orichalcum-1", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.orichalcum-1", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.steel-0": (
vox_spec: ("weapon.sword_1h.steel-0", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.steel-0", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.steel-1": (
vox_spec: ("weapon.sword_1h.steel-1", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.steel-1", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.steel-2": (
vox_spec: ("weapon.sword_1h.steel-2", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.steel-2", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.steel-3": (
vox_spec: ("weapon.sword_1h.steel-3", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.steel-3", (-2.0, -4.5, -3.0)),
color: None
),
// Axes
@ -391,75 +391,75 @@
),
// 1h Axes
"common.items.weapons.axe_1h.bloodsteel-0": (
vox_spec: ("weapon.axe_1h.bloodsteel-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.bloodsteel-0", (-1.5, -2.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.bloodsteel-1": (
vox_spec: ("weapon.axe_1h.bloodsteel-1", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.bloodsteel-1", (-1.5, -2.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.bronze-0": (
vox_spec: ("weapon.axe_1h.bronze-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.bronze-0", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.bronze-1": (
vox_spec: ("weapon.axe_1h.bronze-1", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.bronze-1", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.cobalt-0": (
vox_spec: ("weapon.axe_1h.cobalt-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.cobalt-0", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.cobalt-1": (
vox_spec: ("weapon.axe_1h.cobalt-1", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.cobalt-1", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.iron-0": (
vox_spec: ("weapon.axe_1h.iron-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.iron-0", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.iron-1": (
vox_spec: ("weapon.axe_1h.iron-1", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.iron-1", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.iron-2": (
vox_spec: ("weapon.axe_1h.iron-2", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.iron-2", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.iron-3": (
vox_spec: ("weapon.axe_1h.iron-3", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.iron-3", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.orichalcum-0": (
vox_spec: ("weapon.axe_1h.orichalcum-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.orichalcum-0", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.steel-0": (
vox_spec: ("weapon.axe_1h.steel-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.steel-0", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.steel-1": (
vox_spec: ("weapon.axe_1h.steel-1", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.steel-1", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.steel-2": (
vox_spec: ("weapon.axe_1h.steel-2", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.steel-2", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.stone-0": (
vox_spec: ("weapon.axe_1h.stone-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.stone-0", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.stone-1": (
vox_spec: ("weapon.axe_1h.stone-1", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.stone-1", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.wood-0": (
vox_spec: ("weapon.axe_1h.wood-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.wood-0", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.wood-1": (
vox_spec: ("weapon.axe_1h.wood-1", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.wood-1", (-1.5, -5.0, -3.0)),
color: None
),
// Hammers
@ -609,71 +609,71 @@
),*/
// 1h Hammers
"common.items.weapons.hammer_1h.bloodsteel-0": (
vox_spec: ("weapon.hammer_1h.bloodsteel-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.hammer_1h.bloodsteel-0", (-2.5, -3.0, -3.0)),
color: None
),
"common.items.weapons.hammer_1h.bloodsteel-1": (
vox_spec: ("weapon.hammer_1h.bloodsteel-1", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.hammer_1h.bloodsteel-1", (-2.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.hammer_1h.bronze-0": (
vox_spec: ("weapon.hammer_1h.bronze-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.hammer_1h.bronze-0", (-3.5, -4.0, -3.0)),
color: None
),
"common.items.weapons.hammer_1h.bronze-1": (
vox_spec: ("weapon.hammer_1h.bronze-1", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.hammer_1h.bronze-1", (-2.5, -3.0, -3.0)),
color: None
),
"common.items.weapons.hammer_1h.cobalt-0": (
vox_spec: ("weapon.hammer_1h.cobalt-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.hammer_1h.cobalt-0", (-2.5, -4.0, -3.0)),
color: None
),
"common.items.weapons.hammer_1h.cobalt-1": (
vox_spec: ("weapon.hammer_1h.cobalt-1", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.hammer_1h.cobalt-1", (-2.5, -4.0, -3.0)),
color: None
),
"common.items.weapons.hammer_1h.iron-0": (
vox_spec: ("weapon.hammer_1h.iron-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.hammer_1h.iron-0", (-2.5, -4.5, -3.0)),
color: None
),
"common.items.weapons.hammer_1h.iron-1": (
vox_spec: ("weapon.hammer_1h.iron-1", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.hammer_1h.iron-1", (-2.5, -3.0, -3.0)),
color: None
),
"common.items.weapons.hammer_1h.iron-2": (
vox_spec: ("weapon.hammer_1h.iron-2", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.hammer_1h.iron-2", (-2.5, -3.0, -3.0)),
color: None
),
"common.items.weapons.hammer_1h.orichalcum-0": (
vox_spec: ("weapon.hammer_1h.orichalcum-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.hammer_1h.orichalcum-0", (-1.5, -4.0, -3.0)),
color: None
),
"common.items.weapons.hammer_1h.steel-0": (
vox_spec: ("weapon.hammer_1h.steel-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.hammer_1h.steel-0", (-2.5, -4.0, -3.0)),
color: None
),
"common.items.weapons.hammer_1h.steel-1": (
vox_spec: ("weapon.hammer_1h.steel-1", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.hammer_1h.steel-1", (-2.5, -3.0, -3.0)),
color: None
),
"common.items.weapons.hammer_1h.steel-2": (
vox_spec: ("weapon.hammer_1h.steel-2", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.hammer_1h.steel-2", (-2.5, -3.0, -3.0)),
color: None
),
"common.items.weapons.hammer_1h.stone-0": (
vox_spec: ("weapon.hammer_1h.stone-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.hammer_1h.stone-0", (-2.5, -3.5, -3.0)),
color: None
),
"common.items.weapons.hammer_1h.stone-1": (
vox_spec: ("weapon.hammer_1h.stone-1", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.hammer_1h.stone-1", (-2.5, -4.5, -3.0)),
color: None
),
"common.items.weapons.hammer_1h.wood-0": (
vox_spec: ("weapon.hammer_1h.wood-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.hammer_1h.wood-0", (-3.0, -3.0, -3.0)),
color: None
),
"common.items.weapons.hammer_1h.wood-1": (
vox_spec: ("weapon.hammer_1h.wood-1", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.hammer_1h.wood-1", (-2.5, -3.0, -3.0)),
color: None
),
// Daggers

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.

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.

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

@ -667,7 +667,7 @@ impl CharacterAbility {
*scaled_damage *= 1.2_f32.powi(level.into());
}
if skillset.has_skill(Sword(DSpeed)) {
*forward_speed *= 1.3;
*forward_speed *= 1.15;
}
*infinite_charge = skillset.has_skill(Sword(DInfinite));
},

View File

@ -246,7 +246,6 @@ impl PartialEq for ItemDef {
pub struct ItemConfig {
pub abilities: AbilitySet<CharacterAbility>,
pub block_ability: Option<CharacterAbility>,
pub dodge_ability: Option<CharacterAbility>,
}
#[derive(Debug)]
@ -266,7 +265,6 @@ impl TryFrom<(&ItemKind, &[Item], &AbilityMap, &MaterialStatManifest)> for ItemC
Ok(ItemConfig {
abilities,
block_ability: None,
dodge_ability: Some(CharacterAbility::default_roll()),
})
} else {
Err(ItemConfigError::BadItemKind)

View File

@ -484,8 +484,11 @@ fn handle_ability(data: &JoinData, update: &mut StateUpdate, input: InputKind) {
// Mouse1 and Skill1 always use the MainHand slot
let always_main_hand = matches!(input, InputKind::Primary | InputKind::Ability(0));
let no_main_hand = hands(EquipSlot::Mainhand).is_none();
// skill_index used to select ability for the AbilityKey::Skill2 input
let (equip_slot, skill_index) = if always_main_hand {
let (equip_slot, skill_index) = if no_main_hand {
(Some(EquipSlot::Offhand), 1)
} else if always_main_hand {
(Some(EquipSlot::Mainhand), 0)
} else {
let hands = (hands(EquipSlot::Mainhand), hands(EquipSlot::Offhand));
@ -567,17 +570,9 @@ pub fn attempt_input(data: &JoinData, update: &mut StateUpdate) {
/// attempts to perform their dodge ability
pub fn handle_dodge_input(data: &JoinData, update: &mut StateUpdate) {
if input_is_pressed(data, InputKind::Roll) && data.body.is_humanoid() {
if let Some(ability) = data
.inventory
.equipped(EquipSlot::Mainhand)
.and_then(|i| {
i.item_config_expect()
.dodge_ability
.as_ref()
.map(|a| a.clone().adjusted_by_skills(&data.stats.skill_set, None))
})
.filter(|ability| ability.requirements_paid(data, update))
{
let ability =
CharacterAbility::default_roll().adjusted_by_skills(&data.stats.skill_set, None);
if ability.requirements_paid(data, update) {
update.character = CharacterState::from((
&ability,
AbilityInfo::from_input(data, false, InputKind::Roll),

View File

@ -13,6 +13,7 @@ pub mod shockwave;
pub mod shoot;
pub mod spin;
pub mod spinmelee;
pub mod stunned;
pub mod summon;
pub mod wield;
@ -22,7 +23,8 @@ pub use self::{
charge::ChargeAnimation, dash::DashAnimation, equip::EquipAnimation, idle::IdleAnimation,
jump::JumpAnimation, leapmelee::LeapAnimation, run::RunAnimation,
shockwave::ShockwaveAnimation, shoot::ShootAnimation, spin::SpinAnimation,
spinmelee::SpinMeleeAnimation, summon::SummonAnimation, wield::WieldAnimation,
spinmelee::SpinMeleeAnimation, stunned::StunnedAnimation, summon::SummonAnimation,
wield::WieldAnimation,
};
use super::{make_bone, vek::*, FigureBoneData, Skeleton};

View File

@ -0,0 +1,378 @@
use super::{
super::{vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::{
comp::item::{ToolKind, UniqueKind},
states::utils::StageSection,
};
use std::f32::consts::PI;
pub struct StunnedAnimation;
impl Animation for StunnedAnimation {
type Dependency = (Option<ToolKind>, Vec3<f32>, f32, Option<StageSection>);
type Skeleton = BipedLargeSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"biped_large_stunned\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_stunned")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, velocity, acc_vel, stage_section): Self::Dependency,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let speed = Vec2::<f32>::from(velocity).magnitude();
let lab: f32 = 0.65 * s_a.tempo; //.65
let (movement1base, movement2) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, anim_time.powf(4.0)),
_ => (0.0, 0.0),
};
let pullback = 1.0 - movement2;
let movement1 = movement1base * pullback;
let torso = (anim_time * lab + 1.5 * PI).sin();
let speednorm = (speed / 12.0).powf(0.4);
let foothoril = (acc_vel * lab + PI * 1.45).sin() * speednorm;
let foothorir = (acc_vel * lab + PI * (0.45)).sin() * speednorm;
let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 1.4).sin()).powi(2))).sqrt())
* ((acc_vel * lab + PI * 1.4).sin());
let footrotr = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 0.4).sin()).powi(2))).sqrt())
* ((acc_vel * lab + PI * 0.4).sin());
let slower = (anim_time * 1.0 + PI).sin();
let slow = (anim_time * 3.5 + PI).sin();
let footvertl = (anim_time * 16.0 * lab).sin();
let footvertr = (anim_time * 16.0 * lab + PI).sin();
let handhoril = (anim_time * 16.0 * lab + PI * 1.4).sin();
let handhorir = (anim_time * 16.0 * lab + PI * 0.4).sin();
let short = (acc_vel * lab).sin() * speednorm;
let shortalt = (anim_time * lab * 16.0 + PI / 2.0).sin();
if s_a.beast {
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
} else {
next.jaw.position = Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2);
next.hold.scale = Vec3::one() * 0.0;
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.grip.1, 0.0, s_a.grip.0);
next.hand_r.position = Vec3::new(-s_a.grip.1, 0.0, s_a.grip.0);
next.hand_l.orientation = Quaternion::rotation_x(0.0);
next.hand_r.orientation = Quaternion::rotation_x(0.0);
next.head.orientation =
Quaternion::rotation_x(movement1 * -0.2) * Quaternion::rotation_z(movement1 * -0.7);
next.upper_torso.orientation = Quaternion::rotation_x(movement1 * 0.5);
next.lower_torso.orientation = Quaternion::rotation_x(movement1 * -0.5);
if speed > 0.5 {
next.shoulder_l.position = Vec3::new(
-s_a.shoulder.0,
s_a.shoulder.1,
s_a.shoulder.2 - foothorir * 1.0,
);
next.shoulder_l.orientation =
Quaternion::rotation_x(0.6 * speednorm + (footrotr * -0.2) * speednorm);
next.shoulder_r.position = Vec3::new(
s_a.shoulder.0,
s_a.shoulder.1,
s_a.shoulder.2 - foothoril * 1.0,
);
next.shoulder_r.orientation =
Quaternion::rotation_x(0.6 * speednorm + (footrotl * -0.2) * speednorm);
} else {
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02;
next.lower_torso.orientation = Quaternion::rotation_x(0.0);
next.lower_torso.scale = Vec3::one() * 1.02;
next.jaw.position =
Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2);
next.jaw.orientation = Quaternion::rotation_x(-0.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation = Quaternion::rotation_z(slow * 0.2);
next.shoulder_l.position =
Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation = Quaternion::rotation_x(0.3);
next.shoulder_r.position =
Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation = Quaternion::rotation_x(0.3);
}
match active_tool_kind {
Some(ToolKind::SwordSimple) => {
next.control_l.position = Vec3::new(-1.0, 1.0, 1.0);
next.control_r.position = Vec3::new(0.0, 2.0, -3.0);
next.control.position = Vec3::new(
-3.0,
5.0 + s_a.grip.0 / 1.2,
-4.0 + -s_a.grip.0 / 2.0 + short * -1.5,
);
next.control_l.orientation =
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(-0.2);
next.control_r.orientation =
Quaternion::rotation_x(PI / 2.2) * Quaternion::rotation_y(0.2);
next.control.orientation =
Quaternion::rotation_x(-0.2 + short * 0.2) * Quaternion::rotation_y(-0.1);
},
Some(ToolKind::BowSimple) | Some(ToolKind::Bow) => {
next.control_l.position = Vec3::new(-1.0, -2.0, -3.0);
next.control_r.position = Vec3::new(0.0, 4.0, 1.0);
next.control.position = Vec3::new(
-1.0,
6.0 + s_a.grip.0 / 1.2,
-5.0 + -s_a.grip.0 / 2.0 + short * -1.5,
);
next.control_l.orientation =
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(-0.2);
next.control_r.orientation =
Quaternion::rotation_x(PI / 2.2) * Quaternion::rotation_y(0.2);
next.control.orientation = Quaternion::rotation_x(-0.2 + short * 0.2)
* Quaternion::rotation_y(1.0)
* Quaternion::rotation_z(-0.3);
},
Some(ToolKind::HammerSimple) | Some(ToolKind::AxeSimple) => {
next.control_l.position = Vec3::new(-1.0, 2.0, 12.0);
next.control_r.position = Vec3::new(1.0, 2.0, -2.0);
next.control.position = Vec3::new(
4.0,
0.0 + s_a.grip.0 / 1.0,
-s_a.grip.0 / 0.8 + short * -1.5,
);
next.control_l.orientation =
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(-0.0);
next.control_r.orientation = Quaternion::rotation_x(PI / 2.0 + 0.2);
next.control.orientation =
Quaternion::rotation_x(-1.0 + short * 0.2) * Quaternion::rotation_y(-1.8);
},
Some(ToolKind::StaffSimple)
| Some(ToolKind::Unique(UniqueKind::MindflayerStaff)) => {
next.control_l.position = Vec3::new(-1.0, 3.0, 12.0);
next.control_r.position = Vec3::new(1.0, 2.0, 2.0);
next.control.position = Vec3::new(
-3.0,
3.0 + s_a.grip.0 / 1.2,
-11.0 + -s_a.grip.0 / 2.0 + short * -1.5,
);
next.control_l.orientation =
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(-0.5);
next.control_r.orientation = Quaternion::rotation_x(PI / 2.5)
* Quaternion::rotation_y(0.5)
* Quaternion::rotation_z(0.0);
next.control.orientation =
Quaternion::rotation_x(-0.2 + short * 0.2) * Quaternion::rotation_y(-0.1);
},
Some(ToolKind::Unique(UniqueKind::WendigoMagic)) => {
next.control_l.position = Vec3::new(-9.0, 19.0, -13.0);
next.control_r.position = Vec3::new(9.0, 19.0, -13.0);
next.control_l.orientation =
Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_y(-0.15);
next.control_r.orientation =
Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_y(0.15);
},
Some(ToolKind::Unique(UniqueKind::TidalClaws)) => {
next.control_l.position = Vec3::new(-14.0, 12.0, -12.0);
next.control_r.position = Vec3::new(14.0, 12.0, -12.0);
next.control_l.orientation =
Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_y(-0.15);
next.control_r.orientation =
Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_y(0.15);
},
Some(ToolKind::Unique(UniqueKind::BeastClaws)) => {
next.shoulder_l.position =
Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.position =
Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.hand_l.position =
Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2 + torso * 0.6);
next.hand_r.position =
Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2 + torso * 0.6);
if speed < 0.5 {
next.head.position =
Vec3::new(0.0, s_a.head.0, s_a.head.1 + torso * 0.2) * 1.02;
next.head.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.upper_torso.position =
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + torso * 0.5);
next.lower_torso.position =
Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1 + torso * 0.15);
next.jaw.orientation = Quaternion::rotation_x(-0.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation = Quaternion::rotation_z(slow * 0.2);
next.second.orientation = Quaternion::rotation_x(PI);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_y(0.0);
next.shoulder_l.position =
Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.hand_l.position =
Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2 + torso * 0.6);
next.hand_r.position =
Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2 + torso * 0.6);
next.leg_l.position =
Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + torso * 0.2);
next.leg_l.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_r.position =
Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + torso * 0.2);
next.leg_r.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
} else {
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02;
next.head.orientation =
Quaternion::rotation_z(short * -0.18) * Quaternion::rotation_x(-0.05);
next.head.scale = Vec3::one() * 1.02;
next.upper_torso.position =
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + shortalt * -1.5);
next.upper_torso.orientation = Quaternion::rotation_z(short * 0.18);
next.lower_torso.position =
Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1);
next.lower_torso.orientation =
Quaternion::rotation_z(short * 0.15) * Quaternion::rotation_x(0.14);
next.lower_torso.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(0.0);
next.jaw.scale = Vec3::one() * 1.02;
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation = Quaternion::rotation_x(shortalt * 0.3);
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_x(PI)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.second.scale = Vec3::one() * 0.0;
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.control.orientation = Quaternion::rotation_z(0.0);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_y(0.0);
next.shoulder_l.position = Vec3::new(
-s_a.shoulder.0,
s_a.shoulder.1 + foothoril * -3.0,
s_a.shoulder.2,
);
next.shoulder_l.orientation = Quaternion::rotation_x(footrotl * -0.36)
* Quaternion::rotation_y(0.1)
* Quaternion::rotation_z(footrotl * 0.3);
next.shoulder_r.position = Vec3::new(
s_a.shoulder.0,
s_a.shoulder.1 + foothorir * -3.0,
s_a.shoulder.2,
);
next.shoulder_r.orientation = Quaternion::rotation_x(footrotr * -0.36)
* Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(footrotr * -0.3);
next.hand_l.position = Vec3::new(
-1.0 + -s_a.hand.0,
s_a.hand.1 + foothoril * -4.0,
s_a.hand.2 + foothoril * 1.0,
);
next.hand_l.orientation =
Quaternion::rotation_x(0.15 + (handhoril * -1.2).max(-0.3))
* Quaternion::rotation_y(handhoril * -0.1);
next.hand_r.position = Vec3::new(
1.0 + s_a.hand.0,
s_a.hand.1 + foothorir * -4.0,
s_a.hand.2 + foothorir * 1.0,
);
next.hand_r.orientation =
Quaternion::rotation_x(0.15 + (handhorir * -1.2).max(-0.3))
* Quaternion::rotation_y(handhorir * 0.1);
next.hand_r.scale = Vec3::one() * 1.04;
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2) * 0.98;
next.leg_l.orientation = Quaternion::rotation_z(short * 0.18)
* Quaternion::rotation_x(foothoril * 0.3);
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2) * 0.98;
next.leg_r.orientation = Quaternion::rotation_z(short * 0.18)
* Quaternion::rotation_x(foothorir * 0.3);
next.foot_l.position = Vec3::new(
-s_a.foot.0,
s_a.foot.1 + foothoril * 8.5,
s_a.foot.2 + ((footvertl * 6.5).max(0.0)),
);
next.foot_l.orientation = Quaternion::rotation_x(-0.5 + footrotl * 0.85);
next.foot_r.position = Vec3::new(
s_a.foot.0,
s_a.foot.1 + foothorir * 8.5,
s_a.foot.2 + ((footvertr * 6.5).max(0.0)),
);
next.foot_r.orientation = Quaternion::rotation_x(-0.5 + footrotr * 0.85);
next.torso.orientation = Quaternion::rotation_x(-0.25);
}
},
_ => {},
}
};
if s_a.float {
next.upper_torso.position = Vec3::new(
0.0,
s_a.upper_torso.0,
s_a.upper_torso.1 + slower * 1.0 + 4.0,
);
next.foot_l.orientation = Quaternion::rotation_x(-0.5 + slow * 0.1);
next.foot_r.orientation = Quaternion::rotation_x(-0.5 + slow * 0.1);
}
next
}
}

View File

@ -2,19 +2,21 @@ use super::{
super::{vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{comp::item::ToolKind, states::utils::StageSection};
use common::{
comp::item::{Hands, ToolKind},
states::utils::{AbilityInfo, StageSection},
};
use std::f32::consts::PI;
pub struct AlphaAnimation;
type AlphaAnimationDependency = (
(Option<Hands>, Option<Hands>),
Option<StageSection>,
Option<AbilityInfo>,
);
impl Animation for AlphaAnimation {
type Dependency = (
Option<ToolKind>,
Option<ToolKind>,
f32,
f32,
Option<StageSection>,
);
type Dependency = AlphaAnimationDependency;
type Skeleton = CharacterSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -24,7 +26,7 @@ impl Animation for AlphaAnimation {
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
(hands, stage_section, ability_info): Self::Dependency,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
@ -32,83 +34,41 @@ impl Animation for AlphaAnimation {
*rate = 1.0;
let mut next = (*skeleton).clone();
let (move1, move2, 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.powi(4)),
_ => (0.0, 0.0, 0.0),
let (move1, move2, move3, move2h) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time.powi(2), 0.0, anim_time.powf(0.25)),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4), 1.0),
_ => (0.0, 0.0, 0.0, 0.0),
};
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_z(0.0);
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * s_a.scaler;
next.torso.orientation = Quaternion::rotation_z(0.0);
match active_tool_kind {
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.control.position = Vec3::new(
s_a.sc.0,
s_a.sc.1 + move1 * -4.0 + move2 * 16.0 + move3 * -4.0,
s_a.sc.2 + move1 * 1.0,
);
next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + move1 * -0.5)
* Quaternion::rotation_y(s_a.sc.4 + move1 * -1.0 + move2 * -0.6 + move3 * 1.0)
* Quaternion::rotation_z(s_a.sc.5 + move1 * -1.2 + move2 * 1.3);
next.chest.orientation =
Quaternion::rotation_z(move1 * 1.5 + (move2 * 1.75).sin() * -3.0 + move3 * 0.5);
Quaternion::rotation_z(move1 * 1.1 + move2 * -2.0 + move3 * 0.2);
next.head.position = Vec3::new(0.0 + move2 * 2.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(
move1 * -0.9 + (move2 * 1.75).sin() * 2.5 + move3 * -0.5,
);
},
Some(ToolKind::Dagger) => {
next.control_l.position = Vec3::new(-10.0, 6.0, 2.0);
next.control_l.orientation =
Quaternion::rotation_x(-1.4) * Quaternion::rotation_z(1.4);
next.head.orientation =
Quaternion::rotation_z(move1 * -0.9 + move2 * 1.8 + move3 * -0.2);
},
Some(ToolKind::Axe) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
next.head.position =
Vec3::new(0. + move2 * 2.0, s_a.head.0 + move2 * 2.0, s_a.head.1);
let (move1, move2, 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.powi(4)),
_ => (0.0, 0.0, 0.0),
};
next.control.position = Vec3::new(
s_a.ac.0 + move1 * -1.0 + move2 * -2.0 + move3 * 0.0,
s_a.ac.1 + move1 * -3.0 + move2 * 3.0 + move3 * -3.5,
s_a.ac.2 + move1 * 6.0 + move2 * -15.0 + move3 * -2.0,
);
next.control.orientation =
Quaternion::rotation_x(s_a.ac.3 + move1 * 0.0 + move2 * -3.0 + move3 * 0.4)
* Quaternion::rotation_y(
s_a.ac.4 + move1 * -0.0 + move2 * -0.6 + move3 * 0.8,
)
* Quaternion::rotation_z(
s_a.ac.5 + move1 * -2.0 + move2 * -1.0 + move3 * 2.5,
);
next.control.scale = Vec3::one();
next.head.position = Vec3::new(move2 * 2.0, s_a.head.0 + move2 * 2.0, s_a.head.1);
next.chest.orientation =
Quaternion::rotation_x(0.0 + move1 * 0.6 + move2 * -0.6 + move3 * 0.4)
* Quaternion::rotation_y(0.0 + move1 * 0.0 + move2 * 0.0 + move3 * 0.0)
@ -116,43 +76,25 @@ impl Animation for AlphaAnimation {
next.head.orientation =
Quaternion::rotation_z(0.0 + move1 * -1.5 + move2 * 2.5 + move3 * -1.0);
},
Some(ToolKind::Hammer) | Some(ToolKind::HammerSimple) | Some(ToolKind::Pick) => {
let (move1, move2, 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::Swing) => (1.0, anim_time.powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2 + move2 * -7.0);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.hhl.3) * Quaternion::rotation_y(s_a.hhl.4);
next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.hhr.3) * Quaternion::rotation_y(s_a.hhr.4);
let pullback = 1.0 - move3;
let moveret1 = move1 * pullback;
let moveret2 = move2 * pullback;
next.control.position = Vec3::new(
s_a.hc.0 + (move1 * -13.0) * (1.0 - move3),
s_a.hc.1 + (move2 * 5.0) * (1.0 - move3),
s_a.hc.2,
);
next.control.orientation =
Quaternion::rotation_x(s_a.hc.3 + (move1 * 1.5 + move2 * -2.5))
* (1.0 - move3)
* Quaternion::rotation_y(s_a.hc.4 + (move1 * 1.57))
* (1.0 - move3)
* Quaternion::rotation_z(s_a.hc.5 + (move2 * -0.5) * (1.0 - move3));
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation =
Quaternion::rotation_x((move1 * 0.1 + move2 * 0.3) * (1.0 - move3))
* Quaternion::rotation_z((move1 * -0.2 + move2 * 0.2) * (1.0 - move3));
next.chest.position =
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + move2 * -2.0 * (1.0 - move3));
next.chest.orientation =
Quaternion::rotation_x((move1 * 0.4 + move2 * -0.7) * (1.0 - move3))
* Quaternion::rotation_y((move1 * 0.3 + move2 * -0.4) * (1.0 - move3))
* Quaternion::rotation_z((move1 * 0.5 + move2 * -0.5) * (1.0 - move3));
next.head.orientation = Quaternion::rotation_x(moveret1 * 0.1 + moveret2 * 0.3)
* Quaternion::rotation_z(move1 * -0.2 + moveret2 * 0.2);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + moveret2 * -2.0);
next.chest.orientation = Quaternion::rotation_x(moveret1 * 0.4 + moveret2 * -0.7)
* Quaternion::rotation_y(moveret1 * 0.3 + moveret2 * -0.4)
* Quaternion::rotation_z(moveret1 * 0.5 + moveret2 * -0.5);
},
Some(ToolKind::Debug) => {
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
@ -162,6 +104,185 @@ impl Animation for AlphaAnimation {
},
_ => {},
}
match hands {
(Some(Hands::Two), _) => match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => {
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.control.position = Vec3::new(
s_a.sc.0 + move2 * 10.0,
s_a.sc.1 + move1 * -4.0 + move2 * 16.0 + move3 * -4.0,
s_a.sc.2 + move1 * 1.0,
);
next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + move1 * -1.3)
* Quaternion::rotation_y(s_a.sc.4 + move1 * -0.7 + move2 * 1.2)
* Quaternion::rotation_z(s_a.sc.5 + move1 * -1.57 + move3 * -1.57);
},
Some(ToolKind::Axe) => {
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
let (move1, move2, 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.powi(4)),
_ => (0.0, 0.0, 0.0),
};
next.control.position = Vec3::new(
s_a.ac.0 + move1 * -1.0 + move2 * -2.0 + move3 * 0.0,
s_a.ac.1 + move1 * -3.0 + move2 * 3.0 + move3 * -3.5,
s_a.ac.2 + move1 * 6.0 + move2 * -15.0 + move3 * -2.0,
);
next.control.orientation =
Quaternion::rotation_x(s_a.ac.3 + move1 * 0.0 + move2 * -3.0 + move3 * 0.4)
* Quaternion::rotation_y(
s_a.ac.4 + move1 * -0.0 + move2 * -0.6 + move3 * 0.8,
)
* Quaternion::rotation_z(
s_a.ac.5 + move1 * -2.0 + move2 * -1.0 + move3 * 2.5,
)
},
Some(ToolKind::Hammer) | Some(ToolKind::HammerSimple) | Some(ToolKind::Pick) => {
let (move1, move2, 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.powi(4)),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - move3;
let moveret1 = move1 * pullback;
let moveret2 = move2 * pullback;
next.hand_l.position =
Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2 + moveret2 * -7.0);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.hhl.3) * Quaternion::rotation_y(s_a.hhl.4);
next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.hhr.3) * Quaternion::rotation_y(s_a.hhr.4);
next.control.position = Vec3::new(
s_a.hc.0 + moveret1 * -13.0 + moveret2 * 3.0,
s_a.hc.1 + (moveret2 * 5.0),
s_a.hc.2 + moveret1 * 5.0 + moveret2 * -8.0,
);
next.control.orientation =
Quaternion::rotation_x(s_a.hc.3 + (moveret1 * 1.5 + moveret2 * -2.9))
* Quaternion::rotation_y(s_a.hc.4 + moveret1 * 1.57 + moveret2 * 0.5)
* Quaternion::rotation_z(s_a.hc.5 + (moveret2 * -0.5));
},
_ => {},
},
(_, _) => {},
};
match hands {
(Some(Hands::One), _) => match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => {
next.control_l.position = Vec3::new(-7.0, 8.0, 2.0);
next.control_l.orientation = Quaternion::rotation_x(-0.3 + move2 * 2.0)
* Quaternion::rotation_y(move1 * -1.2 + move2 * -1.5)
* Quaternion::rotation_z(move2 * 1.5);
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
},
Some(ToolKind::Axe) => {
next.control_l.position = Vec3::new(
-7.0 + move2 * 5.0,
8.0 + move1 * 3.0 + move2 * 7.0,
2.0 + move1 * -6.0 + move2 * 10.0,
);
next.control_l.orientation = Quaternion::rotation_x(-0.3 + move2 * 2.0)
* Quaternion::rotation_y(move1 * -1.2 + move2 * -2.5)
* Quaternion::rotation_z(move2 * 1.5);
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
},
Some(ToolKind::Hammer) | Some(ToolKind::HammerSimple) | Some(ToolKind::Pick) => {
next.control_l.position = Vec3::new(
-7.0,
8.0 + move1 * -4.0 + move2 * 4.0,
2.0 + move1 * 16.0 + move2 * -19.0,
);
next.control_l.orientation =
Quaternion::rotation_x(-0.3 + move1 * 1.9 + move2 * -3.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
},
_ => {},
},
(_, _) => {},
};
match hands {
(None | Some(Hands::One), Some(Hands::One)) => {
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => {
next.control_r.position = Vec3::new(7.0 + move2 * 8.0, 8.0, 2.0);
next.control_r.orientation = Quaternion::rotation_x(-0.3 + move2 * 2.0)
* Quaternion::rotation_y(move1 * -1.8 + move2 * -1.5)
* Quaternion::rotation_z(move2 * 1.5);
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
},
Some(ToolKind::Axe) => {
next.control_r.position = Vec3::new(
7.0 + move2 * 5.0,
8.0 + move1 * 3.0 + move2 * 7.0,
2.0 + move1 * -6.0 + move2 * 8.0,
);
next.control_r.orientation = Quaternion::rotation_x(-0.3 + move2 * 2.0)
* Quaternion::rotation_y(move1 * -1.8 + move2 * -1.5)
* Quaternion::rotation_z(move2 * 1.5);
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
},
Some(ToolKind::Hammer)
| Some(ToolKind::HammerSimple)
| Some(ToolKind::Pick) => {
next.control_r.position = Vec3::new(
7.0,
8.0 + move1 * -4.0 + move2h * 4.0,
2.0 + move1 * 12.0 + move2h * -16.0,
);
next.control_r.orientation =
Quaternion::rotation_x(-0.3 + move1 * 2.3 + move2h * -3.5)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
},
_ => {},
}
},
(_, _) => {},
};
match hands {
(None, None) | (None, Some(Hands::One)) => {
next.hand_l.position = Vec3::new(-4.5, 8.0, 5.0);
next.hand_l.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(-0.5)
},
(_, _) => {},
};
match hands {
(None, None) | (Some(Hands::One), None) => {
next.hand_r.position = Vec3::new(4.5, 8.0, 5.0);
next.hand_r.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5)
},
(_, _) => {},
};
next
}
}

View File

@ -2,18 +2,22 @@ use super::{
super::{vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{comp::item::ToolKind, states::utils::StageSection};
use common::{
comp::item::{Hands, ToolKind},
states::utils::{AbilityInfo, StageSection},
};
pub struct BetaAnimation;
type BetaAnimationDependency = (
(Option<Hands>, Option<Hands>),
f32,
f32,
Option<StageSection>,
Option<AbilityInfo>,
);
impl Animation for BetaAnimation {
type Dependency = (
Option<ToolKind>,
Option<ToolKind>,
f32,
f32,
Option<StageSection>,
);
type Dependency = BetaAnimationDependency;
type Skeleton = CharacterSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -22,7 +26,7 @@ impl Animation for BetaAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_beta")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
(hands, _velocity, _global_time, stage_section, ability_info): Self::Dependency,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
@ -36,29 +40,90 @@ impl Animation for BetaAnimation {
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_z(0.0);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
let pullback = 1.0 - move3;
if let Some(ToolKind::Sword) = ability_info.and_then(|a| a.tool) {
next.chest.orientation = Quaternion::rotation_x(0.15)
* Quaternion::rotation_y((-0.1) * pullback)
* Quaternion::rotation_z((0.4 + move1 * 1.5 + move2 * -2.5) * pullback);
next.head.orientation = Quaternion::rotation_z(-0.4 + move1 * -1.0 + move2 * 1.5);
}
match hands {
(Some(Hands::Two), _) => match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => {
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.control.position = Vec3::new(
s_a.sc.0 + (-1.4 + move1 * -3.0 + move2 * -2.0) * pullback,
s_a.sc.1 + (-1.4 + move1 * 3.0 + move2 * 3.0) * pullback,
s_a.sc.2 + (-1.9 + move1 * 2.5 * pullback),
);
next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + (-1.7) * pullback)
* Quaternion::rotation_y(
s_a.sc.4 + (0.4 + move1 * 1.5 + move2 * -2.5) * pullback,
)
* Quaternion::rotation_z(s_a.sc.5 + (1.67 + move2 * 1.57) * pullback);
},
_ => {},
},
(_, _) => {},
};
next.control.position = Vec3::new(
s_a.sc.0 + (-1.4 + move1 * -3.0 + move2 * -2.0) * (1.0 - move3),
s_a.sc.1 + (-1.4 + move1 * 3.0 + move2 * 3.0) * (1.0 - move3),
s_a.sc.2 + (-1.9 + move1 * 2.5 * (1.0 - move3)),
);
next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + (-1.7) * (1.0 - move3))
* Quaternion::rotation_y(s_a.sc.4 + (0.4 + move1 * 1.5 + move2 * -2.5) * (1.0 - move3))
* Quaternion::rotation_z(s_a.sc.5 + (1.67 + move2 * 1.57) * (1.0 - move3));
next.chest.orientation = Quaternion::rotation_x(0.15)
* Quaternion::rotation_y((-0.1) * (1.0 - move3))
* Quaternion::rotation_z((0.4 + move1 * 1.5 + move2 * -2.5) * (1.0 - move3));
next.head.orientation = Quaternion::rotation_z((-0.4) * (1.0 - move3));
match hands {
(Some(Hands::One), _) => match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => {
next.control_l.position = Vec3::new(-12.0, 8.0, 2.0);
next.control_l.orientation = Quaternion::rotation_x(1.7)
* Quaternion::rotation_y(-3.7 + move1 * -0.75 + move2 * 1.0)
* Quaternion::rotation_z(3.69);
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
},
_ => {},
},
(_, _) => {},
};
match hands {
(None | Some(Hands::One), Some(Hands::One)) => {
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => {
next.control_r.position = Vec3::new(0.0 + move1 * -8.0, 13.0, 2.0);
next.control_r.orientation = Quaternion::rotation_x(1.7)
* Quaternion::rotation_y(-2.3 + move1 * -2.3 + move2 * 1.0)
* Quaternion::rotation_z(3.69);
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
},
_ => {},
}
},
(_, _) => {},
};
match hands {
(None, None) | (None, Some(Hands::One)) => {
next.hand_l.position = Vec3::new(-4.5, 8.0, 5.0);
next.hand_l.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(-0.5)
},
(_, _) => {},
};
match hands {
(None, None) | (Some(Hands::One), None) => {
next.hand_r.position = Vec3::new(4.5, 8.0, 5.0);
next.hand_r.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5)
},
(_, _) => {},
};
next
}

View File

@ -2,17 +2,22 @@ use super::{
super::{vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{comp::item::ToolKind, states::utils::StageSection};
use common::{
comp::item::{Hands, ToolKind},
states::utils::{AbilityInfo, StageSection},
};
pub struct ChargeswingAnimation;
type ChargeswingAnimationDependency = (
(Option<Hands>, Option<Hands>),
Vec3<f32>,
f32,
Option<StageSection>,
Option<AbilityInfo>,
);
impl Animation for ChargeswingAnimation {
type Dependency = (
Option<ToolKind>,
Option<ToolKind>,
Vec3<f32>,
f32,
Option<StageSection>,
);
type Dependency = ChargeswingAnimationDependency;
type Skeleton = CharacterSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -22,7 +27,7 @@ impl Animation for ChargeswingAnimation {
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
(hands, _velocity, _global_time, stage_section, ability_info): Self::Dependency,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
@ -36,9 +41,9 @@ impl Animation for ChargeswingAnimation {
* ((anim_time * lab * 8.0).sin());
// end spin stuff
let (move1base, move2base, move3, tension, test) = match stage_section {
let (move1base, move2base, movement3, tension, test) = match stage_section {
Some(StageSection::Charge) => (
anim_time.min(1.0),
(anim_time.powf(0.25)).min(1.0),
0.0,
0.0,
(anim_time * 18.0 * lab).sin(),
@ -48,34 +53,24 @@ impl Animation for ChargeswingAnimation {
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4), 0.0, 1.0),
_ => (0.0, 0.0, 0.0, 0.0, 0.0),
};
let move1 = move1base * (1.0 - move3);
let slowrise = test * (1.0 - move3);
let move2 = move2base * (1.0 - move3);
if let Some(ToolKind::Hammer) = active_tool_kind {
let pullback = 1.0 - movement3;
let move1 = move1base * pullback;
let move2 = move2base * pullback;
let slowrise = test * pullback;
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_z(0.0);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
if let Some(ToolKind::Hammer) = ability_info.and_then(|a| a.tool) {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2 + (move2 * -8.0));
next.hand_l.orientation =
Quaternion::rotation_x(s_a.hhl.3) * Quaternion::rotation_y(s_a.hhl.4);
next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.hhr.3) * Quaternion::rotation_y(s_a.hhr.4);
next.control.position = Vec3::new(
s_a.hc.0 + (move1 * -2.0 + move2 * -8.0),
s_a.hc.1 + (move1 * 2.0 + move2 * 6.0),
s_a.hc.2 + (move1 * -2.0 + slowrise * 8.0),
);
next.control.orientation = Quaternion::rotation_x(s_a.hc.3 + (move2 * 0.0))
* Quaternion::rotation_y(
s_a.hc.4 + (tension * 0.08 + move1 * 0.7 + move2 * -1.0 + slowrise * 2.0),
)
* Quaternion::rotation_z(s_a.hc.5 + (move1 * 0.2 + move2 * -1.0));
next.chest.orientation =
Quaternion::rotation_z(short * 0.04 + (move1 * 2.0 + move2 * -3.5));
next.belt.orientation = Quaternion::rotation_z(short * 0.08 + (move1 * -1.0));
next.shorts.orientation = Quaternion::rotation_z(short * 0.15 + (move1 * -1.0));
next.shorts.orientation = Quaternion::rotation_z(short * 0.15 + (move1 * -1.5));
next.head.position = Vec3::new(
0.0 + (move1 * -1.0 + move2 * 2.0),
s_a.head.0 + (move1 * 1.0),
@ -84,6 +79,92 @@ impl Animation for ChargeswingAnimation {
next.head.orientation = Quaternion::rotation_z(move1 * -1.5 + move2 * 3.2);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
}
match hands {
(Some(Hands::Two), _) => match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Hammer) | Some(ToolKind::HammerSimple) => {
next.hand_l.position =
Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2 + (move2 * -8.0));
next.hand_l.orientation =
Quaternion::rotation_x(s_a.hhl.3) * Quaternion::rotation_y(s_a.hhl.4);
next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.hhr.3) * Quaternion::rotation_y(s_a.hhr.4);
next.control.position = Vec3::new(
s_a.hc.0 + (move1 * -2.0 + move2 * -8.0),
s_a.hc.1 + (move1 * 2.0 + move2 * 6.0),
s_a.hc.2 + (move1 * -2.0 + slowrise * 8.0),
);
next.control.orientation = Quaternion::rotation_x(s_a.hc.3 + (move2 * 0.0))
* Quaternion::rotation_y(
s_a.hc.4
+ (tension * 0.08 + move1 * 0.7 + move2 * -1.0 + slowrise * 2.0),
)
* Quaternion::rotation_z(s_a.hc.5 + (move1 * 0.2 + move2 * -1.0));
},
_ => {},
},
(_, _) => {},
};
match hands {
(Some(Hands::One), _) => match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Hammer) | Some(ToolKind::HammerSimple) => {
next.control_l.position = Vec3::new(
-7.0 + move1 * 4.0,
8.0 + move1 * 2.0 + move2 * 4.0,
2.0 + move1 * -1.0 + slowrise * 20.0,
);
next.control_l.orientation = Quaternion::rotation_x(-0.3 + move2 * -1.0)
* Quaternion::rotation_y(tension * 0.07 + move1 * -1.2 + slowrise * 0.5)
* Quaternion::rotation_z(move2 * 1.0);
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
},
_ => {},
},
(_, _) => {},
};
match hands {
(None | Some(Hands::One), Some(Hands::One)) => {
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Hammer) | Some(ToolKind::HammerSimple) => {
next.control_r.position = Vec3::new(
7.0 + move1 * 1.0 + move2 * -20.0,
8.0 + move1 * 1.0 + move2 * 4.0,
2.0 + move1 * -3.0 + slowrise * 20.0,
);
next.control_r.orientation = Quaternion::rotation_x(-0.3 + move2 * -1.0)
* Quaternion::rotation_y(
tension * -0.07 + move1 * -2.0 + slowrise * 1.5,
)
* Quaternion::rotation_z(move2 * 1.0);
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
},
_ => {},
}
},
(_, _) => {},
};
match hands {
(None, None) | (None, Some(Hands::One)) => {
next.hand_l.position = Vec3::new(-4.5, 8.0, 5.0);
next.hand_l.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(-0.5)
},
(_, _) => {},
};
match hands {
(None, None) | (Some(Hands::One), None) => {
next.hand_r.position = Vec3::new(4.5, 8.0, 5.0);
next.hand_r.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5)
},
(_, _) => {},
};
next
}
}

View File

@ -2,18 +2,22 @@ use super::{
super::{vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{comp::item::ToolKind, states::utils::StageSection};
use common::{
comp::item::{Hands, ToolKind},
states::utils::{AbilityInfo, StageSection},
};
use std::f32::consts::PI;
pub struct DashAnimation;
type DashAnimationDependency = (
(Option<Hands>, Option<Hands>),
f32,
Option<StageSection>,
Option<AbilityInfo>,
);
impl Animation for DashAnimation {
type Dependency = (
Option<ToolKind>,
Option<ToolKind>,
f32,
Option<StageSection>,
);
type Dependency = DashAnimationDependency;
type Skeleton = CharacterSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -23,7 +27,7 @@ impl Animation for DashAnimation {
#[allow(clippy::single_match)] // TODO: Pending review in #587
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, _global_time, stage_section): Self::Dependency,
(hands, _global_time, stage_section, ability_info): Self::Dependency,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
@ -31,13 +35,17 @@ impl Animation for DashAnimation {
*rate = 1.0;
let mut next = (*skeleton).clone();
let (movement1, movement2, movement3, movement4) = match stage_section {
let (movement1, movement2, movement3, move4) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0),
Some(StageSection::Charge) => (1.0, anim_time, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, anim_time.powf(0.01), 0.0),
Some(StageSection::Recover) => (1.1, 1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0, 0.0),
};
let pullback = 1.0 - move4;
let move1 = movement1 * pullback;
let move2 = movement2 * pullback;
let move3 = movement3 * pullback;
fn slow(x: f32) -> f32 {
((5.0 / (1.1 + 3.9 * ((x * 12.4).sin()).powi(2))).sqrt()) * ((x * 12.4).sin())
@ -50,56 +58,31 @@ impl Animation for DashAnimation {
fn shortalt(x: f32) -> f32 { (x * 5.0 + PI / 2.0).sin() }
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
match active_tool_kind {
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_z(0.0);
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.control.position = Vec3::new(
s_a.sc.0 + (movement1 * -5.0 + movement3 * -2.0) * (1.0 - movement4),
s_a.sc.1 + (movement2.min(1.0) * -2.0) * (1.0 - movement4),
s_a.sc.2 + (movement2.min(1.0) * 2.0) * (1.0 - movement4),
);
next.control.orientation = Quaternion::rotation_x(
s_a.sc.3 + (movement1 * -1.0 + movement3 * -0.5) * (1.0 - movement4),
) * Quaternion::rotation_y(
s_a.sc.4 + (movement1 * 1.5 + movement3 * -2.5) * (1.0 - movement4),
);
next.head.position =
Vec3::new(0.0, 0.0 + s_a.head.0, s_a.head.1 + movement2.min(1.0) * 1.0);
next.head.orientation =
Quaternion::rotation_y(movement2.min(1.0) * -0.3 + movement3 * 0.3)
* (1.0 - movement4)
* Quaternion::rotation_z(movement1 * -0.9 + movement3 * 1.6)
* (1.0 - movement4);
Vec3::new(0.0, 0.0 + s_a.head.0, s_a.head.1 + move2.min(1.0) * 1.0);
next.head.orientation = Quaternion::rotation_y(move2.min(1.0) * -0.3 + move3 * 0.3)
* Quaternion::rotation_z(move1 * -0.9 + move3 * 1.6);
next.chest.position = Vec3::new(
0.0,
s_a.chest.0,
s_a.chest.1 + (2.0 + shortalt(movement2) * -2.5) * (1.0 - movement4),
);
next.chest.orientation = Quaternion::rotation_x(
(movement2.min(1.0) * -0.4 + movement3 * 0.4) * (1.0 - movement4),
) * Quaternion::rotation_y(
(movement2.min(1.0) * -0.2 + movement3 * 0.3) * (1.0 - movement4),
) * Quaternion::rotation_z(
(movement1 * 1.1 + movement3 * -2.2) * (1.0 - movement4),
s_a.chest.1 + (2.0 + shortalt(move2) * -2.5) + move3 * -3.0,
);
next.chest.orientation =
Quaternion::rotation_x(move2.min(1.0) * -0.4 + move3 * 0.4)
* Quaternion::rotation_y(move2.min(1.0) * -0.2 + move3 * 0.3)
* Quaternion::rotation_z(move1 * 1.1 + move3 * -2.2);
next.shorts.orientation =
Quaternion::rotation_z((short(movement2).min(1.0) * 0.25) * (1.0 - movement4));
next.shorts.orientation = Quaternion::rotation_z(short(move2).min(1.0) * 0.25);
next.belt.orientation =
Quaternion::rotation_z((short(movement2).min(1.0) * 0.1) * (1.0 - movement4));
next.belt.orientation = Quaternion::rotation_z(short(move2).min(1.0) * 0.1);
},
_ => {},
}
@ -107,6 +90,85 @@ impl Animation for DashAnimation {
next.lantern.orientation = Quaternion::rotation_x(slow(anim_time) * -0.7 + 0.4)
* Quaternion::rotation_y(slow(anim_time) * 0.4);
match hands {
(Some(Hands::Two), _) => match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => {
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.control.position = Vec3::new(
s_a.sc.0 + (move1 * -5.0 + move3 * -2.0),
s_a.sc.1 + (move2.min(1.0) * -2.0),
s_a.sc.2 + (move2.min(1.0) * 2.0),
);
next.control.orientation =
Quaternion::rotation_x(s_a.sc.3 + (move1 * -1.0 + move3 * -0.5))
* Quaternion::rotation_y(s_a.sc.4 + (move1 * 1.5 + move3 * -2.5));
},
_ => {},
},
(_, _) => {},
};
match hands {
(Some(Hands::One), _) => match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => {
next.control_l.position = Vec3::new(-7.0, 8.0 + move3 * 5.0, 2.0 + move1 * 4.0);
next.control_l.orientation =
Quaternion::rotation_x(-0.3 + move2 * 1.0 + move3 * 1.0)
* Quaternion::rotation_y(move1 * -1.2 + move3 * -1.5)
* Quaternion::rotation_z(move2 * 1.0 + move3 * 1.5);
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
},
_ => {},
},
(_, _) => {},
};
match hands {
(None | Some(Hands::One), Some(Hands::One)) => {
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => {
next.control_r.position = Vec3::new(
7.0 + move1 * 5.0 + move3 * -30.0,
8.0 + move3 * -5.0,
2.0 + move1 * 1.0,
);
next.control_r.orientation =
Quaternion::rotation_x(-0.3 + move1 * -3.0 + move3 * -0.5)
* Quaternion::rotation_y(
move1 * 1.5 + (move2 * 1.0).min(0.8) + move3 * 1.5,
)
* Quaternion::rotation_z(move3 * 1.5);
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
},
_ => {},
}
},
(_, _) => {},
};
match hands {
(None, None) | (None, Some(Hands::One)) => {
next.hand_l.position = Vec3::new(-4.5, 8.0, 5.0);
next.hand_l.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(-0.5)
},
(_, _) => {},
};
match hands {
(None, None) | (Some(Hands::One), None) => {
next.hand_r.position = Vec3::new(4.5, 8.0, 5.0);
next.hand_r.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5)
},
(_, _) => {},
};
next
}
}

View File

@ -3,7 +3,7 @@ use super::{
CharacterSkeleton, SkeletonAttr,
};
use common::comp::item::{Hands, ToolKind};
use std::{f32::consts::PI, ops::Mul};
use std::ops::Mul;
pub struct IdleAnimation;
@ -87,48 +87,50 @@ impl Animation for IdleAnimation {
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
next.glider.scale = Vec3::one() * 0.0;
next.hold.position = Vec3::new(0.4, -0.3, -5.8);
match active_tool_kind {
Some(ToolKind::Dagger) => {
next.main.position = Vec3::new(-4.0, -5.0, 7.0);
next.main.orientation =
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
match hands {
(Some(Hands::Two), _) => match active_tool_kind {
Some(ToolKind::Bow) => {
next.main.position = Vec3::new(0.0, -5.0, 6.0);
next.main.orientation =
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
next.main.position = Vec3::new(2.0, -5.0, -1.0);
next.main.orientation =
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(1.57);
},
_ => {
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
next.main.orientation =
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
},
Some(ToolKind::Shield) => {
next.main.position = Vec3::new(-0.0, -5.0, 3.0);
next.main.orientation =
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
},
Some(ToolKind::Bow) => {
next.main.position = Vec3::new(0.0, -5.0, 6.0);
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
next.main.position = Vec3::new(2.0, -5.0, -1.0);
next.main.orientation = Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(1.57);
},
_ => {
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
}
(_, _) => {},
};
match second_tool_kind {
Some(ToolKind::Dagger) => {
next.second.position = Vec3::new(4.0, -6.0, 7.0);
next.second.orientation =
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
match hands {
(Some(Hands::One), _) => match active_tool_kind {
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
next.main.position = Vec3::new(-4.0, -5.0, 10.0);
next.main.orientation =
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(1.57);
},
_ => {},
},
Some(ToolKind::Shield) => {
next.second.position = Vec3::new(0.0, -4.0, 3.0);
next.second.orientation =
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
(_, _) => {},
};
match hands {
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
next.second.position = Vec3::new(4.0, -5.5, 10.0);
next.second.orientation =
Quaternion::rotation_y(-2.35) * Quaternion::rotation_z(1.57);
},
_ => {},
},
_ => {
next.second.position = Vec3::new(-7.0, -5.0, 15.0);
next.second.orientation =
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
}
(_, _) => {},
};
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
next.lantern.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);

View File

@ -34,13 +34,9 @@ impl Animation for JumpAnimation {
let mut next = (*skeleton).clone();
let slow = (anim_time * 7.0).sin();
let random =
((((2.0 * ((global_time - anim_time) - ((global_time - anim_time).round()))).abs())
* 10.0)
.round())
/ 10.0;
let switch = if random > 0.5 { 1.0 } else { -1.0 };
let subtract = global_time - anim_time as f32;
let check = subtract - subtract.trunc();
let switch = (check - 0.5).signum();
let speed = Vec2::<f32>::from(velocity).magnitude();
let speednorm = (speed / 10.0).min(1.0);
@ -90,7 +86,7 @@ impl Animation for JumpAnimation {
next.shorts.orientation =
Quaternion::rotation_x(speednorm * 0.5) * Quaternion::rotation_z(tilt * 3.0);
if random > 0.5 {
if switch > 0.0 {
next.hand_l.position = Vec3::new(
-s_a.hand.0,
1.0 + s_a.hand.1 + 4.0,
@ -194,11 +190,33 @@ impl Animation for JumpAnimation {
next.torso.orientation = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
match hands {
(Some(Hands::One), _) => match active_tool_kind {
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
next.main.position = Vec3::new(-4.0, -5.0, 10.0);
next.main.orientation =
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(1.57);
},
_ => {},
},
(_, _) => {},
};
match hands {
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
next.second.position = Vec3::new(4.0, -5.5, 10.0);
next.second.orientation =
Quaternion::rotation_y(-2.35) * Quaternion::rotation_z(1.57);
},
_ => {},
},
(_, _) => {},
};
next.second.scale = match hands {
(Some(Hands::One), Some(Hands::One)) => Vec3::one(),
(Some(Hands::One) | None, Some(Hands::One)) => Vec3::one(),
(_, _) => Vec3::zero(),
};
next
}
}

View File

@ -2,18 +2,21 @@ use super::{
super::{vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{comp::item::ToolKind, states::utils::StageSection};
use std::f32::consts::PI;
use common::{
comp::item::{Hands, ToolKind},
states::utils::{AbilityInfo, StageSection},
};
pub struct LeapAnimation;
type LeapAnimationDependency = (
(Option<Hands>, Option<Hands>),
Vec3<f32>,
f32,
Option<StageSection>,
Option<AbilityInfo>,
);
impl Animation for LeapAnimation {
type Dependency = (
Option<ToolKind>,
Option<ToolKind>,
Vec3<f32>,
f32,
Option<StageSection>,
);
type Dependency = LeapAnimationDependency;
type Skeleton = CharacterSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -23,7 +26,7 @@ impl Animation for LeapAnimation {
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
(hands, _velocity, _global_time, stage_section, ability_info): Self::Dependency,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
@ -31,105 +34,204 @@ impl Animation for LeapAnimation {
*rate = 1.0;
let mut next = (*skeleton).clone();
let (move1, move2, move3, move4) = match stage_section {
let (movement1, movement2, movement3, move4) = match stage_section {
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0, 0.0),
Some(StageSection::Movement) => (1.0, anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, anim_time.powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time),
Some(StageSection::Movement) => (1.0, anim_time.powi(2), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, anim_time.powf(0.75), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time.powf(0.75)),
_ => (0.0, 0.0, 0.0, 0.0),
};
let pullback = 1.0 - move4;
let move1 = movement1 * pullback;
let move2 = movement2 * pullback;
let move3 = movement3 * pullback;
if let Some(ToolKind::Hammer) = active_tool_kind {
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.hhl.3);
next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.hhr.3);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0);
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_z(0.0);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_z(0.0);
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * s_a.scaler;
next.torso.orientation = Quaternion::rotation_z(0.0);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Hammer) => {
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.control.position = Vec3::new(
s_a.hc.0 + move2 * -10.0 + move3 * 6.0,
s_a.hc.1 + move2 * 5.0 + move3 * 7.0,
s_a.hc.2 + move2 * 5.0 + move3 * -10.0,
);
next.control.orientation =
Quaternion::rotation_x(s_a.hc.3 + move2 * 1.57 + move3 * -2.3)
* Quaternion::rotation_y(s_a.hc.4 + move2 * 1.3)
* Quaternion::rotation_z(s_a.hc.5 + move2 * -1.0 + move3 * 0.5);
next.chest.orientation =
Quaternion::rotation_x(move1 * 0.3 + move2 * 0.3 + move3 * -0.9 + move4 * 0.3)
next.chest.orientation = Quaternion::rotation_x(move2 * 0.4 + move3 * -1.5)
* Quaternion::rotation_z(move1 * 0.5 + move2 * 0.2 + move3 * -0.7);
next.head.orientation = Quaternion::rotation_x(move3 * 0.2)
* Quaternion::rotation_y(0.0 + move2 * -0.1)
* Quaternion::rotation_z(move1 * -0.4 + move2 * -0.2 + move3 * 0.6);
next.head.orientation = Quaternion::rotation_x(move3 * 0.2)
* Quaternion::rotation_y(move2 * -0.1)
* Quaternion::rotation_z(move1 * -0.4 + move2 * -0.2 + move3 * 0.6);
next.foot_l.position = Vec3::new(
-s_a.foot.0,
s_a.foot.1 + move3 * 13.0,
s_a.foot.2 + move3 * -2.0,
);
next.foot_l.orientation = Quaternion::rotation_x(-0.8 + move3 * 1.7);
next.foot_l.position = Vec3::new(
-s_a.foot.0,
s_a.foot.1 + move3 * 13.0,
s_a.foot.2 + move3 * -2.0,
);
next.foot_l.orientation = Quaternion::rotation_x(-0.8 + move3 * 1.7);
next.foot_r.position = Vec3::new(
s_a.foot.0,
s_a.foot.1 + 8.0 + move3 * -13.0,
s_a.foot.2 + 5.0 + move3 * -5.0,
);
next.foot_r.orientation = Quaternion::rotation_x(0.9 + move3 * -1.7);
} else if let Some(ToolKind::Axe) = active_tool_kind {
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.ahl.3);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.ahr.3);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0);
next.foot_r.position = Vec3::new(
s_a.foot.0,
s_a.foot.1 + move2 * 8.0 + move3 * -13.0,
s_a.foot.2 + move2 * 5.0 + move3 * -5.0,
);
next.foot_r.orientation = Quaternion::rotation_x(0.9 + move3 * -1.7);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + move3 * -5.0);
},
Some(ToolKind::Axe) => {
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.torso.orientation =
Quaternion::rotation_x(move1 * 0.3 + move2 * 0.5 + move3 * -1.0)
* Quaternion::rotation_z(move1 * 0.4 + move2 * 0.4);
next.control.position = Vec3::new(
s_a.ac.0 + move1 * 8.0,
s_a.ac.1 + move1 * 4.0 + move3 * 3.0,
s_a.ac.2 + move1 * 6.0 + move2 * 1.0 + move3 * -14.0,
);
next.control.orientation = Quaternion::rotation_x(
s_a.ac.3 + move1 * -2.0 + move2 * 0.7 + move3 * -2.3
) * Quaternion::rotation_y(s_a.ac.4)// + move1 * 0.5)
* Quaternion::rotation_z(s_a.ac.5+move1*PI); // - move1 * 0.2);
next.head.orientation = Quaternion::rotation_x(move2 * -0.6 + move3 * 0.8)
* Quaternion::rotation_z(move2 * -0.4);
next.torso.orientation = Quaternion::rotation_x(
-0.3 + move2 * -1.6 * PI + move2 * -0.3 + move3 * -0.2 * PI + move4 * -0.1 * PI,
) * Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.foot_l.position = Vec3::new(
-s_a.foot.0,
s_a.foot.1 + move2 * -4.0 + move3 * 4.0,
s_a.foot.2 + move2 * 5.0 + move3 * -5.0,
);
next.head.orientation =
Quaternion::rotation_x(0.0 + move1 * -0.4 + move2 * 0.4 + move3 * 0.2);
next.foot_r.position = Vec3::new(
s_a.foot.0,
s_a.foot.1 + move2 * 4.0,
s_a.foot.2 + move3 * -3.0,
);
next.foot_l.position = Vec3::new(
-s_a.foot.0,
s_a.foot.1 + move2 * 4.0 + move3 * -1.0,
s_a.foot.2,
);
next.foot_l.orientation =
Quaternion::rotation_x(move1 * 0.9 - move2 * 1.9 + move3 * 1.8);
next.foot_r.position = Vec3::new(
s_a.foot.0,
s_a.foot.1 + move2 * 4.0 + move3 * -8.0,
s_a.foot.2 + move3 * -3.0,
);
next.foot_r.orientation = Quaternion::rotation_x(move1 * 0.9 - move3 * 1.8);
next.foot_l.orientation =
Quaternion::rotation_x(move1 * 0.9 - move2 * 1.0 + move3 * 1.8);
next.belt.orientation = Quaternion::rotation_x(move1 * 0.22 + move2 * 0.1);
next.shorts.orientation = Quaternion::rotation_x(move1 * 0.3 + move2 * 0.1);
next.foot_r.orientation = Quaternion::rotation_x(move1 * 0.9 - move3 * 1.8);
next.belt.orientation = Quaternion::rotation_x(move1 * 0.22 + move2 * 0.1);
next.shorts.orientation = Quaternion::rotation_x(move1 * 0.3 + move2 * 0.1);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
},
_ => {},
}
match hands {
(Some(Hands::Two), _) => match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Hammer) => {
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.hhl.3);
next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.hhr.3);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation =
Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0);
next.control.position = Vec3::new(
s_a.hc.0 + move2 * -10.0 + move3 * 10.0,
s_a.hc.1 + move2 * 5.0 + move3 * 7.0,
s_a.hc.2 + move2 * 5.0 + move3 * -10.0,
);
next.control.orientation =
Quaternion::rotation_x(s_a.hc.3 + move2 * 1.57 + move3 * -2.3)
* Quaternion::rotation_y(s_a.hc.4 + move2 * 1.3)
* Quaternion::rotation_z(s_a.hc.5 + move2 * -1.0 + move3 * 0.5);
},
Some(ToolKind::Axe) => {
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.ahl.3);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.ahr.3);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation =
Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0);
next.control.position = Vec3::new(
s_a.ac.0 + move2 * 8.0 + move3 * 15.0,
s_a.ac.1 + move3 * -10.0,
s_a.ac.2 + move3 * 4.0,
);
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
* Quaternion::rotation_y(s_a.ac.4 + move2 * -0.8 + move3 * -4.0)
* Quaternion::rotation_z(s_a.ac.5 + move2 * -0.6 + move3 * -1.6);
},
_ => {},
},
(_, _) => {},
};
match hands {
(Some(Hands::One), _) => match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Axe) => {
next.control_l.position =
Vec3::new(-7.0 + move3 * 4.0, 8.0 + move3 * 8.0, 2.0 + move3 * -4.0);
next.control_l.orientation =
Quaternion::rotation_x(-0.3 + move2 * 1.0 + move3 * -2.0)
* Quaternion::rotation_y(move2 * -0.5 + move3 * 1.9);
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
},
Some(ToolKind::Hammer) | Some(ToolKind::HammerSimple) | Some(ToolKind::Pick) => {
next.control_l.position = Vec3::new(
-7.0,
8.0 + move2 * -5.0 + move3 * 9.0,
2.0 + move2 * 8.0 + move3 * -12.0,
);
next.control_l.orientation =
Quaternion::rotation_x(-0.3 + move2 * 1.5 + move3 * -2.5);
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
},
_ => {},
},
(_, _) => {},
};
match hands {
(None | Some(Hands::One), Some(Hands::One)) => {
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Axe) => {
next.control_r.position = Vec3::new(
7.0 + move2 * 2.0,
8.0 + move2 * -8.0 + move3 * 13.0,
2.0 + move2 * 7.0 + move3 * -10.0,
);
next.control_r.orientation = Quaternion::rotation_x(-0.3 + move3 * -2.2)
* Quaternion::rotation_y(move2 * -0.5 + move3 * 1.2);
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
},
Some(ToolKind::Hammer)
| Some(ToolKind::HammerSimple)
| Some(ToolKind::Pick) => {
next.control_r.position = Vec3::new(
7.0 + move2 * 3.0 + move3 * -3.0,
8.0 + move2 * -9.0 + move3 * 15.0,
2.0 + move2 * 11.0 + move3 * -18.0,
);
next.control_r.orientation =
Quaternion::rotation_x(-0.3 + move2 * 1.5 + move3 * -2.5)
* Quaternion::rotation_y(move2 * -0.75 + move3 * 0.75);
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
},
_ => {},
}
},
(_, _) => {},
};
match hands {
(None, None) | (None, Some(Hands::One)) => {
next.hand_l.position = Vec3::new(-4.5, 8.0, 5.0);
next.hand_l.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(-0.5)
},
(_, _) => {},
};
match hands {
(None, None) | (Some(Hands::One), None) => {
next.hand_r.position = Vec3::new(4.5, 8.0, 5.0);
next.hand_r.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5)
},
(_, _) => {},
};
next
}
}

View File

@ -253,11 +253,34 @@ impl Animation for RunAnimation {
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler;
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
next.second.scale = match hands {
(Some(Hands::One), Some(Hands::One)) => Vec3::one(),
(_, _) => Vec3::zero(),
match hands {
(Some(Hands::One), _) => match active_tool_kind {
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
next.main.position = Vec3::new(-4.0, -5.0, 10.0);
next.main.orientation =
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(1.57);
},
_ => {},
},
(_, _) => {},
};
match hands {
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
next.second.position = Vec3::new(4.0, -5.5, 10.0);
next.second.orientation =
Quaternion::rotation_y(-2.35) * Quaternion::rotation_z(1.57);
},
_ => {},
},
(_, _) => {},
};
next.second.scale = match hands {
(Some(Hands::One) | None, Some(Hands::One)) => Vec3::one(),
(_, _) => Vec3::zero(),
};
next
}
}

View File

@ -2,19 +2,23 @@ use super::{
super::{vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{comp::item::ToolKind, states::utils::StageSection};
use common::{
comp::item::{Hands, ToolKind},
states::utils::{AbilityInfo, StageSection},
};
use std::f32::consts::PI;
pub struct SpinAnimation;
type SpinAnimationDependency = (
(Option<Hands>, Option<Hands>),
Vec3<f32>,
f32,
Option<StageSection>,
Option<AbilityInfo>,
);
impl Animation for SpinAnimation {
type Dependency = (
Option<ToolKind>,
Option<ToolKind>,
Vec3<f32>,
f32,
Option<StageSection>,
);
type Dependency = SpinAnimationDependency;
type Skeleton = CharacterSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -23,7 +27,7 @@ impl Animation for SpinAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_spin")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
(hands, _velocity, _global_time, stage_section, ability_info): Self::Dependency,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
@ -38,68 +42,37 @@ impl Animation for SpinAnimation {
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement3;
let movement1 = movement1base * pullback;
let movement2 = movement2base * pullback;
let move1 = movement1base * pullback;
let move2 = movement2base * pullback;
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_z(0.0);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
match active_tool_kind {
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.control.position = Vec3::new(
s_a.sc.0 + movement1 * 2.0 + movement2 * -12.0 + movement3 * -7.0,
s_a.sc.1 + 8.0 + movement1 * 0.6 + movement2 * -15.0 + movement3 * -10.0,
s_a.sc.2 + 1.0 + movement1 * 0.6 + movement2 * 1.5 + movement3 * -4.0,
);
next.control.orientation =
Quaternion::rotation_x(-0.5 + s_a.sc.3 + movement1 * -1.2)
* Quaternion::rotation_y(
s_a.sc.4 - 0.6 + movement1 * 0.0 + movement2 * -1.7,
)
* Quaternion::rotation_z(s_a.sc.5 + 0.1 + movement1 * 1.57);
next.head.position = Vec3::new(
0.0 + 2.0 + movement2 * -2.0,
2.0 + movement2 * -2.0 + s_a.head.0,
0.0 + 2.0 + move2 * -2.0,
2.0 + move2 * -2.0 + s_a.head.0,
s_a.head.1,
);
next.chest.orientation = Quaternion::rotation_x(movement2 * 0.15)
* Quaternion::rotation_y(
movement1 * -0.1 + movement2 * 0.15 + movement3 * -0.1,
)
* Quaternion::rotation_z(
-1.0 + movement1 * -0.6 + movement2 * 1.0 + movement3 * 0.5,
);
next.chest.orientation = Quaternion::rotation_x(move2 * -0.15)
* Quaternion::rotation_y(move1 * -0.1 + move2 * 0.15)
* Quaternion::rotation_z(-1.0 + move1 * -0.6 + move2 * 1.6);
next.belt.orientation = Quaternion::rotation_x(movement1 * 0.1)
* Quaternion::rotation_z(movement2.sin() * 0.5);
next.belt.orientation =
Quaternion::rotation_x(move1 * 0.1) * Quaternion::rotation_z(move2.sin() * 0.5);
next.shorts.orientation = Quaternion::rotation_x(movement1 * 0.1)
* Quaternion::rotation_z(movement2.sin() * 1.5);
next.shorts.orientation =
Quaternion::rotation_x(move1 * 0.1) * Quaternion::rotation_z(move2.sin() * 1.5);
next.head.orientation = Quaternion::rotation_y(movement1 * 0.1 + movement2 * -0.1)
* Quaternion::rotation_z(1.07 + movement1 * 0.4 + movement2 * -1.1);
next.head.orientation = Quaternion::rotation_x(move2 * 0.15)
* Quaternion::rotation_z(1.07 + move1 * 0.4 + move2 * -1.5);
},
Some(ToolKind::Axe) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
@ -107,19 +80,6 @@ impl Animation for SpinAnimation {
_ => (0.0, 0.0, 0.0),
};
next.control.position = Vec3::new(
s_a.ac.0 + (-3.0 + movement1 * 0.0 + movement2 * -2.0),
s_a.ac.1 + (-3.5 + movement1 * -4.6 + movement2 * 5.0),
s_a.ac.2 + (-11.0 + movement1 * 10.0 + movement2 * -4.0),
);
next.control.orientation =
Quaternion::rotation_x(s_a.ac.3 + (-2.6 + movement1 * 0.0 + movement2 * -0.6))
* Quaternion::rotation_y(
s_a.ac.4 + (0.2 + movement1 * -0.5 + movement2 * 0.0),
)
* Quaternion::rotation_z(
s_a.ac.5 + (-0.5 + movement1 * -3.0 + movement2 * 0.5),
);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
next.chest.orientation = Quaternion::rotation_x(0.4 + movement2 * -0.5)
@ -157,9 +117,134 @@ impl Animation for SpinAnimation {
);
next.foot_r.orientation =
Quaternion::rotation_x(movement1 * -0.5 + movement2 * -0.5);
next.head.orientation = Quaternion::rotation_x(movement2 * 0.25)
* Quaternion::rotation_z(movement2 * 0.8);
},
_ => {},
}
match hands {
(Some(Hands::Two), _) => match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.control.position = Vec3::new(
s_a.sc.0 + movement1base * 2.0 + movement2base * -7.0,
s_a.sc.1 + 8.0 + movement1base * 0.6 + movement2base * -15.0,
s_a.sc.2 + 1.0 + movement1base * 0.6 + movement2base * 1.5,
);
next.control.orientation =
Quaternion::rotation_x(-0.5 + s_a.sc.3 + movement1base * -1.2)
* Quaternion::rotation_y(s_a.sc.4 - 0.6 + movement2base * -0.2)
* Quaternion::rotation_z(s_a.sc.5 - 1.57 + movement1base * PI);
},
Some(ToolKind::Axe) => {
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
let (move1, move2, _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.powi(4)),
_ => (0.0, 0.0, 0.0),
};
next.control.position = Vec3::new(
s_a.ac.0 + move1 * -1.0 + move2 * -2.0,
s_a.ac.1 + move1 * -3.0 + move2 * 3.0,
s_a.ac.2 + move1 * 6.0 + move2 * -15.0,
);
next.control.orientation =
Quaternion::rotation_x(s_a.ac.3 + move1 * 0.0 + move2 * -3.0)
* Quaternion::rotation_y(s_a.ac.4 + move1 * -0.0 + move2 * -0.4)
* Quaternion::rotation_z(s_a.ac.5 + move1 * -2.0 + move2 * -1.0)
},
_ => {},
},
(_, _) => {},
};
match hands {
(Some(Hands::One), _) => match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => {
next.control_l.position = Vec3::new(-7.0 + movement2base * -5.0, 8.0, 2.0);
next.control_l.orientation = Quaternion::rotation_x(1.7)
* Quaternion::rotation_y(-2.7 + movement1base * -1.0 + movement2base * 2.0)
* Quaternion::rotation_z(1.5 + movement1base * PI);
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
},
Some(ToolKind::Axe) => {
next.control_l.position = Vec3::new(
-2.0 + movement1base * -5.0,
18.0 + movement1base * -10.0,
6.0 + movement1base * -10.0,
);
next.control_l.orientation = Quaternion::rotation_x(1.7 + movement2base * 1.5)
* Quaternion::rotation_y(-3.7)
* Quaternion::rotation_z(1.5 + movement2base * 1.57);
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
},
_ => {},
},
(_, _) => {},
};
match hands {
(None | Some(Hands::One), Some(Hands::One)) => {
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => {
next.control_r.position =
Vec3::new(15.0 + move2 * -15.0, 8.0 + move2 * 5.0, 2.0);
next.control_r.orientation = Quaternion::rotation_x(1.7)
* Quaternion::rotation_y(-3.3 + move1 * -1.0 + move2 * 2.0)
* Quaternion::rotation_z(1.5 + move1 * PI);
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
},
Some(ToolKind::Axe) => {
next.control_r.position = Vec3::new(
12.0 + move1 * -10.0,
18.0 + move1 * -10.0,
4.0 + move1 * -2.0,
);
next.control_r.orientation = Quaternion::rotation_x(1.7 + move2 * 1.5)
* Quaternion::rotation_y(-3.3)
* Quaternion::rotation_z(1.5 + move2 * 1.57);
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
},
_ => {},
}
},
(_, _) => {},
};
match hands {
(None, None) | (None, Some(Hands::One)) => {
next.hand_l.position = Vec3::new(-4.5, 8.0, 5.0);
next.hand_l.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(-0.5)
},
(_, _) => {},
};
match hands {
(None, None) | (Some(Hands::One), None) => {
next.hand_r.position = Vec3::new(4.5, 8.0, 5.0);
next.hand_r.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5)
},
(_, _) => {},
};
next
}
}

View File

@ -2,19 +2,23 @@ use super::{
super::{vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{comp::item::ToolKind, states::utils::StageSection};
use common::{
comp::item::{Hands, ToolKind},
states::utils::{AbilityInfo, StageSection},
};
use std::f32::consts::PI;
pub struct SpinMeleeAnimation;
type SpinMeleeAnimationDependency = (
(Option<Hands>, Option<Hands>),
Vec3<f32>,
f32,
Option<StageSection>,
Option<AbilityInfo>,
);
impl Animation for SpinMeleeAnimation {
type Dependency = (
Option<ToolKind>,
Option<ToolKind>,
Vec3<f32>,
f32,
Option<StageSection>,
);
type Dependency = SpinMeleeAnimationDependency;
type Skeleton = CharacterSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -24,110 +28,180 @@ impl Animation for SpinMeleeAnimation {
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
(hands, _velocity, _global_time, stage_section, ability_info): Self::Dependency,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time, 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)),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(2.0)),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement3;
let move1 = movement1 * pullback;
let move2 = movement2 * pullback;
let mut next = (*skeleton).clone();
match active_tool_kind {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_z(0.0);
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_z(0.0);
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.torso.orientation = Quaternion::rotation_z(movement2 * PI * 2.0);
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2 + move1 * 2.0);
next.control.orientation =
Quaternion::rotation_x(s_a.sc.3 + move1 * -PI / 2.5 + move3 * PI / 2.0)
* Quaternion::rotation_z(s_a.sc.5 + move1 * -PI / 2.0 + move3 * PI / 2.0);
next.torso.orientation = Quaternion::rotation_z(move2 * PI * 2.0);
next.chest.position =
Vec3::new(0.0, s_a.chest.0 + move1 * -2.0, s_a.chest.1 + move1 * -3.0);
next.chest.orientation = Quaternion::rotation_x(move1 * -0.3)
* Quaternion::rotation_y(move1 * 0.15 + move3 * -0.15);
next.chest.position = Vec3::new(
0.0,
s_a.chest.0 + move1 * -2.0,
s_a.chest.1 + move1 * -2.0 + move2 * 2.0,
);
next.chest.orientation = Quaternion::rotation_x(move1 * -0.3);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_x(move1 * 0.2 + move3 * 0.15)
* Quaternion::rotation_z(move2 * 0.8 + move3 * -0.6);
next.belt.orientation = Quaternion::rotation_x(0.1);
next.shorts.orientation = Quaternion::rotation_x(0.2);
next.head.orientation =
Quaternion::rotation_x(move1 * 0.2) * Quaternion::rotation_z(move2 * 0.8);
next.belt.orientation = Quaternion::rotation_x(move1 * 0.5);
next.shorts.orientation = Quaternion::rotation_x(move1 * 0.4);
next.belt.position = Vec3::new(0.0, s_a.belt.0, s_a.belt.1 + move1 * 0.0);
next.belt.orientation = Quaternion::rotation_x(0.15);
next.shorts.position =
Vec3::new(0.0, s_a.shorts.0 + move1 * 2.0, s_a.shorts.1 + move1 * 1.0);
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1 + move1 * -6.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(move1 * -1.0);
},
Some(ToolKind::Axe) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
next.control.position =
Vec3::new(s_a.ac.0 + move1 * 8.0, s_a.ac.1, s_a.ac.2 + move1 * -4.0);
next.control.orientation =
Quaternion::rotation_x(s_a.ac.3 + move1 * -0.8 * (1.0 - move3))
* Quaternion::rotation_y(s_a.ac.4 + move1 * -PI * (1.0 - move3))
* Quaternion::rotation_z(s_a.ac.5 + move1 * 1.2 * (1.0 - move3));
next.head.orientation = Quaternion::rotation_x(move1 * -0.2 * (1.0 - move3))
* Quaternion::rotation_z(move1 * 0.4 * (1.0 - move3));
next.head.orientation =
Quaternion::rotation_x(move1 * -0.2) * Quaternion::rotation_z(move1 * 0.4);
next.head.position = Vec3::new(0.0, s_a.head.0 + move1 * 2.0, s_a.head.1);
next.chest.position =
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + move1 * -1.0 * (1.0 - move3));
next.chest.orientation = Quaternion::rotation_x(move1 * 0.3 * (1.0 - move3))
* Quaternion::rotation_y(move1 * 0.3 * (1.0 - move3));
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + move1 * -1.0);
next.chest.orientation =
Quaternion::rotation_x(move1 * 0.3) * Quaternion::rotation_y(move1 * 0.3);
next.belt.position = Vec3::new(
0.0,
1.0 + s_a.belt.0,
s_a.belt.1 + move1 * 0.5 * (1.0 - move3),
);
next.belt.position = Vec3::new(0.0, 1.0 + s_a.belt.0, s_a.belt.1 + move1 * 0.5);
next.belt.orientation = Quaternion::rotation_x(0.15);
next.shorts.position = Vec3::new(
0.0,
1.0 + s_a.shorts.0 + move1 * 1.0 * (1.0 - move3),
s_a.shorts.1 + move1 * 1.0 * (1.0 - move3),
1.0 + s_a.shorts.0 + move1 * 1.0,
s_a.shorts.1 + move1 * 1.0,
);
next.shorts.orientation =
Quaternion::rotation_x(0.15 + 0.15 * move1 * (1.0 - move3));
next.shorts.orientation = Quaternion::rotation_x(0.15 + 0.15 * move1);
next.torso.orientation =
Quaternion::rotation_z(move1 * 1.0 * (1.0 - move3) + move2 * -2.0 * PI);
Quaternion::rotation_z(movement1 * -0.5 + movement2 * -6.78);
next.foot_l.position = Vec3::new(
-s_a.foot.0,
s_a.foot.1 + move1 * 7.0 * (1.0 - move3),
s_a.foot.2,
);
next.foot_l.orientation = Quaternion::rotation_x(move1 * 0.8 * (1.0 - move3));
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1 + move1 * 7.0, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(move1 * 0.8);
next.foot_r.position = Vec3::new(
s_a.foot.0,
s_a.foot.1 + move1 * -3.0 * (1.0 - move3),
s_a.foot.2,
);
next.foot_r.orientation = Quaternion::rotation_x(move1 * -0.5 * (1.0 - move3));
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1 + move1 * -3.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(move1 * -0.5);
},
_ => {},
}
match hands {
(Some(Hands::Two), _) => match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.control.position = Vec3::new(
s_a.sc.0,
s_a.sc.1 + move1 * 4.0,
s_a.sc.2 + move1 * 2.0 + move2 * 10.0,
);
next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + move1 * -PI / 2.5)
* Quaternion::rotation_z(s_a.sc.5 + move1 * -PI / 2.0);
},
Some(ToolKind::Axe) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
next.control.position =
Vec3::new(s_a.ac.0 + move1 * 8.0, s_a.ac.1, s_a.ac.2 + move1 * -4.0);
next.control.orientation =
Quaternion::rotation_x(s_a.ac.3 + move1 * -1.0 + move2 * 0.4)
* Quaternion::rotation_y(s_a.ac.4 + move1 * -PI)
* Quaternion::rotation_z(s_a.ac.5 + move1 * 1.4);
},
_ => {},
},
(_, _) => {},
};
match hands {
(Some(Hands::One), _) => match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) => {
next.control_l.position = Vec3::new(-7.0, 8.0, 2.0);
next.control_l.orientation = Quaternion::rotation_x(-0.3 + move1 * -0.5)
* Quaternion::rotation_z(move1 * 1.57);
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
},
Some(ToolKind::Axe) => {
next.control_l.position = Vec3::new(-7.0, 8.0, 2.0);
next.control_l.orientation = Quaternion::rotation_x(-0.3 + move1 * -1.3)
* Quaternion::rotation_z(move1 * -1.57);
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
},
_ => {},
},
(_, _) => {},
};
match hands {
(None | Some(Hands::One), Some(Hands::One)) => {
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) => {
next.control_r.position = Vec3::new(7.0, 8.0, 2.0 + move1 * 10.0);
next.control_r.orientation = Quaternion::rotation_x(-0.3 + move1 * -1.2)
* Quaternion::rotation_y(move1 * 0.8)
* Quaternion::rotation_z(move1 * 1.57);
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
},
Some(ToolKind::Axe) => {
next.control_r.position = Vec3::new(7.0, 8.0, 2.0);
next.control_r.orientation = Quaternion::rotation_x(-0.3 + move1 * -1.6)
* Quaternion::rotation_z(move1 * -1.57);
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
},
_ => {},
}
},
(_, _) => {},
};
match hands {
(None, None) | (None, Some(Hands::One)) => {
next.hand_l.position = Vec3::new(-4.5, 8.0, 5.0);
next.hand_l.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(-0.5)
},
(_, _) => {},
};
match hands {
(None, None) | (Some(Hands::One), None) => {
next.hand_r.position = Vec3::new(4.5, 8.0, 5.0);
next.hand_r.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5)
},
(_, _) => {},
};
next
}
}

View File

@ -2,20 +2,25 @@ use super::{
super::{vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{comp::item::ToolKind, states::utils::StageSection};
use common::{
comp::item::{Hands, ToolKind},
states::utils::StageSection,
};
pub struct StaggeredAnimation;
type StaggeredAnimationDependency = (
Option<ToolKind>,
Option<ToolKind>,
(Option<Hands>, Option<Hands>),
f32,
f32,
Option<StageSection>,
f32,
bool,
);
impl Animation for StaggeredAnimation {
type Dependency = (
Option<ToolKind>,
Option<ToolKind>,
f32,
f32,
Option<StageSection>,
f32,
bool,
);
type Dependency = StaggeredAnimationDependency;
type Skeleton = CharacterSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -28,6 +33,7 @@ impl Animation for StaggeredAnimation {
(
active_tool_kind,
_second_tool_kind,
hands,
_velocity,
global_time,
stage_section,
@ -67,89 +73,126 @@ impl Animation for StaggeredAnimation {
if wield_status {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
match active_tool_kind {
Some(ToolKind::Sword) => {
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
match hands {
(Some(Hands::Two), _) => match active_tool_kind {
Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => {
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
next.control.orientation = Quaternion::rotation_x(s_a.sc.3);
},
Some(ToolKind::Axe) => {
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2);
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
* Quaternion::rotation_y(s_a.ac.4)
* Quaternion::rotation_z(s_a.ac.5);
},
Some(ToolKind::Hammer | ToolKind::Pick) => {
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.hhl.3) * Quaternion::rotation_y(s_a.hhl.4);
next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.hhr.3) * Quaternion::rotation_y(s_a.hhr.4);
next.control.position = Vec3::new(s_a.hc.0, s_a.hc.1, s_a.hc.2);
next.control.orientation = Quaternion::rotation_x(s_a.hc.3)
* Quaternion::rotation_y(s_a.hc.4)
* Quaternion::rotation_z(s_a.hc.5);
},
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4);
next.control.position = Vec3::new(s_a.stc.0, s_a.stc.1, s_a.stc.2);
next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.sthl.3);
next.control.orientation = Quaternion::rotation_x(s_a.stc.3)
* Quaternion::rotation_y(s_a.stc.4)
* Quaternion::rotation_z(s_a.stc.5);
},
Some(ToolKind::Bow) => {
next.hand_l.position = Vec3::new(s_a.bhl.0, s_a.bhl.1, s_a.bhl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3);
next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
next.hold.position = Vec3::new(0.0, -1.0, -5.2);
next.hold.orientation = Quaternion::rotation_x(-1.57);
next.hold.scale = Vec3::one() * 1.0;
next.control.position = Vec3::new(s_a.bc.0, s_a.bc.1, s_a.bc.2);
next.control.orientation =
Quaternion::rotation_y(s_a.bc.4) * Quaternion::rotation_z(s_a.bc.5);
},
Some(ToolKind::Debug) => {
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.main.position = Vec3::new(-5.0, 5.0, 23.0);
next.main.orientation = Quaternion::rotation_x(3.14);
},
Some(ToolKind::Farming) => {
next.hand_l.position = Vec3::new(9.0, 1.0, 1.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57);
next.hand_r.position = Vec3::new(9.0, 1.0, 11.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57);
next.main.position = Vec3::new(7.5, 7.5, 13.2);
next.main.orientation = Quaternion::rotation_y(3.14);
next.control.position = Vec3::new(-11.0, 1.8, 4.0);
},
_ => {},
},
(_, _) => {},
};
match hands {
(Some(Hands::One), _) => {
next.control_l.position = Vec3::new(-7.0, 8.0, 2.0);
next.control_l.orientation = Quaternion::rotation_x(-0.3);
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
},
(_, _) => {},
};
match hands {
(None | Some(Hands::One), Some(Hands::One)) => {
next.control_r.position = Vec3::new(7.0, 8.0, 2.0);
next.control_r.orientation = Quaternion::rotation_x(-0.3);
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
},
(_, _) => {},
};
match hands {
(None, None) | (None, Some(Hands::One)) => {
next.hand_l.position = Vec3::new(-4.5, 8.0, 5.0);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
Quaternion::rotation_x(1.9) * Quaternion::rotation_y(-0.5)
},
(_, _) => {},
};
match hands {
(None, None) | (Some(Hands::One), None) => {
next.hand_r.position = Vec3::new(4.5, 8.0, 5.0);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
next.control.orientation = Quaternion::rotation_x(s_a.sc.3);
Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5)
},
Some(ToolKind::Axe) => {
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2);
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
* Quaternion::rotation_y(s_a.ac.4)
* Quaternion::rotation_z(s_a.ac.5);
},
Some(ToolKind::Hammer | ToolKind::Pick) => {
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.hhl.3) * Quaternion::rotation_y(s_a.hhl.4);
next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.hhr.3) * Quaternion::rotation_y(s_a.hhr.4);
next.control.position = Vec3::new(s_a.hc.0, s_a.hc.1, s_a.hc.2);
next.control.orientation = Quaternion::rotation_x(s_a.hc.3)
* Quaternion::rotation_y(s_a.hc.4)
* Quaternion::rotation_z(s_a.hc.5);
},
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4);
next.control.position = Vec3::new(s_a.stc.0, s_a.stc.1, s_a.stc.2);
next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.sthl.3);
next.control.orientation = Quaternion::rotation_x(s_a.stc.3)
* Quaternion::rotation_y(s_a.stc.4)
* Quaternion::rotation_z(s_a.stc.5);
},
Some(ToolKind::Bow) => {
next.hand_l.position = Vec3::new(s_a.bhl.0, s_a.bhl.1, s_a.bhl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3);
next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
next.hold.position = Vec3::new(0.0, -1.0, -5.2);
next.hold.orientation = Quaternion::rotation_x(-1.57);
next.hold.scale = Vec3::one() * 1.0;
next.control.position = Vec3::new(s_a.bc.0, s_a.bc.1, s_a.bc.2);
next.control.orientation =
Quaternion::rotation_y(s_a.bc.4) * Quaternion::rotation_z(s_a.bc.5);
},
Some(ToolKind::Debug) => {
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.main.position = Vec3::new(-5.0, 5.0, 23.0);
next.main.orientation = Quaternion::rotation_x(3.14);
},
Some(ToolKind::Farming) => {
next.hand_l.position = Vec3::new(9.0, 1.0, 1.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57);
next.hand_r.position = Vec3::new(9.0, 1.0, 11.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57);
next.main.position = Vec3::new(7.5, 7.5, 13.2);
next.main.orientation = Quaternion::rotation_y(3.14);
next.control.position = Vec3::new(-11.0, 1.8, 4.0);
},
_ => {},
(_, _) => {},
}
} else if mirror > 0.0 {
next.hand_r.position = Vec3::new(

View File

@ -3,7 +3,7 @@ use super::{
CharacterSkeleton, SkeletonAttr,
};
use common::comp::item::{Hands, ToolKind};
use std::{f32::consts::PI, ops::Mul};
use std::ops::Mul;
pub struct StandAnimation;
@ -94,59 +94,60 @@ impl Animation for StandAnimation {
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
next.glider.scale = Vec3::one() * 0.0;
next.hold.position = Vec3::new(0.4, -0.3, -5.8);
match active_tool_kind {
Some(ToolKind::Dagger) => {
next.main.position = Vec3::new(-4.0, -5.0, 7.0);
next.main.orientation =
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
match hands {
(Some(Hands::Two), _) => match active_tool_kind {
Some(ToolKind::Bow) => {
next.main.position = Vec3::new(0.0, -5.0, 6.0);
next.main.orientation =
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
next.main.position = Vec3::new(2.0, -5.0, -1.0);
next.main.orientation =
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(1.57);
},
_ => {
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
next.main.orientation =
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
},
Some(ToolKind::Shield) => {
next.main.position = Vec3::new(-0.0, -5.0, 3.0);
next.main.orientation =
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
},
Some(ToolKind::Bow) => {
next.main.position = Vec3::new(0.0, -5.0, 6.0);
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
next.main.position = Vec3::new(2.0, -5.0, -1.0);
next.main.orientation = Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(1.57);
},
_ => {
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
}
(_, _) => {},
};
match second_tool_kind {
Some(ToolKind::Dagger) => {
next.second.position = Vec3::new(4.0, -6.0, 7.0);
next.second.orientation =
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
match hands {
(Some(Hands::One), _) => match active_tool_kind {
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
next.main.position = Vec3::new(-4.0, -5.0, 10.0);
next.main.orientation =
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
_ => {},
},
Some(ToolKind::Shield) => {
next.second.position = Vec3::new(0.0, -4.0, 3.0);
next.second.orientation =
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
(_, _) => {},
};
match hands {
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
next.second.position = Vec3::new(4.0, -5.5, 10.0);
next.second.orientation =
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(1.57);
},
_ => {},
},
_ => {
next.second.position = Vec3::new(-7.0, -5.0, 15.0);
next.second.orientation =
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
}
(_, _) => {},
};
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
next.lantern.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler;
next.second.scale = Vec3::one();
next.second.scale = match hands {
(Some(Hands::One), Some(Hands::One)) => Vec3::one(),
(Some(Hands::One) | None, Some(Hands::One)) => Vec3::one(),
(_, _) => Vec3::zero(),
};
next
}
}

View File

@ -2,20 +2,25 @@ use super::{
super::{vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{comp::item::ToolKind, states::utils::StageSection};
use common::{
comp::item::{Hands, ToolKind},
states::utils::StageSection,
};
pub struct StunnedAnimation;
type StunnedAnimationDependency = (
Option<ToolKind>,
Option<ToolKind>,
(Option<Hands>, Option<Hands>),
f32,
f32,
Option<StageSection>,
f32,
bool,
);
impl Animation for StunnedAnimation {
type Dependency = (
Option<ToolKind>,
Option<ToolKind>,
f32,
f32,
Option<StageSection>,
f32,
bool,
);
type Dependency = StunnedAnimationDependency;
type Skeleton = CharacterSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -28,6 +33,7 @@ impl Animation for StunnedAnimation {
(
active_tool_kind,
_second_tool_kind,
hands,
_velocity,
global_time,
stage_section,
@ -65,89 +71,127 @@ impl Animation for StunnedAnimation {
if wield_status {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
match active_tool_kind {
Some(ToolKind::Sword) => {
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
match hands {
(Some(Hands::Two), _) => match active_tool_kind {
Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => {
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
next.control.orientation = Quaternion::rotation_x(s_a.sc.3);
},
Some(ToolKind::Axe) => {
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2);
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
* Quaternion::rotation_y(s_a.ac.4)
* Quaternion::rotation_z(s_a.ac.5);
},
Some(ToolKind::Hammer | ToolKind::Pick) => {
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.hhl.3) * Quaternion::rotation_y(s_a.hhl.4);
next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.hhr.3) * Quaternion::rotation_y(s_a.hhr.4);
next.control.position = Vec3::new(s_a.hc.0, s_a.hc.1, s_a.hc.2);
next.control.orientation = Quaternion::rotation_x(s_a.hc.3)
* Quaternion::rotation_y(s_a.hc.4)
* Quaternion::rotation_z(s_a.hc.5);
},
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4);
next.control.position = Vec3::new(s_a.stc.0, s_a.stc.1, s_a.stc.2);
next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.sthl.3);
next.control.orientation = Quaternion::rotation_x(s_a.stc.3)
* Quaternion::rotation_y(s_a.stc.4)
* Quaternion::rotation_z(s_a.stc.5);
},
Some(ToolKind::Bow) => {
next.hand_l.position = Vec3::new(s_a.bhl.0, s_a.bhl.1, s_a.bhl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3);
next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
next.hold.position = Vec3::new(0.0, -1.0, -5.2);
next.hold.orientation = Quaternion::rotation_x(-1.57);
next.hold.scale = Vec3::one() * 1.0;
next.control.position = Vec3::new(s_a.bc.0, s_a.bc.1, s_a.bc.2);
next.control.orientation =
Quaternion::rotation_y(s_a.bc.4) * Quaternion::rotation_z(s_a.bc.5);
},
Some(ToolKind::Debug) => {
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.main.position = Vec3::new(-5.0, 5.0, 23.0);
next.main.orientation = Quaternion::rotation_x(3.14);
},
Some(ToolKind::Farming) => {
next.hand_l.position = Vec3::new(9.0, 1.0, 1.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57);
next.hand_r.position = Vec3::new(9.0, 1.0, 11.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57);
next.main.position = Vec3::new(7.5, 7.5, 13.2);
next.main.orientation = Quaternion::rotation_y(3.14);
next.control.position = Vec3::new(-11.0, 1.8, 4.0);
},
_ => {},
},
(_, _) => {},
};
match hands {
(Some(Hands::One), _) => {
next.control_l.position = Vec3::new(-7.0, 8.0, 2.0);
next.control_l.orientation = Quaternion::rotation_x(-0.3);
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
},
(_, _) => {},
};
match hands {
(None | Some(Hands::One), Some(Hands::One)) => {
next.control_r.position = Vec3::new(7.0, 8.0, 2.0);
next.control_r.orientation = Quaternion::rotation_x(-0.3);
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
},
(_, _) => {},
};
match hands {
(None, None) | (None, Some(Hands::One)) => {
next.hand_l.position = Vec3::new(-4.5, 8.0, 5.0);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
Quaternion::rotation_x(1.9) * Quaternion::rotation_y(-0.5)
},
(_, _) => {},
};
match hands {
(None, None) | (Some(Hands::One), None) => {
next.hand_r.position = Vec3::new(4.5, 8.0, 5.0);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
next.control.orientation = Quaternion::rotation_x(s_a.sc.3);
Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5)
},
Some(ToolKind::Axe) => {
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2);
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
* Quaternion::rotation_y(s_a.ac.4)
* Quaternion::rotation_z(s_a.ac.5);
},
Some(ToolKind::Hammer | ToolKind::Pick) => {
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.hhl.3) * Quaternion::rotation_y(s_a.hhl.4);
next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.hhr.3) * Quaternion::rotation_y(s_a.hhr.4);
next.control.position = Vec3::new(s_a.hc.0, s_a.hc.1, s_a.hc.2);
next.control.orientation = Quaternion::rotation_x(s_a.hc.3)
* Quaternion::rotation_y(s_a.hc.4)
* Quaternion::rotation_z(s_a.hc.5);
},
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4);
next.control.position = Vec3::new(s_a.stc.0, s_a.stc.1, s_a.stc.2);
next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.sthl.3);
next.control.orientation = Quaternion::rotation_x(s_a.stc.3)
* Quaternion::rotation_y(s_a.stc.4)
* Quaternion::rotation_z(s_a.stc.5);
},
Some(ToolKind::Bow) => {
next.hand_l.position = Vec3::new(s_a.bhl.0, s_a.bhl.1, s_a.bhl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3);
next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
next.hold.position = Vec3::new(0.0, -1.0, -5.2);
next.hold.orientation = Quaternion::rotation_x(-1.57);
next.hold.scale = Vec3::one() * 1.0;
next.control.position = Vec3::new(s_a.bc.0, s_a.bc.1, s_a.bc.2);
next.control.orientation =
Quaternion::rotation_y(s_a.bc.4) * Quaternion::rotation_z(s_a.bc.5);
},
Some(ToolKind::Debug) => {
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.main.position = Vec3::new(-5.0, 5.0, 23.0);
next.main.orientation = Quaternion::rotation_x(3.14);
},
Some(ToolKind::Farming) => {
next.hand_l.position = Vec3::new(9.0, 1.0, 1.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57);
next.hand_r.position = Vec3::new(9.0, 1.0, 11.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57);
next.main.position = Vec3::new(7.5, 7.5, 13.2);
next.main.orientation = Quaternion::rotation_y(3.14);
next.control.position = Vec3::new(-11.0, 1.8, 4.0);
},
_ => {},
(_, _) => {},
}
} else if mirror > 0.0 {
next.hand_r.position = Vec3::new(

View File

@ -230,7 +230,29 @@ impl Animation for SwimAnimation {
) * Quaternion::rotation_y(tilt * 8.0)
* Quaternion::rotation_z(tilt * 8.0);
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
match hands {
(Some(Hands::One), _) => match active_tool_kind {
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
next.main.position = Vec3::new(-4.0, -5.0, 10.0);
next.main.orientation =
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(1.57);
},
_ => {},
},
(_, _) => {},
};
match hands {
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
next.second.position = Vec3::new(4.0, -5.5, 10.0);
next.second.orientation =
Quaternion::rotation_y(-2.35) * Quaternion::rotation_z(1.57);
},
_ => {},
},
(_, _) => {},
};
next.second.scale = match hands {
(Some(Hands::One), Some(Hands::One)) => Vec3::one(),
(_, _) => Vec3::zero(),

View File

@ -2,7 +2,10 @@ use super::{
super::{vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{comp::item::ToolKind, util::Dir};
use common::{
comp::item::{Hands, ToolKind},
util::Dir,
};
use std::{f32::consts::PI, ops::Mul};
pub struct WieldAnimation;
@ -10,6 +13,7 @@ pub struct WieldAnimation;
type WieldAnimationDependency = (
Option<ToolKind>,
Option<ToolKind>,
(Option<Hands>, Option<Hands>),
Vec3<f32>,
Vec3<f32>,
Dir,
@ -30,6 +34,7 @@ impl Animation for WieldAnimation {
(
active_tool_kind,
_second_tool_kind,
hands,
orientation,
last_ori,
look_dir,
@ -43,7 +48,7 @@ impl Animation for WieldAnimation {
*rate = 1.0;
let lab: f32 = 1.0;
let speed = Vec2::<f32>::from(velocity).magnitude();
let speednorm = speed / 9.5;
let mut next = (*skeleton).clone();
let head_look = Vec2::new(
(global_time + anim_time / 3.0).floor().mul(7331.0).sin() * 0.2,
@ -87,8 +92,17 @@ impl Animation for WieldAnimation {
} * 1.25)
* 4.0;
let jump = if velocity.z == 0.0 { 0.0 } else { 1.0 };
// next.second.scale = match hands {
// (Some(Hands::One), Some(Hands::One)) => Vec3::one(),
// (_, _) => Vec3::zero(),
// };
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_z(0.0);
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_z(0.0);
if speed > 0.2 && velocity.z == 0.0 {
next.chest.orientation = Quaternion::rotation_z(short * 0.1 + strafe * 0.7)
next.chest.orientation = Quaternion::rotation_z(short * 0.1 + strafe * 0.7 * speednorm)
* Quaternion::rotation_y(strafe * 0.2)
* Quaternion::rotation_x(((direction * 0.8).min(0.3)) * (1.0 - tilt.abs()));
next.head.orientation =
@ -97,18 +111,14 @@ impl Animation for WieldAnimation {
(0.3 - direction * 0.4) * (1.0 - tilt.abs()) + look_dir.z * 0.7,
);
next.chest.position = Vec3::new(
0.0 + short * strafe,
s_a.chest.0,
s_a.chest.1 + shortalt * -1.5,
);
next.chest.position =
Vec3::new(short * strafe, s_a.chest.0, s_a.chest.1 + shortalt * -1.5);
} else {
next.head.position = Vec3::new(0.0, 0.0 + s_a.head.0, s_a.head.1 + u_slow * 0.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + u_slow * 0.1);
next.head.orientation = Quaternion::rotation_z(head_look.x + tilt * -0.75)
* Quaternion::rotation_x(head_look.y.abs() + look_dir.z * 0.7);
next.chest.position =
Vec3::new(0.0 + slowalt * 0.5, s_a.chest.0, s_a.chest.1 + u_slow * 0.5);
next.chest.position = Vec3::new(slowalt * 0.5, s_a.chest.0, s_a.chest.1 + u_slow * 0.5);
next.belt.orientation = Quaternion::rotation_z(0.15 + beltstatic * tilt * 0.1);
next.shorts.orientation = Quaternion::rotation_z(0.3 + beltstatic * tilt * 0.2);
@ -141,190 +151,187 @@ impl Animation for WieldAnimation {
next.back.orientation = Quaternion::rotation_x(-0.2);
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
}
match active_tool_kind {
Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2 + direction * -5.0);
next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + u_slow * 0.15)
* Quaternion::rotation_z(u_slowalt * 0.08);
},
Some(ToolKind::Dagger) => {
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.control_l.position = Vec3::new(-7.0, 0.0, 0.0);
next.hand_r.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.control_r.position = Vec3::new(7.0, 0.0, 0.0);
},
Some(ToolKind::Axe) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
if speed < 0.5 {
next.head.position =
Vec3::new(0.0, 0.0 + s_a.head.0, s_a.head.1 + u_slow * 0.1);
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(0.35 + head_look.y.abs() + look_dir.z * 0.7);
next.chest.orientation = Quaternion::rotation_x(-0.35)
* Quaternion::rotation_y(u_slowalt * 0.04)
* Quaternion::rotation_z(0.15);
next.belt.position = Vec3::new(0.0, 1.0 + s_a.belt.0, s_a.belt.1);
next.belt.orientation = Quaternion::rotation_x(0.15)
* Quaternion::rotation_y(u_slowalt * 0.03)
* Quaternion::rotation_z(0.15);
next.shorts.position = Vec3::new(0.0, 1.0 + s_a.shorts.0, s_a.shorts.1);
next.shorts.orientation =
Quaternion::rotation_x(0.15) * Quaternion::rotation_z(0.25);
} else {
}
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2 + direction * -5.0);
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
* Quaternion::rotation_y(s_a.ac.4)
* Quaternion::rotation_z(s_a.ac.5);
},
Some(ToolKind::Hammer) | Some(ToolKind::HammerSimple) | Some(ToolKind::Pick) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.hhl.3) * Quaternion::rotation_y(s_a.hhl.4);
next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.hhr.3) * Quaternion::rotation_y(s_a.hhr.4);
next.control.position = Vec3::new(
s_a.hc.0,
s_a.hc.1 + speed * 0.2,
s_a.hc.2 + speed * 0.8 + direction * -5.0,
);
next.control.orientation = Quaternion::rotation_x(s_a.hc.3 + u_slow * 0.15)
* Quaternion::rotation_y(s_a.hc.4 + speed * -0.04)
* Quaternion::rotation_z(s_a.hc.5 + u_slowalt * 0.07);
},
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
if speed > 0.5 && velocity.z == 0.0 {
next.hand_r.position = Vec3::new(
7.0 + s_a.hand.0 + foothoril * 1.3,
-4.0 + s_a.hand.1 + foothoril * -7.0,
1.0 + s_a.hand.2 - foothoril * 5.5,
);
next.hand_r.orientation = Quaternion::rotation_x(0.6 + footrotl * -1.2)
* Quaternion::rotation_y(footrotl * -0.4);
} else {
next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2);
match hands {
(Some(Hands::Two), _) => match active_tool_kind {
Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => {
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4);
};
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_y(0.0);
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.control.position =
Vec3::new(s_a.stc.0, s_a.stc.1, s_a.stc.2 + direction * -5.0);
next.control.position =
Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2 + direction * -5.0);
next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + u_slow * 0.15)
* Quaternion::rotation_z(u_slowalt * 0.08);
},
Some(ToolKind::Dagger) => {
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.sthl.3);
next.hand_l.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(0.0);
next.control.orientation = Quaternion::rotation_x(s_a.stc.3 + u_slow * 0.1)
* Quaternion::rotation_y(s_a.stc.4)
* Quaternion::rotation_z(s_a.stc.5 + u_slowalt * 0.1);
next.control_l.position = Vec3::new(-7.0, 0.0, 0.0);
next.hand_r.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(0.0);
next.control_r.position = Vec3::new(7.0, 0.0, 0.0);
},
Some(ToolKind::Axe) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
if speed < 0.5 {
next.head.position =
Vec3::new(0.0, 0.0 + s_a.head.0, s_a.head.1 + u_slow * 0.1);
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(0.35 + head_look.y.abs() + look_dir.z * 0.7);
next.chest.orientation = Quaternion::rotation_x(-0.35)
* Quaternion::rotation_y(u_slowalt * 0.04)
* Quaternion::rotation_z(0.15);
next.belt.position = Vec3::new(0.0, 1.0 + s_a.belt.0, s_a.belt.1);
next.belt.orientation = Quaternion::rotation_x(0.15)
* Quaternion::rotation_y(u_slowalt * 0.03)
* Quaternion::rotation_z(0.15);
next.shorts.position = Vec3::new(0.0, 1.0 + s_a.shorts.0, s_a.shorts.1);
next.shorts.orientation =
Quaternion::rotation_x(0.15) * Quaternion::rotation_z(0.25);
} else {
}
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
next.control.position =
Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2 + direction * -5.0);
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
* Quaternion::rotation_y(s_a.ac.4)
* Quaternion::rotation_z(s_a.ac.5);
},
Some(ToolKind::Hammer) | Some(ToolKind::HammerSimple) | Some(ToolKind::Pick) => {
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.hhl.3) * Quaternion::rotation_y(s_a.hhl.4);
next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.hhr.3) * Quaternion::rotation_y(s_a.hhr.4);
next.control.position = Vec3::new(
s_a.hc.0,
s_a.hc.1 + speed * 0.2,
s_a.hc.2 + speed * 0.8 + direction * -5.0,
);
next.control.orientation = Quaternion::rotation_x(s_a.hc.3 + u_slow * 0.15)
* Quaternion::rotation_y(s_a.hc.4 + speed * -0.04)
* Quaternion::rotation_z(s_a.hc.5 + u_slowalt * 0.07);
},
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
if speed > 0.5 && velocity.z == 0.0 {
next.hand_r.position = Vec3::new(
7.0 + s_a.hand.0 + foothoril * 1.3,
-4.0 + s_a.hand.1 + foothoril * -7.0,
1.0 + s_a.hand.2 - foothoril * 5.5,
);
next.hand_r.orientation = Quaternion::rotation_x(0.6 + footrotl * -1.2)
* Quaternion::rotation_y(footrotl * -0.4);
} else {
next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4);
};
next.control.position =
Vec3::new(s_a.stc.0, s_a.stc.1, s_a.stc.2 + direction * -5.0);
next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.sthl.3);
next.control.orientation = Quaternion::rotation_x(s_a.stc.3 + u_slow * 0.1)
* Quaternion::rotation_y(s_a.stc.4)
* Quaternion::rotation_z(s_a.stc.5 + u_slowalt * 0.1);
},
Some(ToolKind::Bow) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.bhl.0, s_a.bhl.1, s_a.bhl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3);
next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
next.hold.position = Vec3::new(0.0, -1.0, -5.2);
next.hold.orientation = Quaternion::rotation_x(-1.57);
next.hold.scale = Vec3::one() * 1.0;
next.control.position =
Vec3::new(s_a.bc.0, s_a.bc.1, s_a.bc.2 + direction * -5.0);
next.control.orientation = Quaternion::rotation_x(u_slow * 0.06)
* Quaternion::rotation_y(s_a.bc.4)
* Quaternion::rotation_z(s_a.bc.5 + u_slowalt * 0.1);
},
Some(ToolKind::Debug) => {
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.main.position = Vec3::new(-5.0, 5.0, 23.0);
next.main.orientation = Quaternion::rotation_x(PI);
},
Some(ToolKind::Farming) => {
if speed < 0.5 {
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(-0.2 + head_look.y.abs() + look_dir.z * 0.7);
}
next.hand_l.position = Vec3::new(9.0, 1.0, 1.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57);
next.hand_r.position = Vec3::new(9.0, 1.0, 11.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57);
next.main.position = Vec3::new(7.5, 7.5, 13.2);
next.main.orientation = Quaternion::rotation_y(3.14);
next.control.position = Vec3::new(-11.0 + slow * 2.0, 1.8, 4.0);
next.control.orientation = Quaternion::rotation_x(u_slow * 0.1)
* Quaternion::rotation_y(0.6 + u_slow * 0.1)
* Quaternion::rotation_z(u_slowalt * 0.1);
},
_ => {},
},
Some(ToolKind::Shield) => {
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(0.0 * PI);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0 * PI);
next.control_l.position = Vec3::new(-7.0, 0.0, 0.0);
next.hand_r.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(0.0);
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_x(0.0 * PI);
next.control_r.position = Vec3::new(7.0, 0.0, 0.0);
(_, _) => {},
};
match hands {
(Some(Hands::One), _) => {
next.control_l.position = Vec3::new(-7.0, 8.0, 2.0);
next.control_l.orientation = Quaternion::rotation_x(-0.3);
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
},
Some(ToolKind::Bow) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.bhl.0, s_a.bhl.1, s_a.bhl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3);
next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
next.hold.position = Vec3::new(0.0, -1.0, -5.2);
next.hold.orientation = Quaternion::rotation_x(-1.57);
next.hold.scale = Vec3::one() * 1.0;
next.control.position = Vec3::new(s_a.bc.0, s_a.bc.1, s_a.bc.2 + direction * -5.0);
next.control.orientation = Quaternion::rotation_x(u_slow * 0.06)
* Quaternion::rotation_y(s_a.bc.4)
* Quaternion::rotation_z(s_a.bc.5 + u_slowalt * 0.1);
(_, _) => {},
};
match hands {
(None | Some(Hands::One), Some(Hands::One)) => {
next.control_r.position = Vec3::new(7.0, 8.0, 2.0);
next.control_r.orientation = Quaternion::rotation_x(-0.3);
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
},
Some(ToolKind::Debug) => {
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.main.position = Vec3::new(-5.0, 5.0, 23.0);
next.main.orientation = Quaternion::rotation_x(PI);
(_, _) => {},
};
match hands {
(None, None) | (None, Some(Hands::One)) => {
next.hand_l.position = Vec3::new(-4.5, 8.0, 5.0);
next.hand_l.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(-0.5)
},
Some(ToolKind::Farming) => {
if speed < 0.5 {
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(-0.2 + head_look.y.abs() + look_dir.z * 0.7);
}
next.hand_l.position = Vec3::new(9.0, 1.0, 1.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57);
next.hand_r.position = Vec3::new(9.0, 1.0, 11.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57);
next.main.position = Vec3::new(7.5, 7.5, 13.2);
next.main.orientation = Quaternion::rotation_y(3.14);
next.control.position = Vec3::new(-11.0 + slow * 2.0, 1.8, 4.0);
next.control.orientation = Quaternion::rotation_x(u_slow * 0.1)
* Quaternion::rotation_y(0.6 + u_slow * 0.1)
* Quaternion::rotation_z(u_slowalt * 0.1);
(_, _) => {},
};
match hands {
(None, None) | (Some(Hands::One), None) => {
next.hand_r.position = Vec3::new(4.5, 8.0, 5.0);
next.hand_r.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5)
},
_ => {},
}
(_, _) => {},
};
next
}
}

View File

@ -78,8 +78,23 @@ impl State {
let inventory = inventories.get(client.entity());
let stats = client.state().ecs().read_storage::<common::comp::Stats>();
let stat = stats.get(client.entity());
let should_be_present = if let (Some(inventory), Some(stat)) = (inventory, stat) {
inventory.equipped(EquipSlot::Mainhand).map_or(false, |i| {
let hands =
|equip_slot| match inventory.and_then(|i| i.equipped(equip_slot).map(|i| i.kind())) {
Some(ItemKind::Tool(tool)) => Some(tool.hands),
_ => None,
};
let equip_slot = match (hands(EquipSlot::Mainhand), hands(EquipSlot::Offhand)) {
(Some(_), _) => Some(EquipSlot::Mainhand),
(_, Some(_)) => Some(EquipSlot::Offhand),
_ => None,
};
let should_be_present = if let (Some(inventory), Some(stat), Some(equip_slot)) =
(inventory, stat, equip_slot)
{
inventory.equipped(equip_slot).map_or(false, |i| {
i.item_config_expect()
.abilities
.abilities
@ -126,8 +141,9 @@ impl State {
let (equip_slot, skill_index) = match (active_tool_hands, second_tool_hands) {
(Some(Hands::Two), _) => (Some(EquipSlot::Mainhand), 1),
(_, Some(Hands::One)) => (Some(EquipSlot::Offhand), 0),
(Some(_), Some(Hands::One)) => (Some(EquipSlot::Offhand), 0),
(Some(Hands::One), _) => (Some(EquipSlot::Mainhand), 1),
(None, Some(_)) => (Some(EquipSlot::Offhand), 1),
(_, _) => (None, 0),
};

View File

@ -563,8 +563,9 @@ impl<'a> Widget for Skillbar<'a> {
let equip_slot = match (active_tool_hands, second_tool_hands) {
(Some(Hands::Two), _) => Some(EquipSlot::Mainhand),
(_, Some(Hands::One)) => Some(EquipSlot::Offhand),
(Some(_), Some(Hands::One)) => Some(EquipSlot::Offhand),
(Some(Hands::One), _) => Some(EquipSlot::Mainhand),
(None, Some(_)) => Some(EquipSlot::Offhand),
(_, _) => None,
};
@ -661,27 +662,31 @@ impl<'a> Widget for Skillbar<'a> {
.w_h(40.0, 40.0)
.right_from(state.ids.slot5, slot_offset)
.set(state.ids.m1_slot_bg, ui);
Button::image(
match self
.inventory
.equipped(EquipSlot::Mainhand)
.map(|i| i.kind())
{
Some(ItemKind::Tool(Tool { kind, .. })) => match kind {
ToolKind::Sword => self.imgs.twohsword_m1,
ToolKind::Dagger => self.imgs.onehdagger_m1,
ToolKind::Shield => self.imgs.onehshield_m1,
ToolKind::Hammer => self.imgs.twohhammer_m1,
ToolKind::Axe => self.imgs.twohaxe_m1,
ToolKind::Bow => self.imgs.bow_m1,
ToolKind::Sceptre => self.imgs.skill_sceptre_lifesteal,
ToolKind::Staff => self.imgs.fireball,
ToolKind::Debug => self.imgs.flyingrod_m1,
_ => self.imgs.nothing,
},
_ => self.imgs.nothing,
},
) // Insert Icon here
let active_tool = get_item_and_tool(self.inventory, EquipSlot::Mainhand);
let second_tool = get_item_and_tool(self.inventory, EquipSlot::Offhand);
let tool = match (
active_tool.map(|(_, x)| x.hands),
second_tool.map(|(_, x)| x.hands),
) {
(Some(_), _) => active_tool,
(_, Some(_)) => second_tool,
(_, _) => None,
};
Button::image(match tool.map(|(_, t)| t.kind) {
Some(ToolKind::Sword) => self.imgs.twohsword_m1,
Some(ToolKind::Dagger) => self.imgs.onehdagger_m1,
Some(ToolKind::Shield) => self.imgs.onehshield_m1,
Some(ToolKind::Hammer) => self.imgs.twohhammer_m1,
Some(ToolKind::Axe) => self.imgs.twohaxe_m1,
Some(ToolKind::Bow) => self.imgs.bow_m1,
Some(ToolKind::Sceptre) => self.imgs.skill_sceptre_lifesteal,
Some(ToolKind::Staff) => self.imgs.fireball,
Some(ToolKind::Debug) => self.imgs.flyingrod_m1,
_ => self.imgs.nothing,
}) // Insert Icon here
.w_h(36.0, 36.0)
.middle_of(state.ids.m1_slot_bg)
.set(state.ids.m1_content, ui);
@ -709,8 +714,9 @@ impl<'a> Widget for Skillbar<'a> {
second_tool.map(|(_, x)| x.hands),
) {
(Some(Hands::Two), _) => active_tool,
(_, Some(Hands::One)) => second_tool,
(Some(_), Some(Hands::One)) => second_tool,
(Some(Hands::One), _) => active_tool,
(None, Some(_)) => second_tool,
(_, _) => None,
};

View File

@ -144,14 +144,26 @@ impl<'a> SlotKey<HotbarSource<'a>, HotbarImageSource<'a>> for HotbarSlot {
.map(|item| HotbarImage::Item(item.into()))
.map(|i| (i, None)),
hotbar::SlotContents::Ability3 => {
let tool = match inventory
.equipped(EquipSlot::Mainhand)
.map(|i| (i, i.kind()))
{
Some((item, ItemKind::Tool(tool))) => Some((item, tool)),
let hands = |equip_slot| match inventory.equipped(equip_slot).map(|i| i.kind()) {
Some(ItemKind::Tool(tool)) => Some(tool.hands),
_ => None,
};
let active_tool_hands = hands(EquipSlot::Mainhand);
let second_tool_hands = hands(EquipSlot::Offhand);
let equip_slot = match (active_tool_hands, second_tool_hands) {
(Some(_), _) => Some(EquipSlot::Mainhand),
(None, Some(_)) => Some(EquipSlot::Offhand),
(_, _) => None,
};
let tool =
equip_slot.and_then(|es| match inventory.equipped(es).map(|i| (i, i.kind())) {
Some((item, ItemKind::Tool(tool))) => Some((item, tool)),
_ => None,
});
tool.and_then(|(item, tool)| {
hotbar_image(tool.kind).map(|i| {
(
@ -184,8 +196,9 @@ impl<'a> SlotKey<HotbarSource<'a>, HotbarImageSource<'a>> for HotbarSlot {
let (equip_slot, skill_index) = match (active_tool_hands, second_tool_hands) {
(Some(Hands::Two), _) => (Some(EquipSlot::Mainhand), 1),
(_, Some(Hands::One)) => (Some(EquipSlot::Offhand), 0),
(Some(_), Some(Hands::One)) => (Some(EquipSlot::Offhand), 0),
(Some(Hands::One), _) => (Some(EquipSlot::Mainhand), 1),
(None, Some(_)) => (Some(EquipSlot::Offhand), 1),
(_, _) => (None, 0),
};

View File

@ -897,11 +897,9 @@ impl FigureMgr {
anim::character::AlphaAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
second_tool_kind,
rel_vel.magnitude(),
time,
hands,
Some(s.stage_section),
Some(s.static_data.ability_info),
),
stage_progress,
&mut state_animation_rate,
@ -991,11 +989,11 @@ impl FigureMgr {
anim::character::ChargeswingAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
second_tool_kind,
hands,
rel_vel,
time,
Some(s.stage_section),
Some(s.static_data.ability_info),
),
stage_progress,
&mut state_animation_rate,
@ -1054,13 +1052,7 @@ impl FigureMgr {
CharacterState::Boost(_) => {
anim::character::AlphaAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
second_tool_kind,
rel_vel.magnitude(),
time,
None,
),
(hands, None, None),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
@ -1086,10 +1078,10 @@ impl FigureMgr {
anim::character::DashAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
second_tool_kind,
hands,
time,
Some(s.stage_section),
Some(s.static_data.ability_info),
),
stage_progress,
&mut state_animation_rate,
@ -1153,39 +1145,31 @@ impl FigureMgr {
)
},
CharacterState::LeapMelee(s) => {
let stage_progress = match active_tool_kind {
Some(ToolKind::Axe | ToolKind::Hammer) => {
let stage_time = s.timer.as_secs_f32();
match s.stage_section {
StageSection::Buildup => {
stage_time
/ s.static_data.buildup_duration.as_secs_f32()
},
StageSection::Movement => {
stage_time
/ s.static_data.movement_duration.as_secs_f32()
},
StageSection::Swing => {
stage_time / s.static_data.swing_duration.as_secs_f32()
},
StageSection::Recover => {
stage_time
/ s.static_data.recover_duration.as_secs_f32()
},
_ => 0.0,
}
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()
},
_ => state.state_time,
StageSection::Movement => {
stage_time / s.static_data.movement_duration.as_secs_f32()
},
StageSection::Swing => {
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::character::LeapAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
second_tool_kind,
hands,
rel_vel,
time,
Some(s.stage_section),
Some(s.static_data.ability_info),
),
stage_progress,
&mut state_animation_rate,
@ -1193,35 +1177,28 @@ impl FigureMgr {
)
},
CharacterState::SpinMelee(s) => {
let stage_progress = match active_tool_kind {
Some(ToolKind::Axe | ToolKind::Sword) => {
let stage_time = s.timer.as_secs_f32();
match s.stage_section {
StageSection::Buildup => {
stage_time
/ s.static_data.buildup_duration.as_secs_f32()
},
StageSection::Swing => {
stage_time / s.static_data.swing_duration.as_secs_f32()
},
StageSection::Recover => {
stage_time
/ s.static_data.recover_duration.as_secs_f32()
},
_ => 0.0,
}
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()
},
_ => state.state_time,
StageSection::Swing => {
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::character::SpinMeleeAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
second_tool_kind,
hands,
rel_vel,
time,
Some(s.stage_section),
Some(s.static_data.ability_info),
),
stage_progress,
&mut state_animation_rate,
@ -1249,6 +1226,7 @@ impl FigureMgr {
(
active_tool_kind,
second_tool_kind,
hands,
rel_vel.magnitude(),
time,
Some(s.stage_section),
@ -1266,6 +1244,7 @@ impl FigureMgr {
(
active_tool_kind,
second_tool_kind,
hands,
rel_vel.magnitude(),
time,
Some(s.stage_section),
@ -1359,11 +1338,9 @@ impl FigureMgr {
1 => anim::character::AlphaAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
second_tool_kind,
rel_vel.magnitude(),
time,
hands,
Some(s.stage_section),
Some(s.static_data.ability_info),
),
stage_progress,
&mut state_animation_rate,
@ -1372,11 +1349,11 @@ impl FigureMgr {
2 => anim::character::SpinAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
second_tool_kind,
hands,
rel_vel,
time,
Some(s.stage_section),
Some(s.static_data.ability_info),
),
stage_progress,
&mut state_animation_rate,
@ -1385,11 +1362,11 @@ impl FigureMgr {
_ => anim::character::BetaAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
second_tool_kind,
hands,
rel_vel.magnitude(),
time,
Some(s.stage_section),
Some(s.static_data.ability_info),
),
stage_progress,
&mut state_animation_rate,
@ -1453,6 +1430,7 @@ impl FigureMgr {
(
active_tool_kind,
second_tool_kind,
hands,
// TODO: Update to use the quaternion.
ori * anim::vek::Vec3::<f32>::unit_y(),
state.last_ori * anim::vek::Vec3::<f32>::unit_y(),
@ -3602,6 +3580,38 @@ impl FigureMgr {
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::biped_large::StunnedAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
rel_vel,
state.acc_vel,
Some(s.stage_section),
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
)
},
}
},
CharacterState::Blink(s) => {
let stage_time = s.timer.as_secs_f32();