Adds more snapshot testing
Build Successful The build was successful
Gitea/epoch_forge/pipeline/head This commit looks good
Details
Build Successful The build was successful
Gitea/epoch_forge/pipeline/head This commit looks good
Details
This commit is contained in:
parent
34bbe0c76a
commit
98707eac5b
|
|
@ -180,48 +180,48 @@
|
|||
"The Nightfall Harbinger",
|
||||
"Storm of the Void",
|
||||
"Echoes of the Unmaking",
|
||||
"The Star‑Cutter",
|
||||
"Realm‑Sunderer",
|
||||
"The Veil‑Shredder",
|
||||
"The Star-Cutter",
|
||||
"Realm-Sunderer",
|
||||
"The Veil-Shredder",
|
||||
"Giant of the Shadowed Depths",
|
||||
"The Whispering Oblivion",
|
||||
"Crown of the Endless Night",
|
||||
"The Loom‑Breaker",
|
||||
"The Sun‑Wither",
|
||||
"The Loom-Breaker",
|
||||
"The Sun-Wither",
|
||||
"Harbinger of the Broken Veil",
|
||||
"The Gloom‑Harvest",
|
||||
"The Gloom-Harvest",
|
||||
"Of the Otherworldly Pleasure",
|
||||
"The Cataclysmic Resonance",
|
||||
"The Tempest of Erasure",
|
||||
"The Crimson Eclipse",
|
||||
"The Null‑Seeker",
|
||||
"The Rift‑Harvester",
|
||||
"The Null-Seeker",
|
||||
"The Rift-Harvester",
|
||||
"The Desolation King",
|
||||
"The Silent Oblivion",
|
||||
"The Shattered Covenant",
|
||||
"The Veiled Devourer",
|
||||
"The Plague of Eternity",
|
||||
"The Storm‑Wreathed Titan",
|
||||
"The Echo‑Demon",
|
||||
"The Loom‑of‑Night",
|
||||
"The Shard‑Weaver",
|
||||
"The Ember‑Wraith",
|
||||
"The Void‑Warden",
|
||||
"The Storm-Wreathed Titan",
|
||||
"The Echo-Demon",
|
||||
"The Loom-of-Night",
|
||||
"The Shard-Weaver",
|
||||
"The Ember-Wraith",
|
||||
"The Void-Warden",
|
||||
"The Twilight Serpent",
|
||||
"The Obsidian Herald",
|
||||
"The Celestial Bane",
|
||||
"The Maw of Forgotten Stars",
|
||||
"The Grief‑Harbinger",
|
||||
"The Grief-Harbinger",
|
||||
"The Fractured Eclipse",
|
||||
"The Devourer of Dawn",
|
||||
"The Rift‑Born Leviathan",
|
||||
"The Rift-Born Leviathan",
|
||||
"The Wailing Abyss",
|
||||
"The Pulse of Ruin",
|
||||
"The Starless Nightfall",
|
||||
"The Maw‑Of‑Eons",
|
||||
"The Shadow‑Eater",
|
||||
"The Echo‑of‑Despair",
|
||||
"The Void‑Cutter"
|
||||
"The Maw-Of-Eons",
|
||||
"The Shadow-Eater",
|
||||
"The Echo-of-Despair",
|
||||
"The Void-Cutter"
|
||||
],
|
||||
"blocker_prefixes": [
|
||||
"Abysmal",
|
||||
|
|
|
|||
|
|
@ -133,17 +133,17 @@ pub enum EntityDuration {
|
|||
/// The enum is deliberately small so it can be used as a Clap argument type.
|
||||
/// It accepts **either**
|
||||
/// * a plain name (e.g. `"bob"`), or
|
||||
/// * a UUID that is prefixed with an `@` (e.g. `"@3f4c6b7e‑d4d1‑4b3f‑a7a4‑0d5c6b8e1f9b"`).
|
||||
/// * a UUID that is prefixed with an `@` (e.g. `"@3f4c6b7e-d4d1-4b3f-a7a4-0d5c6b8e1f9b"`).
|
||||
///
|
||||
/// The two variants are kept separate so that downstream code can decide
|
||||
/// whether it should treat the value as a human‑readable name or a
|
||||
/// machine‑identifiable UUID.
|
||||
/// whether it should treat the value as a human-readable name or a
|
||||
/// machine-identifiable UUID.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Display)]
|
||||
pub enum EntityIdentifier {
|
||||
/// A human‑readable name.
|
||||
/// A human-readable name.
|
||||
Name(String),
|
||||
/// A UUID that was supplied with a leading `@`. The `@` is stripped
|
||||
/// when the enum is constructed – only the raw UUID string is stored.
|
||||
/// when the enum is constructed - only the raw UUID string is stored.
|
||||
Id(String),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -401,9 +401,9 @@ impl Diffable for MetaStats {
|
|||
faction: {
|
||||
match (self.faction.as_ref(), other.faction.as_ref()) {
|
||||
(None, None) => None,
|
||||
(None, Some(a)) => Some(*a),
|
||||
(None, Some(b)) => Some(*b),
|
||||
(Some(a), None) => Some(*a),
|
||||
(Some(a), Some(b)) => Some(*a - *b),
|
||||
(Some(_), Some(b)) => Some(*b),
|
||||
}
|
||||
},
|
||||
links: self
|
||||
|
|
|
|||
|
|
@ -0,0 +1,166 @@
|
|||
---
|
||||
source: lib_efo/src/entity/test.rs
|
||||
expression: "format!(\"{:#?}\", delta)"
|
||||
---
|
||||
Entity {
|
||||
name: "Alice->Bob",
|
||||
id: 00000000-0000-0000-0000-000000000000,
|
||||
stats: OverallStats {
|
||||
demographics: GenericStat(
|
||||
-42,
|
||||
),
|
||||
population: GenericStat(
|
||||
-42,
|
||||
),
|
||||
growth_rate: GenericStat(
|
||||
-42,
|
||||
),
|
||||
crime: GenericStat(
|
||||
-42,
|
||||
),
|
||||
happiness: GenericStat(
|
||||
-42,
|
||||
),
|
||||
economy: GenericStat(
|
||||
-42,
|
||||
),
|
||||
food: GenericStat(
|
||||
-42,
|
||||
),
|
||||
industry: GenericStat(
|
||||
-42,
|
||||
),
|
||||
science: GenericStat(
|
||||
-42,
|
||||
),
|
||||
trade: GenericStat(
|
||||
-42,
|
||||
),
|
||||
military: GenericStat(
|
||||
-42,
|
||||
),
|
||||
army: GenericStat(
|
||||
-42,
|
||||
),
|
||||
strength: GenericStat(
|
||||
-42,
|
||||
),
|
||||
fortification: GenericStat(
|
||||
-42,
|
||||
),
|
||||
threat: GenericStat(
|
||||
-42,
|
||||
),
|
||||
infrastructure: GenericStat(
|
||||
-42,
|
||||
),
|
||||
bureaucracy: GenericStat(
|
||||
-42,
|
||||
),
|
||||
transportation: GenericStat(
|
||||
-42,
|
||||
),
|
||||
sprawl: GenericStat(
|
||||
-42,
|
||||
),
|
||||
health: GenericStat(
|
||||
-42,
|
||||
),
|
||||
},
|
||||
temp_stats: Some(
|
||||
OverallStats {
|
||||
demographics: GenericStat(
|
||||
5,
|
||||
),
|
||||
population: GenericStat(
|
||||
6,
|
||||
),
|
||||
growth_rate: GenericStat(
|
||||
7,
|
||||
),
|
||||
crime: GenericStat(
|
||||
8,
|
||||
),
|
||||
happiness: GenericStat(
|
||||
9,
|
||||
),
|
||||
economy: GenericStat(
|
||||
10,
|
||||
),
|
||||
food: GenericStat(
|
||||
11,
|
||||
),
|
||||
industry: GenericStat(
|
||||
12,
|
||||
),
|
||||
science: GenericStat(
|
||||
13,
|
||||
),
|
||||
trade: GenericStat(
|
||||
14,
|
||||
),
|
||||
military: GenericStat(
|
||||
15,
|
||||
),
|
||||
army: GenericStat(
|
||||
16,
|
||||
),
|
||||
strength: GenericStat(
|
||||
17,
|
||||
),
|
||||
fortification: GenericStat(
|
||||
18,
|
||||
),
|
||||
threat: GenericStat(
|
||||
19,
|
||||
),
|
||||
infrastructure: GenericStat(
|
||||
20,
|
||||
),
|
||||
bureaucracy: GenericStat(
|
||||
21,
|
||||
),
|
||||
transportation: GenericStat(
|
||||
22,
|
||||
),
|
||||
sprawl: GenericStat(
|
||||
23,
|
||||
),
|
||||
health: GenericStat(
|
||||
24,
|
||||
),
|
||||
},
|
||||
),
|
||||
metadata: MetaStats {
|
||||
position: Position(
|
||||
11,
|
||||
662,
|
||||
),
|
||||
capital: Some(
|
||||
TownId(
|
||||
3000,
|
||||
),
|
||||
),
|
||||
governor: Some(
|
||||
CharacterId(
|
||||
1500,
|
||||
),
|
||||
),
|
||||
faction: Some(
|
||||
FactionId(
|
||||
5,
|
||||
),
|
||||
),
|
||||
links: [],
|
||||
prestige: GenericStat(
|
||||
-2,
|
||||
),
|
||||
},
|
||||
entity_type: Monster,
|
||||
duration: Permanent,
|
||||
effect_nature: Recurring,
|
||||
effect_bounds: EffectBounds {
|
||||
min: 0,
|
||||
max: 30,
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
source: lib_efo/src/entity/test.rs
|
||||
expression: "format!(\"{}\", table)"
|
||||
---
|
||||
[0m[1m┌[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┐[0m
|
||||
[0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mDEM[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mPOP[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mGRW[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mCRM[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mHPY[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mECO[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mFOD[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mIND[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mSCI[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mTRD[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mMIL[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mARM[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mSTR[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mFRT[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mTHR[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mIFR[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mBUR[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mTRP[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mSPR[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mHLT[0m[1m [0m[0m[1m│[0m
|
||||
[0m[0m[1m├[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┤[0m
|
||||
[0m[0m[1m│[0m[0m[1m [0m[0m[0m[1m[34m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1m[34m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1m[34m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1m[34m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m
|
||||
[0m[0m[1m└[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┘[0m
|
||||
[0m
|
||||
|
|
@ -6,7 +6,5 @@ expression: "format!(\"{}\", table)"
|
|||
[0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mDEM[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mPOP[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mGRW[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mCRM[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mHPY[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mECO[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mFOD[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mIND[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mSCI[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mTRD[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mMIL[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mARM[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mSTR[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mFRT[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mTHR[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mIFR[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mBUR[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mTRP[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mSPR[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mHLT[0m[1m [0m[0m[1m│[0m
|
||||
[0m[0m[1m├[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┤[0m
|
||||
[0m[0m[1m│[0m[0m[1m [0m[0m[0m[1m[34m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1m[34m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1m[34m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1m[34m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m
|
||||
[0m[0m[1m├[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┤[0m
|
||||
[0m[0m[1m│[0m[0m[1m [0m[0m[0m[1m[34m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1m[34m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1m[34m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1m[34m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m
|
||||
[0m[0m[1m└[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┘[0m
|
||||
[0m
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
source: lib_efo/src/entity/test.rs
|
||||
expression: "format!(\"{}\", table)"
|
||||
---
|
||||
[0m[1m┌[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┬[0m[0m[1m─────[0m[0m[1m┐[0m
|
||||
[0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mDEM[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mPOP[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mGRW[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mCRM[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mHPY[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mECO[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mFOD[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mIND[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mSCI[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mTRD[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mMIL[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mARM[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mSTR[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mFRT[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mTHR[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mIFR[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mBUR[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mTRP[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mSPR[0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1mHLT[0m[1m [0m[0m[1m│[0m
|
||||
[0m[0m[1m├[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┼[0m[0m[1m─────[0m[0m[1m┤[0m
|
||||
[0m[0m[1m│[0m[0m[1m [0m[0m[0m[1m[34m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1m[34m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1m[34m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m[1m[34m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m[0m[1m [0m[0m[0m0 [0m[1m [0m[0m[1m│[0m
|
||||
[0m[0m[1m└[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┴[0m[0m[1m─────[0m[0m[1m┘[0m
|
||||
[0m
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
source: lib_efo/src/entity/test.rs
|
||||
expression: "format!(\"{:#?}\", delta)"
|
||||
---
|
||||
MetaStats {
|
||||
position: Position(
|
||||
-43,
|
||||
-544,
|
||||
),
|
||||
capital: Some(
|
||||
TownId(
|
||||
1500,
|
||||
),
|
||||
),
|
||||
governor: Some(
|
||||
CharacterId(
|
||||
400,
|
||||
),
|
||||
),
|
||||
faction: Some(
|
||||
FactionId(
|
||||
33,
|
||||
),
|
||||
),
|
||||
links: [],
|
||||
prestige: GenericStat(
|
||||
2,
|
||||
),
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
---
|
||||
source: lib_efo/src/entity/test.rs
|
||||
expression: "format!(\"{:#?}\", delta)"
|
||||
---
|
||||
Some(
|
||||
OverallStats {
|
||||
demographics: GenericStat(
|
||||
10,
|
||||
),
|
||||
population: GenericStat(
|
||||
10,
|
||||
),
|
||||
growth_rate: GenericStat(
|
||||
10,
|
||||
),
|
||||
crime: GenericStat(
|
||||
10,
|
||||
),
|
||||
happiness: GenericStat(
|
||||
10,
|
||||
),
|
||||
economy: GenericStat(
|
||||
10,
|
||||
),
|
||||
food: GenericStat(
|
||||
10,
|
||||
),
|
||||
industry: GenericStat(
|
||||
10,
|
||||
),
|
||||
science: GenericStat(
|
||||
10,
|
||||
),
|
||||
trade: GenericStat(
|
||||
10,
|
||||
),
|
||||
military: GenericStat(
|
||||
10,
|
||||
),
|
||||
army: GenericStat(
|
||||
10,
|
||||
),
|
||||
strength: GenericStat(
|
||||
10,
|
||||
),
|
||||
fortification: GenericStat(
|
||||
10,
|
||||
),
|
||||
threat: GenericStat(
|
||||
10,
|
||||
),
|
||||
infrastructure: GenericStat(
|
||||
10,
|
||||
),
|
||||
bureaucracy: GenericStat(
|
||||
10,
|
||||
),
|
||||
transportation: GenericStat(
|
||||
10,
|
||||
),
|
||||
sprawl: GenericStat(
|
||||
10,
|
||||
),
|
||||
health: GenericStat(
|
||||
10,
|
||||
),
|
||||
},
|
||||
)
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
---
|
||||
source: lib_efo/src/entity/test.rs
|
||||
expression: "format!(\"{:#?}\", entity.stats)"
|
||||
---
|
||||
OverallStats {
|
||||
demographics: GenericStat(
|
||||
1,
|
||||
),
|
||||
population: GenericStat(
|
||||
33,
|
||||
),
|
||||
growth_rate: GenericStat(
|
||||
3,
|
||||
),
|
||||
crime: GenericStat(
|
||||
4,
|
||||
),
|
||||
happiness: GenericStat(
|
||||
5,
|
||||
),
|
||||
economy: GenericStat(
|
||||
6,
|
||||
),
|
||||
food: GenericStat(
|
||||
7,
|
||||
),
|
||||
industry: GenericStat(
|
||||
8,
|
||||
),
|
||||
science: GenericStat(
|
||||
9,
|
||||
),
|
||||
trade: GenericStat(
|
||||
10,
|
||||
),
|
||||
military: GenericStat(
|
||||
11,
|
||||
),
|
||||
army: GenericStat(
|
||||
12,
|
||||
),
|
||||
strength: GenericStat(
|
||||
13,
|
||||
),
|
||||
fortification: GenericStat(
|
||||
14,
|
||||
),
|
||||
threat: GenericStat(
|
||||
15,
|
||||
),
|
||||
infrastructure: GenericStat(
|
||||
16,
|
||||
),
|
||||
bureaucracy: GenericStat(
|
||||
17,
|
||||
),
|
||||
transportation: GenericStat(
|
||||
18,
|
||||
),
|
||||
sprawl: GenericStat(
|
||||
19,
|
||||
),
|
||||
health: GenericStat(
|
||||
20,
|
||||
),
|
||||
}
|
||||
|
|
@ -1,11 +1,12 @@
|
|||
// tests/mod.rs – or put this inside your crate’s tests module
|
||||
// tests/mod.rs - or put this inside your crate's tests module
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use std::str::FromStr;
|
||||
|
||||
use crate::entity::{EffectApplication, EffectBounds, Entity, EntityDuration, EntityIdentifier};
|
||||
use crate::epoch::epoch_traits::Diffable;
|
||||
use crate::error::EpochError;
|
||||
use crate::stats::{self, EntityType, MetaStats, Position, TownId};
|
||||
use crate::stats::{self, EntityType, MetaStats, Position, StatPair, TownId};
|
||||
use std::io::Write;
|
||||
|
||||
use super::*;
|
||||
|
|
@ -13,7 +14,7 @@ use crate::Displayable;
|
|||
use insta::assert_snapshot;
|
||||
use uuid::Uuid;
|
||||
|
||||
/// The same structs & enums that the original crate exports – adjust the names
|
||||
/// The same structs & enums that the original crate exports - adjust the names
|
||||
/// if your crate uses different identifiers.
|
||||
|
||||
// ---------- EntityDuration ----------
|
||||
|
|
@ -54,7 +55,7 @@ fn entity_duration_parses_numeric_forms() {
|
|||
EntityDuration::from_str("duration:10").unwrap(),
|
||||
EntityDuration::Duration(10)
|
||||
);
|
||||
// case‑insensitive prefix
|
||||
// case-insensitive prefix
|
||||
assert_eq!(
|
||||
EntityDuration::from_str("DurAtIoN:20").unwrap(),
|
||||
EntityDuration::Duration(20)
|
||||
|
|
@ -80,7 +81,7 @@ fn entity_duration_parses_with_surrounding_whitespace() {
|
|||
|
||||
#[test]
|
||||
fn entity_duration_returns_error_on_invalid_inputs() {
|
||||
// non‑numeric bare string
|
||||
// non-numeric bare string
|
||||
let err = EntityDuration::from_str("10a").unwrap_err();
|
||||
match err {
|
||||
EpochError::ParsingDuration(msg, val) => {
|
||||
|
|
@ -100,7 +101,7 @@ fn entity_duration_returns_error_on_invalid_inputs() {
|
|||
_ => panic!("Expected ParsingDuration error"),
|
||||
}
|
||||
|
||||
// trailing spaces after the duration prefix – the numeric parser fails
|
||||
// trailing spaces after the duration prefix - the numeric parser fails
|
||||
let err = EntityDuration::from_str("duration: 5").unwrap_err();
|
||||
match err {
|
||||
EpochError::ParsingDuration(msg, val) => {
|
||||
|
|
@ -164,7 +165,7 @@ fn effect_bounds_returns_error_on_invalid_inputs() {
|
|||
_ => panic!("Expected ParsingBounds error"),
|
||||
}
|
||||
|
||||
// non‑numeric part
|
||||
// non-numeric part
|
||||
let err = EffectBounds::from_str("a:5").unwrap_err();
|
||||
match err {
|
||||
EpochError::ParsingBounds(msg, val) => {
|
||||
|
|
@ -243,28 +244,39 @@ fn init_snapshot_env() {
|
|||
colored::control::set_override(false);
|
||||
}
|
||||
|
||||
/// Build a fully‑featured entity (capital, governor, prestige > 0).
|
||||
/// Build a fully-featured entity (capital, governor, prestige > 0).
|
||||
fn full_entity() -> Entity {
|
||||
Entity {
|
||||
id: Uuid::from_u128_le(12),
|
||||
name: "Hero".into(),
|
||||
entity_type: EntityType::Character, // ← change to a real variant
|
||||
entity_type: EntityType::Character,
|
||||
metadata: MetaStats {
|
||||
capital: Some(stats::TownId(50)),
|
||||
governor: Some(stats::CharacterId(11)),
|
||||
prestige: stats::GenericStat(3),
|
||||
position: Position::from((2, 4)), // ← real variant
|
||||
position: Position::from((2, 4)),
|
||||
faction: Some(crate::stats::FactionId(2)),
|
||||
links: vec![TownId(3)],
|
||||
},
|
||||
duration: EntityDuration::Duration(10),
|
||||
effect_nature: EffectApplication::Recurring, // ← real variant
|
||||
effect_bounds: EffectBounds::from((1, 5)), // ← real constructor
|
||||
stats: stats::OverallStats::default(), // ← real constructor
|
||||
effect_nature: EffectApplication::Recurring,
|
||||
effect_bounds: EffectBounds::from((1, 5)),
|
||||
stats: stats::OverallStats::default(),
|
||||
temp_stats: Some(stats::OverallStats::default()),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn effect_bound_testing() {
|
||||
let EffectBounds { min, max } = EffectBounds::from(0..1);
|
||||
let EffectBounds {
|
||||
min: min2,
|
||||
max: max2,
|
||||
} = EffectBounds::from((0, 1));
|
||||
assert_eq!(min, min2);
|
||||
assert_eq!(max, max2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn snapshot_full_oneline_display() {
|
||||
init_snapshot_env();
|
||||
|
|
@ -301,7 +313,7 @@ fn snapshot_print_full_output() {
|
|||
// std::mem::replace(&mut handle, original);
|
||||
}
|
||||
|
||||
// Convert buffer → UTF‑8 string and snapshot it.
|
||||
// Convert buffer → UTF-8 string and snapshot it.
|
||||
let output = String::from_utf8_lossy(&buffer);
|
||||
assert_snapshot!(output);
|
||||
}
|
||||
|
|
@ -310,9 +322,12 @@ fn snapshot_print_full_output() {
|
|||
fn snapshot_full_stats_no_temp() {
|
||||
init_snapshot_env();
|
||||
|
||||
let e = full_entity();
|
||||
let mut e = full_entity();
|
||||
e.temp_stats = None;
|
||||
let table = e.full_stats_to_table().expect("table generation failed");
|
||||
assert_snapshot!(format!("{}", table));
|
||||
let table = e.stats_to_table().expect("table generation failed");
|
||||
assert_snapshot!(format!("{}", table));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -320,14 +335,141 @@ fn snapshot_full_stats_with_temp() {
|
|||
init_snapshot_env();
|
||||
|
||||
let mut e = full_entity();
|
||||
// Give the entity a temporary stat that is *different* from the
|
||||
// permanent one so we can see two distinct rows in the table.
|
||||
//
|
||||
// If `Stats` offers a builder or `new` you can use it here.
|
||||
// Otherwise just clone the default – the snapshot will contain
|
||||
// two identical rows and that is fine for a regression test.
|
||||
e.temp_stats = Some(OverallStats::default());
|
||||
|
||||
let table = e.full_stats_to_table().expect("table generation failed");
|
||||
assert_snapshot!(format!("{}", table));
|
||||
let table = e.stats_to_table().expect("table generation failed");
|
||||
assert_snapshot!(format!("{}", table));
|
||||
}
|
||||
|
||||
/// ------------------------------------------------------------------
|
||||
/// 1. Helpers - `overwrite_stat` & `add_to_stat`
|
||||
/// ------------------------------------------------------------------
|
||||
#[test]
|
||||
fn snapshot_overwrite_stat() {
|
||||
init_snapshot_env();
|
||||
|
||||
let mut entity = Entity::default();
|
||||
let stats = OverallStats::linear(0);
|
||||
entity.stats = stats;
|
||||
entity.change_stat(StatPair {
|
||||
stat: stats::ListStats::Population,
|
||||
value: stats::GenericStat(33),
|
||||
});
|
||||
|
||||
assert_snapshot!(format!("{:#?}", entity.stats));
|
||||
}
|
||||
|
||||
// #[test]
|
||||
// fn snapshot_add_to_stat_saturating_add() {
|
||||
// init_snapshot_env();
|
||||
|
||||
// let mut stats = stats_from_values(u32::MAX as i32 - 1, 20, 30);
|
||||
// let pair = pair("health", 5);
|
||||
|
||||
// add_to_stat(&mut stats, pair);
|
||||
|
||||
// // The saturated addition should clamp to `u32::MAX`.
|
||||
// assert_snapshot!(format!("{}\n", stats));
|
||||
// }
|
||||
|
||||
/// ------------------------------------------------------------------
|
||||
/// 2. `Diffable` - `Entity::delta`
|
||||
/// ------------------------------------------------------------------
|
||||
#[test]
|
||||
fn snapshot_entity_delta() {
|
||||
init_snapshot_env();
|
||||
|
||||
// Build two slightly different entities
|
||||
let e1 = Entity {
|
||||
id: uuid::Uuid::nil(),
|
||||
name: "Alice".into(),
|
||||
stats: OverallStats::linear(2),
|
||||
temp_stats: None,
|
||||
metadata: MetaStats {
|
||||
position: Position::from((44, 666)),
|
||||
capital: Some(stats::TownId(5000)),
|
||||
governor: Some(stats::CharacterId(2000)),
|
||||
faction: Some(stats::FactionId(44)),
|
||||
links: vec![TownId(33)],
|
||||
prestige: stats::GenericStat(3),
|
||||
},
|
||||
entity_type: EntityType::Monster,
|
||||
duration: EntityDuration::Permanent,
|
||||
effect_nature: EffectApplication::Recurring,
|
||||
effect_bounds: EffectBounds::from(0..33),
|
||||
};
|
||||
|
||||
let e2 = Entity {
|
||||
id: uuid::Uuid::nil(),
|
||||
name: "Bob".into(),
|
||||
stats: OverallStats::linear(44),
|
||||
temp_stats: Some(OverallStats::linear(4)),
|
||||
metadata: MetaStats {
|
||||
position: Position::from_str("33,4").unwrap(),
|
||||
capital: Some(stats::TownId(3000)),
|
||||
governor: Some(stats::CharacterId(1500)),
|
||||
faction: Some(stats::FactionId(5)),
|
||||
links: vec![TownId(6)],
|
||||
prestige: stats::GenericStat(5),
|
||||
},
|
||||
entity_type: EntityType::Town,
|
||||
duration: EntityDuration::Permanent,
|
||||
effect_nature: EffectApplication::Recurring,
|
||||
effect_bounds: EffectBounds::from(0..3),
|
||||
};
|
||||
|
||||
// Compute the delta
|
||||
let mut delta = e1.delta(&e2);
|
||||
delta.id = Uuid::nil();
|
||||
assert_snapshot!(format!("{:#?}", delta));
|
||||
}
|
||||
|
||||
/// ------------------------------------------------------------------
|
||||
/// 3. `Diffable` - `Option<OverallStats>`
|
||||
/// ------------------------------------------------------------------
|
||||
#[test]
|
||||
fn snapshot_option_stats_delta() {
|
||||
init_snapshot_env();
|
||||
|
||||
let a = OverallStats::linear(32);
|
||||
let b = OverallStats::linear(22);
|
||||
|
||||
let opt_a = Some(a.clone());
|
||||
let opt_b = Some(b.clone());
|
||||
|
||||
// `delta` is commutative for the purpose of the snapshot
|
||||
let delta = opt_a.delta(&opt_b);
|
||||
|
||||
assert_snapshot!(format!("{:#?}", delta));
|
||||
}
|
||||
|
||||
/// ------------------------------------------------------------------
|
||||
/// 4. `Diffable` - `MetaStats`
|
||||
/// ------------------------------------------------------------------
|
||||
#[test]
|
||||
fn snapshot_meta_stats_delta() {
|
||||
init_snapshot_env();
|
||||
|
||||
let meta1 = MetaStats {
|
||||
position: Position::from((1, 11)),
|
||||
capital: Some(stats::TownId(1000)),
|
||||
governor: Some(stats::CharacterId(500)),
|
||||
faction: Some(stats::FactionId(1)),
|
||||
links: vec![TownId(22)],
|
||||
prestige: stats::GenericStat(3),
|
||||
};
|
||||
|
||||
let meta2 = MetaStats {
|
||||
position: Position::from((44, 555)),
|
||||
capital: Some(stats::TownId(1500)),
|
||||
governor: Some(stats::CharacterId(400)),
|
||||
faction: Some(stats::FactionId(33)),
|
||||
links: vec![TownId::from(55)],
|
||||
prestige: stats::GenericStat(1),
|
||||
};
|
||||
|
||||
let delta = meta1.delta(&meta2);
|
||||
|
||||
assert_snapshot!(format!("{:#?}", delta));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ impl NamingData {
|
|||
}
|
||||
}
|
||||
|
||||
/// Generate a random **blocker** name (e.g. “Stone‑Gate”, “Witch‑Wall”).
|
||||
/// Generate a random **blocker** name (e.g. “Stone-Gate”, “Witch-Wall”).
|
||||
///
|
||||
/// The name is formed by choosing a random prefix *and* suffix from the
|
||||
/// corresponding lists. If either list is empty, a sensible default is
|
||||
|
|
@ -182,10 +182,10 @@ impl NamingData {
|
|||
|
||||
/// Generate a *calamity* name.
|
||||
///
|
||||
/// A calamity is a **complex exotic** word (prefix + 2–4 infixes + optional suffix)
|
||||
/// A calamity is a **complex exotic** word (prefix + 2-4 infixes + optional suffix)
|
||||
/// followed by a *mystical* adjective.
|
||||
///
|
||||
/// Example output: “Umbral‑Shatterfall Cataclysmic”
|
||||
/// Example output: “Umbral-Shatterfall Cataclysmic”
|
||||
pub fn generate_calamity_name(&self) -> String {
|
||||
let mut rng = rand::rng();
|
||||
|
||||
|
|
@ -197,7 +197,7 @@ impl NamingData {
|
|||
.unwrap_or(&"Umbral".to_string())
|
||||
.clone();
|
||||
|
||||
// Pick 2–4 infixes (this gives the “complex” feel)
|
||||
// Pick 2-4 infixes (this gives the “complex” feel)
|
||||
let infix_count = rng.random_range(2..=4);
|
||||
let infixes: String = (0..infix_count)
|
||||
.map(|_| {
|
||||
|
|
@ -208,7 +208,7 @@ impl NamingData {
|
|||
})
|
||||
.collect();
|
||||
|
||||
// Optional suffix – if you don’t have a list, this will be an empty string
|
||||
// Optional suffix - if you don't have a list, this will be an empty string
|
||||
let suffix = self
|
||||
.exotic_suffixes
|
||||
.choose(&mut rng)
|
||||
|
|
|
|||
|
|
@ -12,20 +12,11 @@
|
|||
#![allow(dead_code)]
|
||||
#![deny(clippy::missing_docs_in_private_items)]
|
||||
|
||||
use crate::error::EpochError;
|
||||
use crate::thin_newtype;
|
||||
use crate::utils::RngLevel;
|
||||
use cli_table::CellStruct;
|
||||
use cli_table::Color;
|
||||
use cli_table::Style;
|
||||
use cli_table::Table;
|
||||
use crate::{error::EpochError, thin_newtype, utils::RngLevel};
|
||||
use cli_table::{CellStruct, Color, Style, Table};
|
||||
use colored::Colorize;
|
||||
use derive_more::Add;
|
||||
use derive_more::Display;
|
||||
use derive_more::Sub;
|
||||
use rand::Rng;
|
||||
use rand::distr::Distribution;
|
||||
use rand::rngs::ThreadRng;
|
||||
use derive_more::{Add, Display, Sub};
|
||||
use rand::{Rng, distr::Distribution, rngs::ThreadRng};
|
||||
use serde::{Deserialize, Serialize};
|
||||
mod implementations;
|
||||
|
||||
|
|
@ -309,6 +300,34 @@ impl OverallStats {
|
|||
/// etc.
|
||||
// TODO: Fill this
|
||||
fn apply_exteriors(&mut self) {}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn linear(base: isize) -> OverallStats {
|
||||
use crate::stats;
|
||||
|
||||
Self {
|
||||
demographics: stats::GenericStat(1 + base),
|
||||
population: stats::GenericStat(2 + base),
|
||||
growth_rate: stats::GenericStat(3 + base),
|
||||
crime: stats::GenericStat(4 + base),
|
||||
happiness: stats::GenericStat(5 + base),
|
||||
economy: stats::GenericStat(6 + base),
|
||||
food: stats::GenericStat(7 + base),
|
||||
industry: stats::GenericStat(8 + base),
|
||||
science: stats::GenericStat(9 + base),
|
||||
trade: stats::GenericStat(10 + base),
|
||||
military: stats::GenericStat(11 + base),
|
||||
army: stats::GenericStat(12 + base),
|
||||
strength: stats::GenericStat(13 + base),
|
||||
fortification: stats::GenericStat(14 + base),
|
||||
threat: stats::GenericStat(15 + base),
|
||||
infrastructure: stats::GenericStat(16 + base),
|
||||
bureaucracy: stats::GenericStat(17 + base),
|
||||
transportation: stats::GenericStat(18 + base),
|
||||
sprawl: stats::GenericStat(19 + base),
|
||||
health: stats::GenericStat(20 + base),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Strategic context and meta-data for an entity.
|
||||
|
|
@ -574,8 +593,3 @@ pub trait Accessible {
|
|||
/// `None` if the key does not exist.
|
||||
fn get_val(&self, key: &str) -> Option<Box<dyn GameStat>>;
|
||||
}
|
||||
|
||||
// pub trait Displayable {
|
||||
// fn summary(&self) -> String;
|
||||
// fn full_description(&self) -> String;
|
||||
// }
|
||||
|
|
|
|||
Loading…
Reference in New Issue