Addressed review

This commit is contained in:
Sam 2023-03-19 20:23:42 -04:00
parent 1301fff800
commit 5c675fdbe2
4 changed files with 21 additions and 22 deletions

View File

@ -280,11 +280,11 @@ impl Ability {
.map(|i| &i.item_config_expect().abilities)
};
let contextual_id = |auxiliary_kind: Option<&'a AbilityKind<_>>| -> Option<&'a str> {
let contextual_id = |kind: Option<&'a AbilityKind<_>>| -> Option<&'a str> {
if let Some(AbilityKind::Contextualized {
pseudo_id,
abilities: _,
}) = auxiliary_kind
}) = kind
{
Some(pseudo_id.as_str())
} else {
@ -2320,9 +2320,6 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
exhausted: false,
start_next_strike: false,
timer: Duration::default(),
// If ability is a stance, if starting from wielding, get ready to enter stance,
// otherwise enter stance immediately, otherwise if not a stance immediately begin
// the strike
stage_section: StageSection::Buildup,
completed_strikes: 0,
}),
@ -2795,7 +2792,7 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
ability_info,
},
timer: Duration::default(),
stage_section: if data.vel.0.z < 0.0 || buildup_duration.is_none() {
stage_section: if data.vel.0.z < -*vertical_speed || buildup_duration.is_none() {
StageSection::Movement
} else {
StageSection::Buildup
@ -2861,6 +2858,7 @@ pub struct AbilityMeta {
#[serde(default)]
pub capabilities: Capability,
#[serde(default)]
/// This is an event that gets emitted when the ability is first activated
pub init_event: Option<AbilityInitEvent>,
#[serde(default)]
pub requirements: AbilityRequirements,
@ -2894,8 +2892,8 @@ bitflags::bitflags! {
#[derive(Default, Serialize, Deserialize)]
// If more are ever needed, first check if any not used anymore, as some were only used in intermediary stages so may be free
pub struct Capability: u8 {
// Allows rolls to interrupt the ability at any point for free, not just during buildup
const ROLL_INTERRUPTS_FREE = 0b00000001;
// There used to be a capability here, to keep ordering the same below this is now a placeholder
const PLACEHOLDER = 0b00000001;
// Allows blocking to interrupt the ability at any point
const BLOCK_INTERRUPT = 0b00000010;
// When the ability is in the buildup section, it counts as a block with 50% DR

View File

@ -341,14 +341,19 @@ impl<T> AbilityKind<T> {
AbilityKind::Contextualized {
pseudo_id: _,
abilities,
} => abilities
.get(&context)
.and_then(|(s, a)| unlocked(*s, a))
.or_else(|| {
abilities
.get(&AbilityContext::None)
.and_then(|(s, a)| unlocked(*s, a))
}),
} => {
// In the event that the ability from the current context is not unlocked with
// the required skill, try falling back to the ability from this input that does
// not require a context
abilities
.get(&context)
.and_then(|(s, a)| unlocked(*s, a))
.or_else(|| {
abilities
.get(&AbilityContext::None)
.and_then(|(s, a)| unlocked(*s, a))
})
},
}
}
}

View File

@ -91,10 +91,6 @@ fn main() -> io::Result<()> {
.unwrap(),
);
// agent and world imported here so that mim-alloc can be used when hot
// reloading these crates without separately declaring mim-alloc as the
// allocator in those crates (doing so causes UB when a vec (and presumably
// other allocations) are passed to a dynlib and resized within that dynlib)
#[cfg(feature = "hot-agent")]
{
agent::init();

View File

@ -3,7 +3,7 @@ use super::{
CharacterSkeleton, SkeletonAttr,
};
use common::states::utils::{AbilityInfo, StageSection};
use core::f32::consts::PI;
use core::f32::consts::{PI, TAU};
pub struct DiveMeleeAnimation;
impl Animation for DiveMeleeAnimation {
@ -70,7 +70,7 @@ impl Animation for DiveMeleeAnimation {
next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5);
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);
next.torso.orientation.rotate_x(move1alt * -6.28);
next.torso.orientation.rotate_x(move1alt * -TAU);
next.torso.orientation.rotate_x(move1 * -0.8);
next.control.orientation.rotate_x(move1 * 1.5);