Skip to content

Commit

Permalink
Change tower damage constant types for easier use (rustyscreeps#469)
Browse files Browse the repository at this point in the history
  • Loading branch information
shanemadden authored Nov 28, 2023
1 parent be38e3f commit 83bccf8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/constants/numbers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand All @@ -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.
Expand Down

0 comments on commit 83bccf8

Please sign in to comment.