Changed Sceptre M2 from a beam to a hitscan.

This commit is contained in:
gGmMsS123 2021-04-22 10:56:12 +03:00
parent a1d9ba15d9
commit 42cf663747
6 changed files with 40 additions and 15 deletions

View File

@ -1,11 +0,0 @@
HealingBeam(
buildup_duration: 0.25,
recover_duration: 0.25,
beam_duration: 1.0,
heal: 40,
tick_rate: 2.0,
range: 25.0,
max_angle: 1.0,
energy_cost: 75,
specifier: HealingBeam,
)

View File

@ -57,7 +57,7 @@ impl From<&CharacterState> for CharacterAbilityType {
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
pub enum CharacterAbility {
BasicMelee {
energy_cost: f32,
energy_cost: f32,
buildup_duration: f32,
swing_duration: f32,
recover_duration: f32,
@ -70,7 +70,7 @@ pub enum CharacterAbility {
BasicRanged {
energy_cost: f32,
buildup_duration: f32,
recover_duration: f32,
recover_duration: f32,
projectile: ProjectileConstructor,
projectile_body: Body,
projectile_light: Option<LightEmitter>,
@ -264,6 +264,13 @@ pub enum CharacterAbility {
summon_amount: u32,
summon_info: basic_summon::SummonInfo,
},
TargetedEffect {
buildup_duration: f32,
recover_duration: f32,
max_range: f32,
// TODO: Replace with effect when targeted system created
heal: f32,
},
}
impl Default for CharacterAbility {
@ -552,6 +559,14 @@ impl CharacterAbility {
*buildup_duration /= speed;
*recover_duration /= speed;
},
TargetedEffect {
ref mut buildup_duration,
ref mut recover_duration,
..
} => {
*buildup_duration /= speed;
*recover_duration /= speed;
},
BasicSummon {
ref mut buildup_duration,
ref mut cast_duration,
@ -589,7 +604,7 @@ impl CharacterAbility {
0
}
},
BasicBlock | Boost { .. } | ComboMelee { .. } | Blink { .. } | BasicSummon { .. } => 0,
BasicBlock | Boost { .. } | ComboMelee { .. } | Blink { .. } | BasicSummon { .. } | TargetedEffect { .. } => 0,
}
}
@ -1607,6 +1622,20 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
timer: Duration::default(),
stage_section: StageSection::Buildup,
}),
CharacterAbility::TargetedEffect {
buildup_duration,
recover_duration,
max_range,
} => 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,
},
timer: Duration::default(),
stage_section: StageSection::Buildup,
}),
CharacterAbility::BasicSummon {
buildup_duration,
cast_duration,
@ -1626,6 +1655,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
timer: Duration::default(),
stage_section: StageSection::Buildup,
}),
}
}
}

View File

@ -97,11 +97,13 @@ pub enum CharacterState {
Blink(blink::Data),
/// Summons creatures that fight for the caster
BasicSummon(basic_summon::Data),
/// Targets a specific entity
TargetedEffect(targeted_effect::Data),
}
impl CharacterState {
pub fn is_wield(&self) -> bool {
matches!(
matches!(
self,
CharacterState::Wielding
| CharacterState::BasicMelee(_)

View File

@ -29,3 +29,4 @@ pub mod stunned;
pub mod talk;
pub mod utils;
pub mod wielding;
pub mod targeted_effect;

View File

@ -314,6 +314,7 @@ impl<'a> System<'a> for Sys {
CharacterState::HealingBeam(data) => data.handle_event(&j, action),
CharacterState::Blink(data) => data.handle_event(&j, action),
CharacterState::BasicSummon(data) => data.handle_event(&j, action),
CharacterState::TargetedEffect(data) => data.handle_event(&j, action),
};
local_emitter.append(&mut state_update.local_events);
server_emitter.append(&mut state_update.server_events);
@ -368,6 +369,7 @@ impl<'a> System<'a> for Sys {
CharacterState::HealingBeam(data) => data.behavior(&j),
CharacterState::Blink(data) => data.behavior(&j),
CharacterState::BasicSummon(data) => data.behavior(&j),
CharacterState::TargetedEffect(data) => data.behavior(&j),
};
local_emitter.append(&mut state_update.local_events);

View File

@ -248,6 +248,7 @@ impl<'a> System<'a> for Sys {
| CharacterState::BasicAura { .. }
| CharacterState::HealingBeam { .. }
| CharacterState::Blink { .. }
| CharacterState::TargetedEffect { .. }
| CharacterState::BasicSummon { .. } => {
if energy.get_unchecked().regen_rate != 0.0 {
energy.get_mut_unchecked().regen_rate = 0.0