/// Represents the colors of the game
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Color {
/// Gold (D)
Divine,
/// Blue (R)
Revelation,
/// White (A)
Grace,
/// Green (G)
Growth,
/// Red (U)
Crusade,
/// Black (S)
Suffering,
/// Gray/Colorless (M)
Mundane,
}
impl Color {
pub const fn all() -> [Color; 7] {
use Color::*;
[
Mundane, Divine, Revelation, Grace, Growth, Crusade, Suffering,
]
}
pub const fn all_factions() -> [Color; 6] {
use Color::*;
[Divine, Revelation, Grace, Growth, Crusade, Suffering]
}
pub fn opposes(self) -> Self {
match self {
Self::Mundane => Self::Mundane,
faction => {
pub(crate) const ALL_FACTIONS: &[Color] = &Color::all_factions();
let faction_pos = ALL_FACTIONS.iter().position(|f| *f == faction).unwrap();
let opposing_index = (faction_pos + 3) % ALL_FACTIONS.len();
ALL_FACTIONS[opposing_index]
}
}
}
pub fn adjacent_to(self) -> [Self; 2] {
match self {
Self::Mundane => [Self::Mundane, Self::Mundane],
faction => {
pub(crate) const ALL_FACTIONS: &[Color] = &Color::all_factions();
let faction_pos = ALL_FACTIONS.iter().position(|f| *f == faction).unwrap();
let left_adjacent = (faction_pos + ALL_FACTIONS.len() - 1) % ALL_FACTIONS.len();
let right_adjacent = (faction_pos + 1) % ALL_FACTIONS.len();
[ALL_FACTIONS[left_adjacent], ALL_FACTIONS[right_adjacent]]
}
}
}
}
#[derive(Debug, Clone, Copy, Default)]
pub struct ColorBalance {
pub(crate) mundane: usize,
pub(crate) divine: usize,
pub(crate) revelation: usize,
pub(crate) grace: usize,
pub(crate) growth: usize,
pub(crate) crusade: usize,
pub(crate) suffering: usize,
}
impl ColorBalance {}