politburo/src/cards.rs

52 lines
1.3 KiB
Rust
Raw Normal View History

2024-03-10 20:27:00 -04:00
use std::borrow::Cow;
2024-03-13 08:30:41 -04:00
use serde::Deserialize;
2024-03-10 20:27:00 -04:00
use yoke::Yokeable;
use super::player::Position;
2024-03-10 20:52:44 -04:00
/// A card in a players deck which can apply an effect
/// to the game or advance a solution
2024-03-13 08:30:41 -04:00
#[derive(Yokeable, Deserialize)]
2024-03-10 20:27:00 -04:00
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
2024-03-13 08:30:41 -04:00
#[derive(Yokeable, Deserialize)]
2024-03-10 20:27:00 -04:00
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),
}
2024-03-13 08:30:41 -04:00
#[derive(Deserialize)]
pub struct Effect {
effect: char,
magnitude: f32,
}