Particles for healing aura

This commit is contained in:
Sam 2021-07-13 20:54:43 -05:00
parent 146f86be2c
commit 997da21001
5 changed files with 34 additions and 11 deletions

View File

@ -802,7 +802,7 @@
],
threshold: 0.2,
),
HealingBeam: (
SceptreBeam: (
files: [
"voxygen.audio.sfx.abilities.sceptre_channeling",
],

View File

@ -52,7 +52,7 @@ const int LEAF = 10;
const int FIREFLY = 11;
const int BEE = 12;
const int GROUND_SHOCKWAVE = 13;
const int HEALING_BEAM = 14;
const int ENERGY_HEALING = 14;
const int ENERGY_NATURE = 15;
const int FLAMETHROWER = 16;
const int FIRE_SHOCKWAVE = 17;
@ -380,13 +380,14 @@ void main() {
spin_in_axis(vec3(1,0,0),0)
);
break;
case HEALING_BEAM:
case ENERGY_HEALING:
f_reflect = 0.0;
float spiral_radius = start_end(1 - pow(abs(rand5), 5), 1) * length(inst_dir);
attr = Attr(
spiral_motion(inst_dir, 0.3 * (floor(2 * rand0 + 0.5) - 0.5) * min(linear_scale(10), 1), lifetime / inst_lifespan, 10.0, inst_time),
vec3((1.7 - 0.7 * abs(floor(2 * rand0 - 0.5) + 0.5)) * (1.5 + 0.5 * sin(tick.x * 10 - lifetime * 4))),
vec4(vec3(0.4, 1.6 + 0.3 * sin(tick.x * 10 - lifetime * 3 + 4), 1.0 + 0.15 * sin(tick.x * 5 - lifetime * 5)), 1 /*0.3*/),
spin_in_axis(inst_dir, tick.z)
spiral_motion(vec3(0, 0, rand3 + 1), spiral_radius, lifetime, abs(rand0), rand1 * 2 * PI) + vec3(0, 0, rand2),
vec3(6 * abs(rand4) * (1 - slow_start(2)) * pow(spiral_radius / length(inst_dir), 0.5)),
vec4(vec3(0, 1.7, 0.7), 1),
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3)
);
break;
case LIFESTEAL_BEAM:
@ -402,7 +403,7 @@ void main() {
break;
case ENERGY_NATURE:
f_reflect = 0.0;
float spiral_radius = start_end(1 - pow(abs(rand5), 5), 1) * length(inst_dir);
spiral_radius = start_end(1 - pow(abs(rand5), 5), 1) * length(inst_dir);
attr = Attr(
spiral_motion(vec3(0, 0, rand3 + 1), spiral_radius, lifetime, abs(rand0), rand1 * 2 * PI) + vec3(0, 0, rand2),
vec3(6 * abs(rand4) * (1 - slow_start(2)) * pow(spiral_radius / length(inst_dir), 0.5)),

View File

@ -175,7 +175,7 @@ pub enum SfxEvent {
Parry,
Block,
BreakBlock,
HealingBeam,
SceptreBeam,
SkillPointGain,
ArrowHit,
ArrowMiss,
@ -481,7 +481,7 @@ impl SfxMgr {
Outcome::Beam { pos, specifier } => match specifier {
beam::FrontendSpecifier::LifestealBeam => {
if thread_rng().gen_bool(0.5) {
let sfx_trigger_item = triggers.get_key_value(&SfxEvent::HealingBeam);
let sfx_trigger_item = triggers.get_key_value(&SfxEvent::SceptreBeam);
audio.emit_sfx(sfx_trigger_item, *pos, None, false);
};
},

View File

@ -64,7 +64,7 @@ pub enum ParticleMode {
Firefly = 11,
Bee = 12,
GroundShockwave = 13,
HealingBeam = 14,
EnergyHealing = 14,
EnergyNature = 15,
FlameThrower = 16,
FireShockwave = 17,

View File

@ -942,6 +942,28 @@ impl ParticleMgr {
},
);
},
aura::AuraKind::Buff {
kind: buff::BuffKind::Regeneration,
..
} => {
let heartbeats = self.scheduler.heartbeats(Duration::from_millis(5));
self.particles.resize_with(
self.particles.len()
+ aura.radius.powi(2) as usize * usize::from(heartbeats) / 300,
|| {
let rand_dist = aura.radius * (1.0 - rng.gen::<f32>().powi(100));
let init_pos = Vec3::new(rand_dist, 0_f32, 0_f32);
let max_dur = Duration::from_secs(1);
Particle::new_directed(
aura.duration.map_or(max_dur, |dur| dur.min(max_dur)),
time,
ParticleMode::EnergyHealing,
pos.0,
pos.0 + init_pos,
)
},
);
},
_ => {},
}
}