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

View File

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

View File

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