use strum::IntoEnumIterator;
use super::*;
pub(crate) const BOOK_OF_CHANGES: Card = Card {
name: Name::BookOfChanges,
suit: Suit::Artifact,
strength: 3,
adder: None,
wild: None,
modifier: Some(book_of_changes_modifier),
immunity: None,
blanks: None,
bonus: None,
penalty: None,
};
pub(crate) fn book_of_changes_modifier(hand: &Vec<Card>) -> Vec<Vec<Card>> {
hand.iter()
.enumerate()
.flat_map(|(i, card)| {
Suit::iter()
.filter(|&suit| suit != Suit::Wild)
.map(|suit| {
let mut new_hand = hand.clone();
new_hand[i] = Card {
suit: suit,
..*card
};
new_hand
})
.collect::<Vec<Vec<Card>>>()
})
.collect::<Vec<Vec<Card>>>()
}