Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change tower damage constant types for easier use #469

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading