Changed M2 Sceptre from a beam to a hitscan

This commit is contained in:
gGmMsS123 2021-04-22 12:28:13 +03:00
parent 132f3275fa
commit 6c2d73c357
3 changed files with 12 additions and 9 deletions

View File

@ -268,7 +268,6 @@ pub enum CharacterAbility {
buildup_duration: f32,
recover_duration: f32,
max_range: f32,
// TODO: Replace with effect when targeted system created
heal: f32,
},
}
@ -1625,13 +1624,13 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
CharacterAbility::TargetedEffect {
buildup_duration,
recover_duration,
max_range,
} => CharacterState::TargetedEffect(targeted_effect::Data {
max_range, heal } => CharacterState::TargetedEffect(targeted_effect::Data {
static_data: targeted_effect::StaticData {
buildup_duration: Duration::from_secs_f32(*buildup_duration),
recover_duration: Duration::from_secs_f32(*recover_duration),
max_range: *max_range,
ability_info,
heal,
},
timer: Duration::default(),
stage_section: StageSection::Buildup,

View File

@ -35,6 +35,10 @@ pub enum LocalEvent {
#[allow(clippy::large_enum_variant)] // TODO: Pending review in #587
pub enum ServerEvent {
HealthChange {
entity: EcsEntity,
change: comp::HealthChange,
},
Explosion {
pos: Vec3<f32>,
explosion: Explosion,

View File

@ -1,5 +1,5 @@
use crate::{
comp::{CharacterState, StateUpdate},
comp::{CharacterState, HealthSource, StateUpdate, HealthChange},
event::ServerEvent,
states::{
behavior::{CharacterBehavior, JoinData},
@ -20,6 +20,8 @@ pub struct StaticData {
pub max_range: f32,
/// Miscellaneous information about the ability
pub ability_info: AbilityInfo,
/// Heal
pub heal: HealthChange,
}
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
@ -32,7 +34,6 @@ pub struct Data {
/// What section the character stage is in
pub stage_section: StageSection,
}
impl CharacterBehavior for Data {
fn behavior(&self, data: &JoinData) -> StateUpdate {
let mut update = StateUpdate::from(data);
@ -56,11 +57,10 @@ impl CharacterBehavior for Data {
entity: target,
change: HealthChange {
amount: self.static_data.heal as i32,
cause: HealthSource::Heal { by: Some(data.uid) },
})};
cause: HealthSource::Heal { by: Some(*data.uid) },
}});
}
}
}
// Transitions to recover section of stage
update.character = CharacterState::TargetedEffect(Data {
timer: Duration::default(),
@ -92,4 +92,4 @@ impl CharacterBehavior for Data {
update
}
}
}