Calculate curse cards in final score

This commit is contained in:
Markus Wagner 2021-01-10 00:32:16 +01:00
parent 7434dee715
commit ea94aa5230
2 changed files with 3 additions and 1 deletions

View File

@ -86,7 +86,7 @@ impl Card {
pub fn curse(&self) -> Option<()> { pub fn curse(&self) -> Option<()> {
for t in &self.types { for t in &self.types {
match t { match t {
CardType::Action(_) => return Some(()), CardType::Curse => return Some(()),
_ => (), _ => (),
} }
} }

View File

@ -455,6 +455,8 @@ async fn broadcast_state(game: &Game) {
let score = p.draw_pile.iter().fold(0, |acc, card| { let score = p.draw_pile.iter().fold(0, |acc, card| {
if let Some(points) = card.victory() { if let Some(points) = card.victory() {
acc + points acc + points
} else if let Some(_) = card.curse() {
acc - 1
} else { } else {
acc acc
} }