mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Separated out energy cost for healing so it's not based off of the energy regen from dealing damage.
This commit is contained in:
parent
3734fafcd8
commit
67eafdabd0
@ -161,6 +161,7 @@ pub enum CharacterAbility {
|
||||
max_angle: f32,
|
||||
lifesteal_eff: f32,
|
||||
energy_regen: u32,
|
||||
energy_drain: u32,
|
||||
},
|
||||
}
|
||||
|
||||
@ -529,6 +530,7 @@ impl From<&CharacterAbility> for CharacterState {
|
||||
max_angle,
|
||||
lifesteal_eff,
|
||||
energy_regen,
|
||||
energy_drain,
|
||||
} => CharacterState::BasicBeam(basic_beam::Data {
|
||||
exhausted: false,
|
||||
particle_ori: None::<Vec3<f32>>,
|
||||
@ -543,6 +545,7 @@ impl From<&CharacterAbility> for CharacterState {
|
||||
max_angle: *max_angle,
|
||||
lifesteal_eff: *lifesteal_eff,
|
||||
energy_regen: *energy_regen,
|
||||
energy_drain: *energy_drain,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ pub struct Properties {
|
||||
pub heal: u32,
|
||||
pub lifesteal_eff: f32,
|
||||
pub energy_regen: u32,
|
||||
pub energy_drain: u32,
|
||||
pub duration: Duration,
|
||||
pub owner: Option<Uid>,
|
||||
}
|
||||
|
@ -313,7 +313,8 @@ impl Tool {
|
||||
range: 25.0,
|
||||
max_angle: 1.0,
|
||||
lifesteal_eff: 0.25,
|
||||
energy_regen: 100,
|
||||
energy_regen: 50,
|
||||
energy_drain: 100,
|
||||
},
|
||||
BasicRanged {
|
||||
energy_cost: 800,
|
||||
|
@ -35,8 +35,10 @@ pub struct Data {
|
||||
/// Lifesteal efficiency (0 gives 0% conversion of damage to health, 1 gives
|
||||
/// 100% conversion of damage to health)
|
||||
pub lifesteal_eff: f32,
|
||||
/// Energy regened per second
|
||||
/// Energy regened per second for damage ticks
|
||||
pub energy_regen: u32,
|
||||
/// Energy consumed per second for heal ticks
|
||||
pub energy_drain: u32,
|
||||
}
|
||||
|
||||
impl CharacterBehavior for Data {
|
||||
@ -70,11 +72,13 @@ impl CharacterBehavior for Data {
|
||||
max_angle: self.max_angle,
|
||||
lifesteal_eff: self.lifesteal_eff,
|
||||
energy_regen: self.energy_regen,
|
||||
energy_drain: self.energy_drain,
|
||||
});
|
||||
} else if data.inputs.primary.is_pressed() && !self.exhausted {
|
||||
let damage = (self.base_dps as f32 / self.tick_rate) as u32;
|
||||
let heal = (self.base_hps as f32 / self.tick_rate) as u32;
|
||||
let energy = (self.energy_regen as f32 / self.tick_rate) as u32;
|
||||
let energy_regen = (self.energy_regen as f32 / self.tick_rate) as u32;
|
||||
let energy_drain = (self.energy_drain as f32 / self.tick_rate) as u32;
|
||||
let speed = self.range / self.beam_duration.as_secs_f32();
|
||||
let properties = beam::Properties {
|
||||
angle: self.max_angle.to_radians(),
|
||||
@ -82,7 +86,8 @@ impl CharacterBehavior for Data {
|
||||
damage,
|
||||
heal,
|
||||
lifesteal_eff: self.lifesteal_eff,
|
||||
energy_regen: energy,
|
||||
energy_regen,
|
||||
energy_drain,
|
||||
duration: self.beam_duration,
|
||||
owner: Some(*data.uid),
|
||||
};
|
||||
@ -108,6 +113,7 @@ impl CharacterBehavior for Data {
|
||||
max_angle: self.max_angle,
|
||||
lifesteal_eff: self.lifesteal_eff,
|
||||
energy_regen: self.energy_regen,
|
||||
energy_drain: self.energy_drain,
|
||||
});
|
||||
} else if data.inputs.primary.is_pressed() && self.cooldown_duration != Duration::default()
|
||||
{
|
||||
@ -129,6 +135,7 @@ impl CharacterBehavior for Data {
|
||||
max_angle: self.max_angle,
|
||||
lifesteal_eff: self.lifesteal_eff,
|
||||
energy_regen: self.energy_regen,
|
||||
energy_drain: self.energy_drain,
|
||||
});
|
||||
} else if data.inputs.primary.is_pressed() {
|
||||
update.character = CharacterState::BasicBeam(Data {
|
||||
@ -145,6 +152,7 @@ impl CharacterBehavior for Data {
|
||||
max_angle: self.max_angle,
|
||||
lifesteal_eff: self.lifesteal_eff,
|
||||
energy_regen: self.energy_regen,
|
||||
energy_drain: self.energy_drain,
|
||||
});
|
||||
} else if self.recover_duration != Duration::default() {
|
||||
// Recovery
|
||||
@ -165,6 +173,7 @@ impl CharacterBehavior for Data {
|
||||
max_angle: self.max_angle,
|
||||
lifesteal_eff: self.lifesteal_eff,
|
||||
energy_regen: self.energy_regen,
|
||||
energy_drain: self.energy_drain,
|
||||
});
|
||||
} else {
|
||||
// Done
|
||||
|
@ -220,7 +220,7 @@ impl<'a> System<'a> for Sys {
|
||||
{
|
||||
if energy_mut
|
||||
.try_change_by(
|
||||
-(beam.energy_regen as i32 * 2), // Stamina use
|
||||
-(beam.energy_drain as i32), // Stamina use
|
||||
EnergySource::Ability,
|
||||
)
|
||||
.is_ok()
|
||||
|
Loading…
Reference in New Issue
Block a user