mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Add healing aura for sceptre M2
This commit is contained in:
parent
7b7d0c0504
commit
b4ec433509
@ -79,7 +79,7 @@
|
||||
),
|
||||
Tool(Sceptre): (
|
||||
primary: "common.abilities.sceptre.lifestealbeam",
|
||||
secondary: "common.abilities.sceptre.healingbeam",
|
||||
secondary: "common.abilities.sceptre.healingaura",
|
||||
abilities: [
|
||||
(Some(Sceptre(UnlockAura)), "common.abilities.sceptre.wardingaura"),
|
||||
],
|
||||
|
17
assets/common/abilities/sceptre/healingaura.ron
Normal file
17
assets/common/abilities/sceptre/healingaura.ron
Normal file
@ -0,0 +1,17 @@
|
||||
BasicAura(
|
||||
buildup_duration: 0.25,
|
||||
cast_duration: 0.5,
|
||||
recover_duration: 0.25,
|
||||
targets: InGroup,
|
||||
aura: (
|
||||
kind: Regeneration,
|
||||
strength: 4.0,
|
||||
duration: Some(10.0),
|
||||
category: Magical,
|
||||
),
|
||||
aura_duration: 1.0,
|
||||
range: 25.0,
|
||||
energy_cost: 200,
|
||||
scales_with_combo: true,
|
||||
specifier: HealingAura,
|
||||
)
|
@ -12,4 +12,6 @@ BasicAura(
|
||||
aura_duration: 1.0,
|
||||
range: 25.0,
|
||||
energy_cost: 400,
|
||||
scales_with_combo: false,
|
||||
specifier: WardingAura,
|
||||
)
|
@ -260,6 +260,8 @@ pub enum CharacterAbility {
|
||||
aura_duration: f32,
|
||||
range: f32,
|
||||
energy_cost: f32,
|
||||
scales_with_combo: bool,
|
||||
specifier: aura::FrontendSpecifier,
|
||||
},
|
||||
HealingBeam {
|
||||
buildup_duration: f32,
|
||||
@ -352,7 +354,6 @@ impl CharacterAbility {
|
||||
| CharacterAbility::ChargedRanged { energy_cost, .. }
|
||||
| CharacterAbility::ChargedMelee { energy_cost, .. }
|
||||
| CharacterAbility::Shockwave { energy_cost, .. }
|
||||
| CharacterAbility::BasicAura { energy_cost, .. }
|
||||
| CharacterAbility::BasicBlock { energy_cost, .. }
|
||||
| CharacterAbility::SelfBuff { energy_cost, .. } => update
|
||||
.energy
|
||||
@ -369,6 +370,17 @@ impl CharacterAbility {
|
||||
.try_change_by(-(*energy_cost as i32), EnergySource::Ability)
|
||||
.is_ok()
|
||||
},
|
||||
CharacterAbility::BasicAura {
|
||||
energy_cost,
|
||||
scales_with_combo,
|
||||
..
|
||||
} => {
|
||||
((*scales_with_combo && data.combo.counter() > 0) | !*scales_with_combo)
|
||||
&& update
|
||||
.energy
|
||||
.try_change_by(-(*energy_cost as i32), EnergySource::Ability)
|
||||
.is_ok()
|
||||
},
|
||||
CharacterAbility::HealingBeam { .. } => data.combo.counter() > 0,
|
||||
CharacterAbility::ComboMelee { .. }
|
||||
| CharacterAbility::Boost { .. }
|
||||
@ -711,6 +723,8 @@ impl CharacterAbility {
|
||||
aura_duration: _,
|
||||
ref mut range,
|
||||
ref mut energy_cost,
|
||||
scales_with_combo: _,
|
||||
specifier: _,
|
||||
} => {
|
||||
*buildup_duration /= stats.speed;
|
||||
*cast_duration /= stats.speed;
|
||||
@ -1330,21 +1344,36 @@ impl CharacterAbility {
|
||||
ref mut aura,
|
||||
ref mut range,
|
||||
ref mut energy_cost,
|
||||
ref specifier,
|
||||
..
|
||||
} => {
|
||||
if let Ok(Some(level)) = skillset.skill_level(Sceptre(AStrength)) {
|
||||
aura.strength *= 1.15_f32.powi(level.into());
|
||||
}
|
||||
if let Ok(Some(level)) = skillset.skill_level(Sceptre(ADuration)) {
|
||||
if let Some(ref mut duration) = aura.duration {
|
||||
*duration *= 1.2_f32.powi(level.into());
|
||||
if matches!(*specifier, aura::FrontendSpecifier::WardingAura) {
|
||||
if let Ok(Some(level)) = skillset.skill_level(Sceptre(AStrength)) {
|
||||
aura.strength *= 1.15_f32.powi(level.into());
|
||||
}
|
||||
if let Ok(Some(level)) = skillset.skill_level(Sceptre(ADuration)) {
|
||||
aura.duration.map(|dur| dur * 1.2_f32.powi(level.into()));
|
||||
}
|
||||
if let Ok(Some(level)) = skillset.skill_level(Sceptre(ARange)) {
|
||||
*range *= 1.25_f32.powi(level.into());
|
||||
}
|
||||
if let Ok(Some(level)) = skillset.skill_level(Sceptre(ACost)) {
|
||||
*energy_cost *= 0.85_f32.powi(level.into());
|
||||
}
|
||||
} else if matches!(*specifier, aura::FrontendSpecifier::HealingAura) {
|
||||
if let Ok(Some(level)) = skillset.skill_level(Sceptre(HHeal)) {
|
||||
aura.strength *= 1.15_f32.powi(level.into());
|
||||
}
|
||||
if let Ok(Some(level)) = skillset.skill_level(Sceptre(ADuration)) {
|
||||
//TODO: make a proper healing duration ability
|
||||
aura.duration.map(|dur| dur * 1.2_f32.powi(level.into()));
|
||||
}
|
||||
if let Ok(Some(level)) = skillset.skill_level(Sceptre(HRange)) {
|
||||
*range *= 1.25_f32.powi(level.into());
|
||||
}
|
||||
if let Ok(Some(level)) = skillset.skill_level(Sceptre(HCost)) {
|
||||
*energy_cost *= 0.85_f32.powi(level.into());
|
||||
}
|
||||
}
|
||||
if let Ok(Some(level)) = skillset.skill_level(Sceptre(ARange)) {
|
||||
*range *= 1.25_f32.powi(level.into());
|
||||
}
|
||||
if let Ok(Some(level)) = skillset.skill_level(Sceptre(ACost)) {
|
||||
*energy_cost *= 0.85_f32.powi(level.into());
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
@ -1852,6 +1881,8 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
||||
aura_duration,
|
||||
range,
|
||||
energy_cost: _,
|
||||
scales_with_combo,
|
||||
specifier,
|
||||
} => CharacterState::BasicAura(basic_aura::Data {
|
||||
static_data: basic_aura::StaticData {
|
||||
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
||||
@ -1862,6 +1893,8 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
||||
aura_duration: Duration::from_secs_f32(*aura_duration),
|
||||
range: *range,
|
||||
ability_info,
|
||||
scales_with_combo: *scales_with_combo,
|
||||
specifier: *specifier,
|
||||
},
|
||||
timer: Duration::default(),
|
||||
stage_section: StageSection::Buildup,
|
||||
|
@ -71,6 +71,12 @@ pub enum AuraTarget {
|
||||
All,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
pub enum FrontendSpecifier {
|
||||
WardingAura,
|
||||
HealingAura,
|
||||
}
|
||||
|
||||
impl From<(Option<GroupTarget>, Option<&Uid>)> for AuraTarget {
|
||||
fn from((target, uid): (Option<GroupTarget>, Option<&Uid>)) -> Self {
|
||||
match (target, uid) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
combat::GroupTarget,
|
||||
comp::{
|
||||
aura::{AuraBuffConstructor, AuraChange, AuraTarget},
|
||||
aura::{AuraBuffConstructor, AuraChange, AuraKind, AuraTarget, FrontendSpecifier},
|
||||
CharacterState, StateUpdate,
|
||||
},
|
||||
event::ServerEvent,
|
||||
@ -32,6 +32,10 @@ pub struct StaticData {
|
||||
pub range: f32,
|
||||
/// What key is used to press ability
|
||||
pub ability_info: AbilityInfo,
|
||||
/// Whether the aura's effect scales with the user's current combo
|
||||
pub scales_with_combo: bool,
|
||||
/// Used to specify aura to the frontend
|
||||
pub specifier: FrontendSpecifier,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
@ -71,6 +75,23 @@ impl CharacterBehavior for Data {
|
||||
Some(self.static_data.aura_duration),
|
||||
targets,
|
||||
);
|
||||
if self.static_data.scales_with_combo {
|
||||
let combo = data.combo.counter();
|
||||
match aura.aura_kind {
|
||||
AuraKind::Buff {
|
||||
kind: _,
|
||||
mut data,
|
||||
category: _,
|
||||
source: _,
|
||||
} => {
|
||||
data.strength *= 1.1_f32;
|
||||
},
|
||||
}
|
||||
update.server_events.push_front(ServerEvent::ComboChange {
|
||||
entity: data.entity,
|
||||
change: -(combo as i32),
|
||||
});
|
||||
}
|
||||
update.server_events.push_front(ServerEvent::Aura {
|
||||
entity: data.entity,
|
||||
aura_change: AuraChange::Add(aura),
|
||||
|
Loading…
Reference in New Issue
Block a user