From ea94aa523086d7757a1938da108cc1dfc6decb6d Mon Sep 17 00:00:00 2001 From: Markus Wagner Date: Sun, 10 Jan 2021 00:32:16 +0100 Subject: [PATCH] Calculate curse cards in final score --- src/cards.rs | 2 +- src/main.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cards.rs b/src/cards.rs index c347df7..f8cc99a 100644 --- a/src/cards.rs +++ b/src/cards.rs @@ -86,7 +86,7 @@ impl Card { pub fn curse(&self) -> Option<()> { for t in &self.types { match t { - CardType::Action(_) => return Some(()), + CardType::Curse => return Some(()), _ => (), } } diff --git a/src/main.rs b/src/main.rs index b4f4264..a6c0a68 100644 --- a/src/main.rs +++ b/src/main.rs @@ -455,6 +455,8 @@ async fn broadcast_state(game: &Game) { let score = p.draw_pile.iter().fold(0, |acc, card| { if let Some(points) = card.victory() { acc + points + } else if let Some(_) = card.curse() { + acc - 1 } else { acc }