fantasy_realms_unofficial_api 0.1.0

An unofficial API for the Fantasy Realms card game.
Documentation
use super::*;

pub(crate) const DOPPELGANGER: Card = Card {
    name: Name::Doppelganger,
    suit: Suit::Wild,
    strength: 0,
    adder: None,
    wild: Some(doppelganger_wild),
    modifier: None,
    immunity: None,
    blanks: None,
    bonus: None,
    penalty: None,
};

pub(crate) fn doppelganger_wild(hand: &Vec<Card>, index: usize) -> Vec<Vec<Card>> {
    hand.iter()
        .filter(|card| card.name != Name::Doppelganger)
        .map(|card| {
            let mut new_hand: Vec<Card> = hand.clone();
            let new_card = Card {
                adder: None,
                wild: None,
                modifier: None,
                immunity: None,
                bonus: None,
                ..*card
            };
            new_hand[index] = new_card;
            new_hand
        })
        .collect::<Vec<Vec<Card>>>()
}