cannot clear skills while ready

This commit is contained in:
ntr 2019-12-20 13:15:40 +10:00
parent 69c964510c
commit b36b9553d0

View File

@ -336,7 +336,11 @@ impl Game {
pub fn clear_skill(&mut self, player_id: Uuid) -> Result<&mut Game, Error> {
self.player_by_id(player_id)?;
let player = self.player_by_id(player_id)?;
if player.ready {
return Err(err_msg("cannot clear skills while ready"));
}
if self.phase != Phase::Skill {
return Err(err_msg("game not in skill phase"));
}
@ -2058,7 +2062,7 @@ mod tests {
let resolutions = &game.resolutions[last];
assert!(resolutions.iter().any(|r| match r.event {
Event::Damage { construct, colour, amount, mitigation: _, display: _ } =>
Event::Damage { construct, colour, amount, mitigation: _, display: _ } =>
construct == target && amount == 320.pct(50) && colour == Colour::Blue,
_ => false,
}));