Add charm animation

This commit is contained in:
maxicarlos08 2023-11-22 17:27:09 +01:00 committed by Maxicarlos08
parent 95835887e1
commit 83a24acc1e
No known key found for this signature in database
6 changed files with 50 additions and 8 deletions

View File

@ -2,7 +2,7 @@ ItemDef(
legacy_name: "Blazing Charm",
legacy_description: "Flame is your ally, harness its power to burn your foes.",
kind: Consumable(
kind: Drink,
kind: Charm,
effects: All([
Buff((
kind: Flame,
@ -18,4 +18,4 @@ ItemDef(
),
quality: Legendary,
tags: [],
)
)

View File

@ -2,7 +2,7 @@ ItemDef(
legacy_name: "Freezing Charm",
legacy_description: "Let your enemies feel the sting of cold as you freeze them in their tracks.",
kind: Consumable(
kind: Drink,
kind: Charm,
effects: All([
Buff((
kind: Frigid,
@ -18,4 +18,4 @@ ItemDef(
),
quality: Legendary,
tags: [],
)
)

View File

@ -2,7 +2,7 @@ ItemDef(
legacy_name: "Siphon Charm",
legacy_description: "Siphon your target life and use it for your own.",
kind: Consumable(
kind: Drink,
kind: Charm,
effects: All([
Buff((
kind: Lifesteal,
@ -17,4 +17,4 @@ ItemDef(
),
quality: Legendary,
tags: [],
)
)

View File

@ -370,6 +370,7 @@ pub enum ConsumableKind {
Drink,
Food,
ComplexFood,
Charm,
}
impl ItemKind {

View File

@ -53,7 +53,7 @@ impl CharacterBehavior for Data {
let mut update = StateUpdate::from(data);
match self.static_data.item_kind {
ItemUseKind::Consumable(ConsumableKind::Drink) => {
ItemUseKind::Consumable(ConsumableKind::Drink | ConsumableKind::Charm) => {
handle_orientation(data, &mut update, 1.0, None);
handle_move(data, &mut update, 1.0);
},
@ -67,7 +67,9 @@ impl CharacterBehavior for Data {
ItemUseKind::Consumable(ConsumableKind::Drink | ConsumableKind::Food) => {
UsePoint::BuildupUse
},
ItemUseKind::Consumable(ConsumableKind::ComplexFood) => UsePoint::UseRecover,
ItemUseKind::Consumable(ConsumableKind::ComplexFood | ConsumableKind::Charm) => {
UsePoint::UseRecover
},
};
match self.stage_section {
@ -187,6 +189,11 @@ impl ItemUseKind {
Duration::from_secs_f32(4.5),
Duration::from_secs_f32(0.5),
),
Self::Consumable(ConsumableKind::Charm) => (
Duration::from_secs_f32(0.1),
Duration::from_secs_f32(0.8),
Duration::from_secs_f32(0.1),
),
}
}
}

View File

@ -56,6 +56,40 @@ impl Animation for ConsumeAnimation {
next.hand_l.orientation =
Quaternion::rotation_x(move1 * 0.8) * Quaternion::rotation_y(move1 * -0.5);
},
Some(ItemUseKind::Consumable(ConsumableKind::Charm)) => {
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
Some(StageSection::Action) => (1.0, (anim_time * 6.0).sin(), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(0.25)),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - move3;
let move1 = move1 * pullback;
let move2 = move2 * pullback;
next.head.orientation =
Quaternion::rotation_x(move1 * -0.3) * Quaternion::rotation_z((move2) * 0.25);
next.chest.orientation = Quaternion::rotation_x(move1 * -0.2);
next.shoulder_r.orientation = Quaternion::rotation_x(move1 * 0.7);
next.shoulder_l.orientation = Quaternion::rotation_x(move1 * 0.7);
next.hand_r.position = Vec3::new(
s_a.hand.0 - move1 * 1.5 + move2 * 1.0,
s_a.hand.1 + move1 * 8.0,
s_a.hand.2 + move1 * 4.0,
);
next.hand_l.position = Vec3::new(
-s_a.hand.0 + move1 * 1.5 + move2 * 1.0,
s_a.hand.1 + move1 * 8.0,
s_a.hand.2 + move1 * 4.0,
);
next.hand_r.orientation =
Quaternion::rotation_z(move1 * 0.4) * Quaternion::rotation_x(move1 * 2.3);
next.hand_l.orientation =
Quaternion::rotation_z(move1 * -0.4) * Quaternion::rotation_x(move1 * 2.3);
},
Some(ItemUseKind::Consumable(ConsumableKind::Food | ConsumableKind::ComplexFood)) => {
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),