From a82984b925998cf095f67bc64fbbb71748358459 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 31 May 2021 19:40:25 -0500 Subject: [PATCH] Added base ability set --- Cargo.lock | 10 +++++++ .../common/abilities/ability_set_manifest.ron | 8 ++++++ .../abilities/custom/yeti/frostbreath.ron | 19 ++++++++++++++ .../abilities/custom/yeti/icespikes.ron | 17 ++++++++++++ .../common/abilities/custom/yeti/snowball.ron | 13 ++++++++++ .../common/abilities/custom/yeti/strike.ron | 13 ++++++++++ .../items/npc_weapons/hammer/yeti_hammer.ron | 6 ++--- assets/voxygen/shaders/particle-vert.glsl | 11 ++++++-- common/src/comp/beam.rs | 1 + voxygen/Cargo.toml | 2 +- voxygen/src/audio/sfx/mod.rs | 2 +- voxygen/src/render/pipelines/particle.rs | 1 + voxygen/src/scene/particle.rs | 26 +++++++++++++++++++ 13 files changed, 122 insertions(+), 7 deletions(-) create mode 100644 assets/common/abilities/custom/yeti/frostbreath.ron create mode 100644 assets/common/abilities/custom/yeti/icespikes.ron create mode 100644 assets/common/abilities/custom/yeti/snowball.ron create mode 100644 assets/common/abilities/custom/yeti/strike.ron diff --git a/Cargo.lock b/Cargo.lock index d5e53c4fcf..b4f482a96c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2487,6 +2487,15 @@ dependencies = [ "serde", ] +[[package]] +name = "inline_tweak" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7033e97b20277cc0d043226d1940fa7719ff08d2305d1fc7421e53066d00eb4b" +dependencies = [ + "lazy_static", +] + [[package]] name = "inotify" version = "0.7.1" @@ -6038,6 +6047,7 @@ dependencies = [ "iced_native", "iced_winit", "image", + "inline_tweak", "itertools 0.10.0", "keyboard-keynames", "lazy_static", diff --git a/assets/common/abilities/ability_set_manifest.ron b/assets/common/abilities/ability_set_manifest.ron index 9f3b3f8b26..d9e401f986 100644 --- a/assets/common/abilities/ability_set_manifest.ron +++ b/assets/common/abilities/ability_set_manifest.ron @@ -237,6 +237,14 @@ (None, "common.abilities.custom.claygolem.rocket"), ], ), + Custom("Yeti"): ( + primary: "common.abilities.custom.yeti.strike", + secondary: "common.abilities.custom.yeti.icespikes", + abilities: [ + (None, "common.abilities.custom.yeti.frostbreath"), + (None, "common.abilities.custom.yeti.snowball"), + ], + ), Custom("Bird Large Breathe"): ( primary: "common.abilities.custom.birdlargebreathe.firebomb", secondary: "common.abilities.custom.birdlargebreathe.triplestrike", diff --git a/assets/common/abilities/custom/yeti/frostbreath.ron b/assets/common/abilities/custom/yeti/frostbreath.ron new file mode 100644 index 0000000000..0319a28508 --- /dev/null +++ b/assets/common/abilities/custom/yeti/frostbreath.ron @@ -0,0 +1,19 @@ +BasicBeam( + buildup_duration: 0.4, + recover_duration: 0.25, + beam_duration: 0.5, + damage: 50, + tick_rate: 1.0, + range: 15.0, + max_angle: 22.5, + damage_effect: Some(Buff(( + kind: Frozen, + dur_secs: 3.0, + strength: Value(2.0), + chance: 1.0, + ))), + energy_regen: 0, + energy_drain: 0, + orientation_behavior: Normal, + specifier: Frost, +) \ No newline at end of file diff --git a/assets/common/abilities/custom/yeti/icespikes.ron b/assets/common/abilities/custom/yeti/icespikes.ron new file mode 100644 index 0000000000..889e9daf36 --- /dev/null +++ b/assets/common/abilities/custom/yeti/icespikes.ron @@ -0,0 +1,17 @@ +Shockwave( + energy_cost: 0, + buildup_duration: 0.6, + swing_duration: 0.12, + recover_duration: 1.2, + damage: 300, + poise_damage: 30, + knockback: (strength: 40.0, direction: Up), + shockwave_angle: 90.0, + shockwave_vertical_angle: 15.0, + shockwave_speed: 25.0, + shockwave_duration: 1.0, + requires_ground: false, + move_efficiency: 0.0, + damage_kind: Piercing, + //specifier: IceSpikes, +) \ No newline at end of file diff --git a/assets/common/abilities/custom/yeti/snowball.ron b/assets/common/abilities/custom/yeti/snowball.ron new file mode 100644 index 0000000000..a1f34dd47f --- /dev/null +++ b/assets/common/abilities/custom/yeti/snowball.ron @@ -0,0 +1,13 @@ +BasicRanged( + energy_cost: 0, + buildup_duration: 0.5, + recover_duration: 0.4, + projectile: Frostball( // Snowball + damage: 80.0, + radius: 5.0, + ), + projectile_body: Object(BoltFire), // Snowball + projectile_speed: 30.0, + num_projectiles: 1, + projectile_spread: 0.0, +) diff --git a/assets/common/abilities/custom/yeti/strike.ron b/assets/common/abilities/custom/yeti/strike.ron new file mode 100644 index 0000000000..65201d09bc --- /dev/null +++ b/assets/common/abilities/custom/yeti/strike.ron @@ -0,0 +1,13 @@ +BasicMelee( + energy_cost: 0, + buildup_duration: 0.8, + swing_duration: 0.2, + recover_duration: 0.5, + base_damage: 150, + base_poise_damage: 50, + knockback: 30.0, + range: 4.0, + max_angle: 20.0, + damage_effect: None, + damage_kind: Crushing, +) diff --git a/assets/common/items/npc_weapons/hammer/yeti_hammer.ron b/assets/common/items/npc_weapons/hammer/yeti_hammer.ron index d906f684c9..e4aa790a5a 100644 --- a/assets/common/items/npc_weapons/hammer/yeti_hammer.ron +++ b/assets/common/items/npc_weapons/hammer/yeti_hammer.ron @@ -5,8 +5,8 @@ ItemDef( kind: Hammer, hands: Two, stats: Direct(( - equip_time_secs: 0.0, - power: 2.0, + equip_time_secs: 0.01, + power: 1.0, poise_strength: 1.0, speed: 1.0, crit_chance: 0.046875, @@ -15,5 +15,5 @@ ItemDef( )), quality: Low, tags: [], - ability_spec: Some(Custom("Hammer Simple")), + ability_spec: Some(Custom("Yeti")), ) \ No newline at end of file diff --git a/assets/voxygen/shaders/particle-vert.glsl b/assets/voxygen/shaders/particle-vert.glsl index a74f714892..612049dc64 100644 --- a/assets/voxygen/shaders/particle-vert.glsl +++ b/assets/voxygen/shaders/particle-vert.glsl @@ -144,6 +144,12 @@ vec3 perp_axis2(vec3 axis1, vec3 axis2) { return normalize(vec3(axis1.y * axis2.z - axis1.z * axis2.y, axis1.z * axis2.x - axis1.x * axis2.z, axis1.x * axis2.y - axis1.y * axis2.x)); } +// Line is the axis of the spiral, it goes from the start position to the end position +// Radius is the distance from the axis the particle is +// Time function is some value that ideally goes from 0 to 1. When it is 0, it is as +// the point (0, 0, 0), when it is 1, it is at the point provided by the coordinates of line +// Frequency increases the frequency of rotation +// Offset is an offset to the angle of the rotation vec3 spiral_motion(vec3 line, float radius, float time_function, float frequency, float offset) { vec3 axis2 = perp_axis1(line); vec3 axis3 = perp_axis2(line, axis2); @@ -420,10 +426,11 @@ void main() { break; case ICE: f_reflect = 0.0; // Ice doesn't reflect to look like magic + float ice_color = 1.9 + rand5 * 0.3; attr = Attr( inst_dir * ((rand0+1.0)/2 + 0.4) * slow_end(2.0) + 0.3 * grav_vel(earth_gravity), - vec3((3 * (1 - slow_start(0.1)))), - vec4(0.2, 1.6 + rand5 * 0.3 - 0.4 * percent(), 3, 1), + vec3((5 * (1 - slow_start(.1)))), + vec4(0.8 * ice_color, 0.9 * ice_color, ice_color, 1), spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9) ); break; diff --git a/common/src/comp/beam.rs b/common/src/comp/beam.rs index 50e056ad1b..9111c35453 100644 --- a/common/src/comp/beam.rs +++ b/common/src/comp/beam.rs @@ -54,4 +54,5 @@ pub enum FrontendSpecifier { Cultist, ClayGolem, Bubbles, + Frost, } diff --git a/voxygen/Cargo.toml b/voxygen/Cargo.toml index 90c691354e..940f13cb00 100644 --- a/voxygen/Cargo.toml +++ b/voxygen/Cargo.toml @@ -104,7 +104,7 @@ treeculler = "0.2" tokio = { version = "1", default-features = false, features = ["rt-multi-thread"] } num_cpus = "1.0" # vec_map = { version = "0.8.2" } -# inline_tweak = "1.0.2" +inline_tweak = "1.0.2" itertools = "0.10.0" # Tracy diff --git a/voxygen/src/audio/sfx/mod.rs b/voxygen/src/audio/sfx/mod.rs index d5e8eda3af..161c1a187f 100644 --- a/voxygen/src/audio/sfx/mod.rs +++ b/voxygen/src/audio/sfx/mod.rs @@ -403,7 +403,7 @@ impl SfxMgr { audio.emit_sfx(sfx_trigger_item, *pos, None, false); } }, - beam::FrontendSpecifier::ClayGolem | beam::FrontendSpecifier::Bubbles => {}, + beam::FrontendSpecifier::ClayGolem | beam::FrontendSpecifier::Bubbles | beam::FrontendSpecifier::Frost => {}, }, Outcome::BreakBlock { pos, .. } => { let sfx_trigger_item = triggers.get_key_value(&SfxEvent::BreakBlock); diff --git a/voxygen/src/render/pipelines/particle.rs b/voxygen/src/render/pipelines/particle.rs index 5f3944d607..e067f906f3 100644 --- a/voxygen/src/render/pipelines/particle.rs +++ b/voxygen/src/render/pipelines/particle.rs @@ -81,6 +81,7 @@ pub enum ParticleMode { Laser = 28, Bubbles = 29, Water = 30, + IceSpikes = 31, } impl ParticleMode { diff --git a/voxygen/src/scene/particle.rs b/voxygen/src/scene/particle.rs index 5b6ae849bc..4f5b61453e 100644 --- a/voxygen/src/scene/particle.rs +++ b/voxygen/src/scene/particle.rs @@ -855,6 +855,32 @@ impl ParticleMgr { }, ); }, + beam::FrontendSpecifier::Frost => { + let mut rng = thread_rng(); + use inline_tweak::tweak; + let (from, to) = (Vec3::::unit_z(), *ori.look_dir()); + let m = Mat3::::rotation_from_to_3d(from, to); + self.particles.resize_with( + self.particles.len() + usize::from(beam_tick_count) / tweak!(4), + || { + let phi: f32 = rng.gen_range(0.0..beam.properties.angle); + let theta: f32 = rng.gen_range(0.0..2.0 * PI); + let offset_z = Vec3::new( + phi.sin() * theta.cos(), + phi.sin() * theta.sin(), + phi.cos(), + ); + let random_ori = offset_z * m * Vec3::new(-1.0, -1.0, 1.0); + Particle::new_directed( + beam.properties.duration, + time, + ParticleMode::Ice, + pos.0, + pos.0 + random_ori * range, + ) + }, + ); + }, } } }