From 83bccf8fa68aa77c6b878a2b001c054e2f0af5fd Mon Sep 17 00:00:00 2001 From: Shane Madden Date: Mon, 27 Nov 2023 19:00:38 -0700 Subject: [PATCH] Change tower damage constant types for easier use (#469) --- CHANGELOG.md | 5 +++++ src/constants/numbers.rs | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46f3c646..3db5dcd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Unreleased ========== +### Breaking: + +- Change `TOWER_OPTIMAL_RANGE` and `TOWER_FALLOFF_RANGE` types to `u8` and `TOWER_FALLOFF` type + to `f64` + ### Bugfixes: - Implement `JsCollectionIntoValue` for `Direction`, making the `JsHashMap` returned by diff --git a/src/constants/numbers.rs b/src/constants/numbers.rs index 1d0c6b8a..5429a8f6 100644 --- a/src/constants/numbers.rs +++ b/src/constants/numbers.rs @@ -398,10 +398,10 @@ pub const TOWER_POWER_HEAL: u32 = 400; pub const TOWER_POWER_REPAIR: u32 = 800; /// Tower actions at a range beyond this distance suffer falloff penalties - see /// [`TOWER_FALLOFF`]. -pub const TOWER_OPTIMAL_RANGE: u32 = 5; +pub const TOWER_OPTIMAL_RANGE: u8 = 5; /// Tower actions at a range greater than or equal to this distance suffer the /// maxium falloff penalties - see [`TOWER_FALLOFF`]. -pub const TOWER_FALLOFF_RANGE: u32 = 20; +pub const TOWER_FALLOFF_RANGE: u8 = 20; /// Maximum percentage reduction in healing, repair, and attack effectiveness /// for towers due to range. /// @@ -415,7 +415,7 @@ pub const TOWER_FALLOFF_RANGE: u32 = 20; /// ``` /// /// [source]: https://github.com/screeps/engine/blob/f02d16a44a00c35615ae227fc72a3c9a07a6a39a/src/processor/intents/towers/attack.js#L38 -pub const TOWER_FALLOFF: f32 = 0.75; +pub const TOWER_FALLOFF: f64 = 0.75; /// Initial hits for observer structures; consider using the /// [`StructureType::initial_hits`] function.