1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use std::borrow::Cow;

use serde::Deserialize;
use yoke::Yokeable;

use super::player::Position;

/// A card in a players deck which can apply an effect
/// to the game or advance a solution
#[derive(Yokeable, Deserialize)]
pub struct ActionCard<'a> {
    /// How much influence the card will cost to play
    influence: i32,
    /// The effect the card will have on the game once it's played
    effect: Effect,
    /// The image on the card
    image: Cow<'a, str>,
    /// The name of the card
    name: Cow<'a, str>,
    /// A description of what the card does
    description: Cow<'a, str>,
}

/// A card which must be solved by someone on the politburo
#[derive(Yokeable, Deserialize)]
pub struct SituationCard<'a> {
    /// Points associated with the card
    points: i32,
    /// Solving this card benefits the player in this position
    benefactor: Position,
    /// The image on the card
    image: Cow<'a, str>,
    /// The name of the card
    name: Cow<'a, str>,
    /// A description of the situation the card entails
    description: Cow<'a, str>,
}

pub enum CardType {
    /// A card which can be used by anyone
    General,
    /// A card which can only be used by the given
    /// poisition
    Position(Position),
}

#[derive(Deserialize)]
pub struct Effect {
    effect: char,
    magnitude: f32,
}