use super::EnumStr;
use enum_map::Enum;
use serde::{Deserialize, Serialize};
#[derive(Enum, PartialEq, Eq, Clone, Copy, Hash, Serialize, Deserialize, Debug)]
pub enum Ruin {
DiscoverCulturalArtifacts,
SquattersWillingToWorkForYou,
SquattersWishingToSettleUnderYourRule,
YourExploringUnitReceivesTraining,
SurvivorsaddsPopulationToACity,
AStashOfGold,
DiscoverALostTechnology,
AdvancedWeaponryForYourExplorer,
RevealNearbyBarbarianCamps,
FindACrudelydrawnMap,
DiscoverHolySymbols,
AnAncientProphecy,
}
impl EnumStr for Ruin {
fn as_str(&self) -> &'static str {
match self {
Ruin::DiscoverCulturalArtifacts => "discover cultural artifacts",
Ruin::SquattersWillingToWorkForYou => "squatters willing to work for you",
Ruin::SquattersWishingToSettleUnderYourRule => "squatters wishing to settle under your rule",
Ruin::YourExploringUnitReceivesTraining => "your exploring unit receives training",
Ruin::SurvivorsaddsPopulationToACity => "survivors (adds population to a city)",
Ruin::AStashOfGold => "a stash of gold",
Ruin::DiscoverALostTechnology => "discover a lost technology",
Ruin::AdvancedWeaponryForYourExplorer => "advanced weaponry for your explorer",
Ruin::RevealNearbyBarbarianCamps => "reveal nearby Barbarian camps",
Ruin::FindACrudelydrawnMap => "find a crudely-drawn map",
Ruin::DiscoverHolySymbols => "discover holy symbols",
Ruin::AnAncientProphecy => "an ancient prophecy",
}
}
fn from_str(s: &str) -> Self {
match s {
"discover cultural artifacts" => Ruin::DiscoverCulturalArtifacts,
"squatters willing to work for you" => Ruin::SquattersWillingToWorkForYou,
"squatters wishing to settle under your rule" => Ruin::SquattersWishingToSettleUnderYourRule,
"your exploring unit receives training" => Ruin::YourExploringUnitReceivesTraining,
"survivors (adds population to a city)" => Ruin::SurvivorsaddsPopulationToACity,
"a stash of gold" => Ruin::AStashOfGold,
"discover a lost technology" => Ruin::DiscoverALostTechnology,
"advanced weaponry for your explorer" => Ruin::AdvancedWeaponryForYourExplorer,
"reveal nearby Barbarian camps" => Ruin::RevealNearbyBarbarianCamps,
"find a crudely-drawn map" => Ruin::FindACrudelydrawnMap,
"discover holy symbols" => Ruin::DiscoverHolySymbols,
"an ancient prophecy" => Ruin::AnAncientProphecy,
_ => panic!("Invalid value for {}: {{}}", s),
}
}
}