summaryrefslogtreecommitdiff
path: root/2019-worms/src/constants.rs
diff options
context:
space:
mode:
Diffstat (limited to '2019-worms/src/constants.rs')
-rw-r--r--2019-worms/src/constants.rs218
1 files changed, 218 insertions, 0 deletions
diff --git a/2019-worms/src/constants.rs b/2019-worms/src/constants.rs
new file mode 100644
index 0000000..3f36db4
--- /dev/null
+++ b/2019-worms/src/constants.rs
@@ -0,0 +1,218 @@
+use crate::geometry::Vec2d;
+
+pub mod lava;
+pub use self::lava::*;
+
+pub const MAP_SIZE: usize = 33;
+pub const MAP_ROW_SIZE: [MapRow; MAP_SIZE] = [
+ MapRow {
+ start_bit: 0,
+ x_offset: 11,
+ },
+ MapRow {
+ start_bit: 11,
+ x_offset: 8,
+ },
+ MapRow {
+ start_bit: 28,
+ x_offset: 7,
+ },
+ MapRow {
+ start_bit: 47,
+ x_offset: 6,
+ },
+ MapRow {
+ start_bit: 68,
+ x_offset: 4,
+ },
+ MapRow {
+ start_bit: 93,
+ x_offset: 4,
+ },
+ MapRow {
+ start_bit: 118,
+ x_offset: 3,
+ },
+ MapRow {
+ start_bit: 145,
+ x_offset: 2,
+ },
+ MapRow {
+ start_bit: 174,
+ x_offset: 1,
+ },
+ MapRow {
+ start_bit: 205,
+ x_offset: 1,
+ },
+ MapRow {
+ start_bit: 236,
+ x_offset: 1,
+ },
+ MapRow {
+ start_bit: 267,
+ x_offset: 0,
+ },
+ MapRow {
+ start_bit: 300,
+ x_offset: 0,
+ },
+ MapRow {
+ start_bit: 333,
+ x_offset: 0,
+ },
+ MapRow {
+ start_bit: 366,
+ x_offset: 0,
+ },
+ MapRow {
+ start_bit: 399,
+ x_offset: 0,
+ },
+ MapRow {
+ start_bit: 432,
+ x_offset: 0,
+ },
+ MapRow {
+ start_bit: 465,
+ x_offset: 0,
+ },
+ MapRow {
+ start_bit: 498,
+ x_offset: 0,
+ },
+ MapRow {
+ start_bit: 531,
+ x_offset: 0,
+ },
+ MapRow {
+ start_bit: 564,
+ x_offset: 0,
+ },
+ MapRow {
+ start_bit: 597,
+ x_offset: 0,
+ },
+ MapRow {
+ start_bit: 630,
+ x_offset: 1,
+ },
+ MapRow {
+ start_bit: 661,
+ x_offset: 1,
+ },
+ MapRow {
+ start_bit: 692,
+ x_offset: 1,
+ },
+ MapRow {
+ start_bit: 723,
+ x_offset: 2,
+ },
+ MapRow {
+ start_bit: 752,
+ x_offset: 3,
+ },
+ MapRow {
+ start_bit: 779,
+ x_offset: 4,
+ },
+ MapRow {
+ start_bit: 804,
+ x_offset: 4,
+ },
+ MapRow {
+ start_bit: 829,
+ x_offset: 6,
+ },
+ MapRow {
+ start_bit: 850,
+ x_offset: 7,
+ },
+ MapRow {
+ start_bit: 869,
+ x_offset: 8,
+ },
+ MapRow {
+ start_bit: 886,
+ x_offset: 11,
+ },
+];
+pub const MAP_BITSIZE: usize = 897;
+pub const MAP_U64S: usize = 15;
+
+pub struct MapRow {
+ pub start_bit: usize,
+ pub x_offset: usize,
+}
+
+impl MapRow {
+ pub fn len(&self) -> usize {
+ MAP_SIZE - 2 * self.x_offset
+ }
+
+ pub fn is_empty(&self) -> bool {
+ self.len() == 0
+ }
+}
+
+pub const HEALTH_PACK_VALUE: i32 = 10;
+
+pub const SHOOT_RANGE: i8 = 4;
+pub const SHOOT_RANGE_DIAGONAL: i8 = 3;
+pub const SHOOT_DAMAGE: i32 = 8;
+
+pub const BOMB_RANGE: i8 = 5;
+pub const BOMB_DAMAGED_SPACES: usize = 13;
+pub const BOMB_DAMAGE_RANGE: i8 = 2;
+pub const BOMB_DAMAGES: [(Vec2d, i32); BOMB_DAMAGED_SPACES] = [
+ (Vec2d::new(0, -2), 7),
+ (Vec2d::new(2, 0), 7),
+ (Vec2d::new(0, 2), 7),
+ (Vec2d::new(-2, 0), 7),
+ (Vec2d::new(1, -1), 11),
+ (Vec2d::new(1, 1), 11),
+ (Vec2d::new(-1, 1), 11),
+ (Vec2d::new(-1, -1), 11),
+ (Vec2d::new(0, -1), 13),
+ (Vec2d::new(1, 0), 13),
+ (Vec2d::new(0, 1), 13),
+ (Vec2d::new(-1, 0), 13),
+ (Vec2d::new(0, 0), 20),
+];
+
+pub const SNOWBALL_RANGE: i8 = 5;
+pub const SNOWBALL_FREEZES_SPACES: usize = 9;
+pub const SNOWBALL_FREEZE_RANGE: i8 = 1;
+pub const SNOWBALL_FREEZES: [Vec2d; SNOWBALL_FREEZES_SPACES] = [
+ Vec2d::new(-1, -1),
+ Vec2d::new(0, -1),
+ Vec2d::new(1, -1),
+ Vec2d::new(-1, 0),
+ Vec2d::new(0, 0),
+ Vec2d::new(1, 0),
+ Vec2d::new(-1, 1),
+ Vec2d::new(0, 1),
+ Vec2d::new(1, 1),
+];
+
+pub const MISSED_ATTACK_SCORE: i32 = 2;
+pub const ATTACK_SCORE_MULTIPLIER: i32 = 2;
+pub const KILL_SCORE: i32 = 40;
+pub const DIG_SCORE: i32 = 7;
+pub const MOVE_SCORE: i32 = 5;
+pub const INVALID_COMMAND_SCORE_PENALTY: i32 = 4;
+
+pub const STARTING_BOMBS: u8 = 3;
+pub const STARTING_SNOWBALLS: u8 = 3;
+
+pub const COLLISION_DAMAGE: i32 = 20;
+
+pub const LAVA_DAMAGE: i32 = 3;
+
+pub const LAVA_ROUND_START: usize = 100;
+pub const LAVA_ROUND_END: usize = 350;
+pub const MAX_ROUNDS: usize = 400;
+
+pub const FREEZE_DURATION: u8 = 5;
+pub const FREEZE_SCORE: i32 = 17;