summaryrefslogtreecommitdiff
path: root/2019-worms/src/constants.rs
blob: 3f36db4b0dc46bd1feec52d55ddd7640e021ec59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
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;