summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2019-06-26 20:31:04 +0200
committerJustin Worthe <justin@worthe-it.co.za>2019-06-26 20:31:04 +0200
commitb7e5273627c1b6db9faf8e29e2445bdbba802453 (patch)
treedc0a216e3465b4ef1b6921e635eceb92b547de89 /src/game
parentaa10ca10922983d345a54b328159de155b478f53 (diff)
Passing bomb count through from the json
Diffstat (limited to 'src/game')
-rw-r--r--src/game/player.rs33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/game/player.rs b/src/game/player.rs
index 32e45bf..38d78d0 100644
--- a/src/game/player.rs
+++ b/src/game/player.rs
@@ -16,6 +16,7 @@ pub struct Worm {
pub position: Point2d<i8>,
pub weapon_damage: i32,
pub weapon_range: u8,
+ pub bombs: u8
}
impl Player {
@@ -94,21 +95,24 @@ mod test {
health: 50,
position: Point2d::new(0, 0),
weapon_damage: 5,
- weapon_range: 5
+ weapon_range: 5,
+ bombs: 0
});
worms.push(Worm {
id: 2,
health: 10,
position: Point2d::new(0, 0),
weapon_damage: 5,
- weapon_range: 5
+ weapon_range: 5,
+ bombs: 0
});
worms.push(Worm {
id: 3,
health: -2,
position: Point2d::new(0, 0),
weapon_damage: 5,
- weapon_range: 5
+ weapon_range: 5,
+ bombs: 0
});
let mut player = Player {
active_worm: 1,
@@ -134,21 +138,24 @@ mod test {
health: 0,
position: Point2d::new(0, 0),
weapon_damage: 5,
- weapon_range: 5
+ weapon_range: 5,
+ bombs: 0
});
worms.push(Worm {
id: 2,
health: 10,
position: Point2d::new(0, 0),
weapon_damage: 5,
- weapon_range: 5
+ weapon_range: 5,
+ bombs: 0
});
worms.push(Worm {
id: 3,
health: 2,
position: Point2d::new(0, 0),
weapon_damage: 5,
- weapon_range: 5
+ weapon_range: 5,
+ bombs: 0
});
let mut player = Player {
active_worm: 1,
@@ -174,27 +181,30 @@ mod test {
health: 0,
position: Point2d::new(0, 0),
weapon_damage: 5,
- weapon_range: 5
+ weapon_range: 5,
+ bombs: 0
});
worms.push(Worm {
id: 2,
health: 10,
position: Point2d::new(0, 0),
weapon_damage: 5,
- weapon_range: 5
+ weapon_range: 5,
+ bombs: 0
});
worms.push(Worm {
id: 3,
health: 2,
position: Point2d::new(0, 0),
weapon_damage: 5,
- weapon_range: 5
+ weapon_range: 5,
+ bombs: 0
});
let mut player = Player {
active_worm: 0,
moves_score: 0,
worms,
- select_moves: 0,
+ select_moves: 0
};
player.clear_dead_worms();
@@ -214,7 +224,8 @@ mod test {
health: -10,
position: Point2d::new(0, 0),
weapon_damage: 5,
- weapon_range: 5
+ weapon_range: 5,
+ bombs: 0
});
let mut player = Player {
active_worm: 0,