Struct veloren_common_net::synced_components::Poise
pub struct Poise {
current: u32,
base_max: u32,
maximum: u32,
pub last_change: Dir,
regen_rate: f32,
last_stun_time: Option<Time>,
pub previous_state: PoiseState,
}
Expand description
Poise is represented by u32s within the module, but treated as a float by the rest of the game.
Fields§
§current: u32
§base_max: u32
§maximum: u32
§last_change: Dir
Direction that the last poise change came from
regen_rate: f32
§last_stun_time: Option<Time>
§previous_state: PoiseState
The previous poise state
Implementations§
§impl Poise
impl Poise
pub const POISE_BUFFER_TIME: f64 = 1f64
pub const POISE_BUFFER_TIME: f64 = 1f64
The amount of time after being in a poise state before you can take poise damage again
pub const POISE_EPSILON: f32 = 2.98032319E-8f32
pub const POISE_EPSILON: f32 = 2.98032319E-8f32
Used when comparisons to poise are needed outside this module.
pub const POISE_THRESHOLDS: [f32; 4] = _
pub const POISE_THRESHOLDS: [f32; 4] = _
The thresholds where poise changes to a different state
pub fn update_maximum(&mut self, modifiers: StatsModifier)
pub fn update_maximum(&mut self, modifiers: StatsModifier)
Updates the maximum value for poise
pub fn new(body: Body) -> Poise
pub fn change(&mut self, change: PoiseChange)
pub fn needs_regen(&self) -> bool
pub fn needs_regen(&self) -> bool
Returns true
if the current value is less than the maximum
pub fn regen(&mut self, accel: f32, dt: f32, now: Time)
pub fn regen(&mut self, accel: f32, dt: f32, now: Time)
Regenerates poise based on a provided acceleration
pub fn reset(&mut self, time: Time, poise_state_time: f64)
pub fn knockback(&self) -> Dir
pub fn knockback(&self) -> Dir
Returns knockback as a Dir Kept as helper function should additional fields ever be added to last change
pub fn poise_state(&self) -> PoiseState
pub fn poise_state(&self) -> PoiseState
Defines the poise states based on current poise value
pub fn compute_poise_damage_reduction(
inventory: Option<&Inventory>,
msm: &MaterialStatManifest,
char_state: Option<&CharacterState>,
stats: Option<&Stats>,
) -> f32
pub fn compute_poise_damage_reduction( inventory: Option<&Inventory>, msm: &MaterialStatManifest, char_state: Option<&CharacterState>, stats: Option<&Stats>, ) -> f32
Returns the total poise damage reduction provided by all equipped items
pub fn apply_poise_reduction(
value: f32,
inventory: Option<&Inventory>,
msm: &MaterialStatManifest,
char_state: Option<&CharacterState>,
stats: Option<&Stats>,
) -> f32
pub fn apply_poise_reduction( value: f32, inventory: Option<&Inventory>, msm: &MaterialStatManifest, char_state: Option<&CharacterState>, stats: Option<&Stats>, ) -> f32
Modifies a poise change when optionally given an inventory and character state to aid in calculation of poise damage reduction
Trait Implementations§
§impl<'de> Deserialize<'de> for Poise
impl<'de> Deserialize<'de> for Poise
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Poise, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Poise, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl From<Poise> for EcsCompPacket
impl From<Poise> for EcsCompPacket
source§fn from(other: Poise) -> EcsCompPacket
fn from(other: Poise) -> EcsCompPacket
source§impl NetSync for Poise
impl NetSync for Poise
source§const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity
source§fn pre_insert(&mut self, world: &World)
fn pre_insert(&mut self, world: &World)
source§fn pre_modify(&mut self, world: &World)
fn pre_modify(&mut self, world: &World)
§impl Serialize for Poise
impl Serialize for Poise
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
source§impl TryFrom<EcsCompPacket> for Poise
impl TryFrom<EcsCompPacket> for Poise
impl Copy for Poise
Auto Trait Implementations§
impl Freeze for Poise
impl RefUnwindSafe for Poise
impl Send for Poise
impl Sync for Poise
impl Unpin for Poise
impl UnwindSafe for Poise
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<C, M> ConvertSaveload<M> for C
impl<C, M> ConvertSaveload<M> for C
§type Error = Infallible
type Error = Infallible
§fn convert_into<F>(
&self,
_: F,
) -> Result<<C as ConvertSaveload<M>>::Data, <C as ConvertSaveload<M>>::Error>
fn convert_into<F>( &self, _: F, ) -> Result<<C as ConvertSaveload<M>>::Data, <C as ConvertSaveload<M>>::Error>
Data
) using
entity to marker mapping function§fn convert_from<F>(
data: <C as ConvertSaveload<M>>::Data,
_: F,
) -> Result<C, <C as ConvertSaveload<M>>::Error>
fn convert_from<F>( data: <C as ConvertSaveload<M>>::Data, _: F, ) -> Result<C, <C as ConvertSaveload<M>>::Error>
Data
) using
entity to marker mapping function§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more