fantasy_realms_unofficial_api 0.1.0

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

pub(crate) const MOUNTAIN: Card = Card {
    name: Name::Mountain,
    suit: Suit::Land,
    strength: 9,
    adder: None,
    wild: None,
    modifier: Some(mountain_modifier),
    immunity: None,
    blanks: None,
    bonus: Some(mountain_bonus),
    penalty: None,
};

pub(crate) fn mountain_modifier(hand: &Vec<Card>) -> Vec<Vec<Card>> {
    vec![hand
        .iter()
        .map(|card| {
            if card.suit == Suit::Flood {
                Card {
                    blanks: None,
                    penalty: None,
                    ..*card
                }
            } else {
                *card
            }
        })
        .collect::<Vec<Card>>()]
}

pub(crate) fn mountain_bonus(hand: &ScoringHand) -> i16 {
    if hand.contains_name(Name::Smoke) && hand.contains_name(Name::Wildfire) {
        50
    } else {
        0
    }
}