From 27e309fb19f1e73e32d690c76b190abf637c4577 Mon Sep 17 00:00:00 2001
From: juliancoffee <lightdarkdaughter@gmail.com>
Date: Fri, 18 Jun 2021 18:40:25 +0300
Subject: [PATCH 1/6] Use Golem Shockwave only after loosing 30% health

+ Make shockwave buildup longer
---
 .../common/abilities/custom/claygolem/shockwave.ron |  2 +-
 server/src/sys/agent.rs                             | 13 +++++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/assets/common/abilities/custom/claygolem/shockwave.ron b/assets/common/abilities/custom/claygolem/shockwave.ron
index 5a88d9f395..b06bb052d4 100644
--- a/assets/common/abilities/custom/claygolem/shockwave.ron
+++ b/assets/common/abilities/custom/claygolem/shockwave.ron
@@ -1,6 +1,6 @@
 Shockwave(
     energy_cost: 0,
-    buildup_duration: 0.6,
+    buildup_duration: 1.5,
     swing_duration: 0.12,
     recover_duration: 1.2,
     damage: 500,
diff --git a/server/src/sys/agent.rs b/server/src/sys/agent.rs
index fb4f013f69..86afd4dbe8 100644
--- a/server/src/sys/agent.rs
+++ b/server/src/sys/agent.rs
@@ -3477,6 +3477,9 @@ impl<'a> AgentData<'a> {
         const GOLEM_LONG_RANGE: f32 = 50.0;
         const GOLEM_TARGET_SPEED: f32 = 8.0;
         let golem_melee_range = self.body.map_or(0.0, |b| b.radius()) + GOLEM_MELEE_RANGE;
+        // Fraction of health, used for activation of shockwave
+        // If golem don't have health for some reason, assume it's full
+        let health_fraction = self.health.map_or(1.0, |h| h.fraction());
         // Magnitude squared of cross product of target velocity with golem orientation
         let target_speed_cross_sqd = agent
             .target
@@ -3517,8 +3520,9 @@ impl<'a> AgentData<'a> {
                 controller
                     .actions
                     .push(ControlAction::basic_input(InputKind::Secondary));
-            } else {
-                // Else target moving too fast for laser, shockwave time
+            } else if health_fraction < 0.7 {
+                // Else target moving too fast for laser, shockwave time.
+                // But only if damaged enough
                 controller
                     .actions
                     .push(ControlAction::basic_input(InputKind::Ability(0)));
@@ -3536,8 +3540,9 @@ impl<'a> AgentData<'a> {
                 controller
                     .actions
                     .push(ControlAction::basic_input(InputKind::Ability(1)));
-            } else {
-                // Else target moving too fast for laser, shockwave time
+            } else if health_fraction < 0.7 {
+                // Else target moving too fast for laser, shockwave time.
+                // But only if damaged enough
                 controller
                     .actions
                     .push(ControlAction::basic_input(InputKind::Ability(0)));

From 97167a94d047dc06bd3d0395417512e8688c1ea0 Mon Sep 17 00:00:00 2001
From: juliancoffee <lightdarkdaughter@gmail.com>
Date: Fri, 18 Jun 2021 20:30:12 +0300
Subject: [PATCH 2/6] Load ori_rate for BasicBeam from assets

+ make fire turret ori_rate slower
---
 .../common/abilities/custom/basilisk/petrify.ron   |  3 ++-
 .../custom/birdlargebreathe/flamethrower.ron       |  3 ++-
 .../custom/birdlargefire/flamethrower.ron          |  3 ++-
 assets/common/abilities/custom/claygolem/laser.ron |  3 ++-
 .../common/abilities/custom/claygolem/rocket.ron   |  6 +++---
 .../abilities/custom/claygolem/shockwave.ron       |  4 ++--
 .../abilities/custom/mindflayer/cursedflames.ron   |  3 ++-
 .../abilities/custom/quadlowbeam/healingbeam.ron   |  3 ++-
 .../custom/quadlowbreathe/flamethrower.ron         |  3 ++-
 .../abilities/custom/tidalwarrior/bubbles.ron      |  1 +
 .../abilities/custom/turret/flamethrower.ron       |  3 ++-
 .../common/abilities/custom/yeti/frostbreath.ron   |  3 ++-
 assets/common/abilities/sceptre/lifestealbeam.ron  |  3 ++-
 assets/common/abilities/staff/flamethrower.ron     |  3 ++-
 .../common/abilities/staffsimple/flamethrower.ron  |  1 +
 common/src/comp/ability.rs                         |  3 +++
 common/src/states/basic_beam.rs                    | 14 ++++++--------
 17 files changed, 38 insertions(+), 24 deletions(-)

diff --git a/assets/common/abilities/custom/basilisk/petrify.ron b/assets/common/abilities/custom/basilisk/petrify.ron
index c8fb5b3021..b8691b25fa 100644
--- a/assets/common/abilities/custom/basilisk/petrify.ron
+++ b/assets/common/abilities/custom/basilisk/petrify.ron
@@ -15,5 +15,6 @@ BasicBeam(
     energy_regen: 0,
     energy_drain: 0,
     orientation_behavior: Normal,
+    ori_rate: 0.6,
     specifier: Cultist,
-)
\ No newline at end of file
+)
diff --git a/assets/common/abilities/custom/birdlargebreathe/flamethrower.ron b/assets/common/abilities/custom/birdlargebreathe/flamethrower.ron
index 4bf507fa86..1cb6d4fdf8 100644
--- a/assets/common/abilities/custom/birdlargebreathe/flamethrower.ron
+++ b/assets/common/abilities/custom/birdlargebreathe/flamethrower.ron
@@ -10,5 +10,6 @@ BasicBeam(
     energy_regen: 0,
     energy_drain: 0,
     orientation_behavior: Normal,
+    ori_rate: 0.6,
     specifier: Flamethrower,
-)
\ No newline at end of file
+)
diff --git a/assets/common/abilities/custom/birdlargefire/flamethrower.ron b/assets/common/abilities/custom/birdlargefire/flamethrower.ron
index 4bf507fa86..1cb6d4fdf8 100644
--- a/assets/common/abilities/custom/birdlargefire/flamethrower.ron
+++ b/assets/common/abilities/custom/birdlargefire/flamethrower.ron
@@ -10,5 +10,6 @@ BasicBeam(
     energy_regen: 0,
     energy_drain: 0,
     orientation_behavior: Normal,
+    ori_rate: 0.6,
     specifier: Flamethrower,
-)
\ No newline at end of file
+)
diff --git a/assets/common/abilities/custom/claygolem/laser.ron b/assets/common/abilities/custom/claygolem/laser.ron
index 8e029678d4..c5e6fac8b0 100644
--- a/assets/common/abilities/custom/claygolem/laser.ron
+++ b/assets/common/abilities/custom/claygolem/laser.ron
@@ -10,5 +10,6 @@ BasicBeam(
     energy_regen: 50,
     energy_drain: 0,
     orientation_behavior: FromOri,
+    ori_rate: 0.1,
     specifier: ClayGolem,
-)
\ No newline at end of file
+)
diff --git a/assets/common/abilities/custom/claygolem/rocket.ron b/assets/common/abilities/custom/claygolem/rocket.ron
index 852a4db918..c58011bfb1 100644
--- a/assets/common/abilities/custom/claygolem/rocket.ron
+++ b/assets/common/abilities/custom/claygolem/rocket.ron
@@ -1,11 +1,11 @@
 BasicRanged(
     energy_cost: 0,
-    buildup_duration: 0.5,
-    recover_duration: 0.8,
+    buildup_duration: 0.8,
+    recover_duration: 0.5,
     projectile: ClayRocket(
         damage: 500.0,
         knockback: 25.0,
-        radius: 10.0,
+        radius: 5.0,
     ),
     projectile_body: Object(ClayRocket),
     projectile_light: None,
diff --git a/assets/common/abilities/custom/claygolem/shockwave.ron b/assets/common/abilities/custom/claygolem/shockwave.ron
index b06bb052d4..ac4b9a8ae1 100644
--- a/assets/common/abilities/custom/claygolem/shockwave.ron
+++ b/assets/common/abilities/custom/claygolem/shockwave.ron
@@ -9,9 +9,9 @@ Shockwave(
     shockwave_angle: 180.0,
     shockwave_vertical_angle: 90.0,
     shockwave_speed: 15.0,
-    shockwave_duration: 2.5,
+    shockwave_duration: 3.5,
     requires_ground: true,
     move_efficiency: 0.0,
     damage_kind: Crushing,
     specifier: Ground,
-)
\ No newline at end of file
+)
diff --git a/assets/common/abilities/custom/mindflayer/cursedflames.ron b/assets/common/abilities/custom/mindflayer/cursedflames.ron
index 9d83b5a243..0cfddbd5f5 100644
--- a/assets/common/abilities/custom/mindflayer/cursedflames.ron
+++ b/assets/common/abilities/custom/mindflayer/cursedflames.ron
@@ -15,5 +15,6 @@ BasicBeam(
     energy_regen: 0,
     energy_drain: 0,
     orientation_behavior: Normal,
+    ori_rate: 0.6,
     specifier: Cultist,
-)
\ No newline at end of file
+)
diff --git a/assets/common/abilities/custom/quadlowbeam/healingbeam.ron b/assets/common/abilities/custom/quadlowbeam/healingbeam.ron
index 6776a79944..2aba7a0d1b 100644
--- a/assets/common/abilities/custom/quadlowbeam/healingbeam.ron
+++ b/assets/common/abilities/custom/quadlowbeam/healingbeam.ron
@@ -10,5 +10,6 @@ BasicBeam(
     energy_regen: 25,
     energy_drain: 0,
     orientation_behavior: Normal,
+    ori_rate: 0.6,
     specifier: HealingBeam,
-)
\ No newline at end of file
+)
diff --git a/assets/common/abilities/custom/quadlowbreathe/flamethrower.ron b/assets/common/abilities/custom/quadlowbreathe/flamethrower.ron
index ddc09e0ef6..5eba0f6226 100644
--- a/assets/common/abilities/custom/quadlowbreathe/flamethrower.ron
+++ b/assets/common/abilities/custom/quadlowbreathe/flamethrower.ron
@@ -10,5 +10,6 @@ BasicBeam(
     energy_regen: 0,
     energy_drain: 0,
     orientation_behavior: Normal,
+    ori_rate: 0.6,
     specifier: Flamethrower,
-)
\ No newline at end of file
+)
diff --git a/assets/common/abilities/custom/tidalwarrior/bubbles.ron b/assets/common/abilities/custom/tidalwarrior/bubbles.ron
index 65cbadc67c..737e144574 100644
--- a/assets/common/abilities/custom/tidalwarrior/bubbles.ron
+++ b/assets/common/abilities/custom/tidalwarrior/bubbles.ron
@@ -15,5 +15,6 @@ BasicBeam(
     energy_regen: 0,
     energy_drain: 0,
     orientation_behavior: Normal,
+    ori_rate: 0.6,
     specifier: Bubbles,
 )
diff --git a/assets/common/abilities/custom/turret/flamethrower.ron b/assets/common/abilities/custom/turret/flamethrower.ron
index 3814d1f235..33f5dc51c9 100644
--- a/assets/common/abilities/custom/turret/flamethrower.ron
+++ b/assets/common/abilities/custom/turret/flamethrower.ron
@@ -15,5 +15,6 @@ BasicBeam(
     energy_regen: 0,
     energy_drain: 0,
     orientation_behavior: Normal,
+    ori_rate: 0.3,
     specifier: Flamethrower,
-)
\ No newline at end of file
+)
diff --git a/assets/common/abilities/custom/yeti/frostbreath.ron b/assets/common/abilities/custom/yeti/frostbreath.ron
index 826f59bbcb..67e16b78ff 100644
--- a/assets/common/abilities/custom/yeti/frostbreath.ron
+++ b/assets/common/abilities/custom/yeti/frostbreath.ron
@@ -15,5 +15,6 @@ BasicBeam(
     energy_regen: 0,
     energy_drain: 0,
     orientation_behavior: Normal,
+    ori_rate: 0.6,
     specifier: Frost,
-)
\ No newline at end of file
+)
diff --git a/assets/common/abilities/sceptre/lifestealbeam.ron b/assets/common/abilities/sceptre/lifestealbeam.ron
index 0484fef1c4..994e959b1d 100644
--- a/assets/common/abilities/sceptre/lifestealbeam.ron
+++ b/assets/common/abilities/sceptre/lifestealbeam.ron
@@ -10,5 +10,6 @@ BasicBeam(
     energy_regen: 50,
     energy_drain: 0,
     orientation_behavior: Normal,
+    ori_rate: 0.6,
     specifier: LifestealBeam
-)
\ No newline at end of file
+)
diff --git a/assets/common/abilities/staff/flamethrower.ron b/assets/common/abilities/staff/flamethrower.ron
index c3c491b94a..82fa30d8f8 100644
--- a/assets/common/abilities/staff/flamethrower.ron
+++ b/assets/common/abilities/staff/flamethrower.ron
@@ -15,5 +15,6 @@ BasicBeam(
     energy_regen: 0,
     energy_drain: 350,
     orientation_behavior: Normal,
+    ori_rate: 0.6,
     specifier: Flamethrower,
-)
\ No newline at end of file
+)
diff --git a/assets/common/abilities/staffsimple/flamethrower.ron b/assets/common/abilities/staffsimple/flamethrower.ron
index 4842fdd20f..14eead7fa6 100644
--- a/assets/common/abilities/staffsimple/flamethrower.ron
+++ b/assets/common/abilities/staffsimple/flamethrower.ron
@@ -10,5 +10,6 @@ BasicBeam(
     energy_regen: 0,
     energy_drain: 350,
     orientation_behavior: Normal,
+    ori_rate: 0.6,
     specifier: Flamethrower,
 )
diff --git a/common/src/comp/ability.rs b/common/src/comp/ability.rs
index f755fe58d5..4d5c4aaf50 100644
--- a/common/src/comp/ability.rs
+++ b/common/src/comp/ability.rs
@@ -247,6 +247,7 @@ pub enum CharacterAbility {
         energy_regen: f32,
         energy_drain: f32,
         orientation_behavior: basic_beam::OrientationBehavior,
+        ori_rate: f32,
         specifier: beam::FrontendSpecifier,
     },
     BasicAura {
@@ -1651,6 +1652,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
                 energy_regen,
                 energy_drain,
                 orientation_behavior,
+                ori_rate,
                 specifier,
             } => CharacterState::BasicBeam(basic_beam::Data {
                 static_data: basic_beam::StaticData {
@@ -1666,6 +1668,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
                     energy_drain: *energy_drain,
                     ability_info,
                     orientation_behavior: *orientation_behavior,
+                    ori_rate: *ori_rate,
                     specifier: *specifier,
                 },
                 timer: Duration::default(),
diff --git a/common/src/states/basic_beam.rs b/common/src/states/basic_beam.rs
index defb22f81f..31080f42c0 100644
--- a/common/src/states/basic_beam.rs
+++ b/common/src/states/basic_beam.rs
@@ -40,6 +40,8 @@ pub struct StaticData {
     pub energy_drain: f32,
     /// Used to dictate how orientation functions in this state
     pub orientation_behavior: OrientationBehavior,
+    /// How fast enemy can rotate with beam
+    pub ori_rate: f32,
     /// What key is used to press ability
     pub ability_info: AbilityInfo,
     /// Used to specify the beam to the frontend
@@ -61,14 +63,10 @@ impl CharacterBehavior for Data {
     fn behavior(&self, data: &JoinData) -> StateUpdate {
         let mut update = StateUpdate::from(data);
 
-        let ori_rate = match self.static_data.orientation_behavior {
-            OrientationBehavior::Normal => 0.6,
-            OrientationBehavior::Turret => {
-                update.ori = Ori::from(data.inputs.look_dir);
-                0.6
-            },
-            OrientationBehavior::FromOri => 0.1,
-        };
+        let ori_rate = self.static_data.ori_rate;
+        if self.static_data.orientation_behavior == OrientationBehavior::Turret {
+            update.ori = Ori::from(data.inputs.look_dir);
+        }
 
         handle_orientation(data, &mut update, ori_rate);
         handle_move(data, &mut update, 0.4);

From 0ac97ed156eb38f92144fc3845a1f9f2df56cb29 Mon Sep 17 00:00:00 2001
From: juliancoffee <lightdarkdaughter@gmail.com>
Date: Fri, 18 Jun 2021 22:03:39 +0300
Subject: [PATCH 3/6] Nerf golem laser dmg and ori_rate, make it fire

+ Make laser state duration lower
---
 assets/common/abilities/custom/claygolem/laser.ron  | 11 ++++++++---
 assets/common/abilities/custom/claygolem/strike.ron |  2 +-
 server/src/sys/agent.rs                             |  4 ++--
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/assets/common/abilities/custom/claygolem/laser.ron b/assets/common/abilities/custom/claygolem/laser.ron
index c5e6fac8b0..c93f0f7ce8 100644
--- a/assets/common/abilities/custom/claygolem/laser.ron
+++ b/assets/common/abilities/custom/claygolem/laser.ron
@@ -2,14 +2,19 @@ BasicBeam(
     buildup_duration: 0.5,
     recover_duration: 0.4,
     beam_duration: 0.25,
-    damage: 100,
+    damage: 70,
     tick_rate: 2.0,
     range: 40.0,
     max_angle: 1.0,
-    damage_effect: None,
+    damage_effect: Some(Buff((
+        kind: Burning,
+        dur_secs: 5.0,
+        strength: DamageFraction(0.75),
+        chance: 0.75,
+    ))),
     energy_regen: 50,
     energy_drain: 0,
     orientation_behavior: FromOri,
-    ori_rate: 0.1,
+    ori_rate: 0.07,
     specifier: ClayGolem,
 )
diff --git a/assets/common/abilities/custom/claygolem/strike.ron b/assets/common/abilities/custom/claygolem/strike.ron
index 08e15584bc..9552e7f2bc 100644
--- a/assets/common/abilities/custom/claygolem/strike.ron
+++ b/assets/common/abilities/custom/claygolem/strike.ron
@@ -1,7 +1,7 @@
 BasicMelee(
     energy_cost: 0,
     buildup_duration: 0.8,
-    swing_duration: 0.2,
+    swing_duration: 0.1,
     recover_duration: 0.5,
     base_damage: 200,
     base_poise_damage: 50,
diff --git a/server/src/sys/agent.rs b/server/src/sys/agent.rs
index 86afd4dbe8..67240676be 100644
--- a/server/src/sys/agent.rs
+++ b/server/src/sys/agent.rs
@@ -3505,7 +3505,7 @@ impl<'a> AgentData<'a> {
                 }
             }
         } else if attack_data.dist_sqrd < GOLEM_LASER_RANGE.powi(2) {
-            if matches!(self.char_state, CharacterState::BasicBeam(c) if c.timer < Duration::from_secs(10))
+            if matches!(self.char_state, CharacterState::BasicBeam(c) if c.timer < Duration::from_secs(5))
                 || target_speed_cross_sqd < GOLEM_TARGET_SPEED.powi(2)
                     && can_see_tgt(
                         &*read_data.terrain,
@@ -3515,7 +3515,7 @@ impl<'a> AgentData<'a> {
                     )
                     && attack_data.angle < 45.0
             {
-                // If target in range threshold and haven't been lasering for more than 10
+                // If target in range threshold and haven't been lasering for more than 5
                 // seconds already or if target is moving slow-ish, laser them
                 controller
                     .actions

From 08ae31fb8b252ff8d384a77047b3a834c4b0203c Mon Sep 17 00:00:00 2001
From: juliancoffee <lightdarkdaughter@gmail.com>
Date: Fri, 18 Jun 2021 22:04:58 +0300
Subject: [PATCH 4/6] tweak clay_golem HP

---
 common/src/comp/body.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/src/comp/body.rs b/common/src/comp/body.rs
index 72a2f4748f..df1500f996 100644
--- a/common/src/comp/body.rs
+++ b/common/src/comp/body.rs
@@ -511,7 +511,7 @@ impl Body {
                 _ => 10000,
             },
             Body::Golem(golem) => match golem.species {
-                golem::Species::ClayGolem => 7500,
+                golem::Species::ClayGolem => 4500,
                 _ => 10000,
             },
             Body::Theropod(theropod) => match theropod.species {
@@ -676,7 +676,7 @@ impl Body {
                 _ => 1.0,
             },
             Body::Golem(g) => match g.species {
-                golem::Species::ClayGolem => 1.2,
+                golem::Species::ClayGolem => 2.0,
                 _ => 1.0,
             },
             _ => 1.0,

From 0fecde103d91a9ed7ac270596bf7158999f9acec Mon Sep 17 00:00:00 2001
From: juliancoffee <lightdarkdaughter@gmail.com>
Date: Fri, 18 Jun 2021 20:04:50 +0300
Subject: [PATCH 5/6] Don't spawn enemies in boss room

---
 world/src/site/dungeon/mod.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/world/src/site/dungeon/mod.rs b/world/src/site/dungeon/mod.rs
index 514c5116de..72f9763664 100644
--- a/world/src/site/dungeon/mod.rs
+++ b/world/src/site/dungeon/mod.rs
@@ -541,7 +541,7 @@ impl Floor {
                         .map(|density| dynamic_rng.gen_range(0..density.recip() as usize) == 0)
                         .unwrap_or(false)
                         && !tile_is_pillar
-                        && !(room.boss && room.difficulty == 5)
+                        && !room.boss
                     {
                         // Randomly displace them a little
                         let raw_entity = EntityInfo::at(

From 9dfa492809eb5f5a6516ccee2bf28bbf21652b21 Mon Sep 17 00:00:00 2001
From: juliancoffee <lightdarkdaughter@gmail.com>
Date: Fri, 18 Jun 2021 22:58:51 +0300
Subject: [PATCH 6/6] Add CHANGELOG

---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 30cc28e9cc..65d10d4099 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,8 +17,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Entity-entity pushback is no longer applied in forced movement states like rolling and leaping.
 - Updated audio library (rodio 0.13 -> 0.14).
 - Improve entity-terrain physics performance by reducing the number of voxel lookups.
+- Clay Golem uses shockwave only after specific fraction of health and other difficulty adjustments.
 
 ### Removed
+- Enemies no more spawn in dungeon boss room
 
 ### Fixed