saints-mile 1.0.2

A frontier JRPG for the adults who loved those games first
Documentation
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
//! Chapter 4 — Ropehouse Blood.
//!
//! Emotional law: Entanglement. Standing somewhere costs something.
//! Rosa joins. Full 4-person party. The game's JRPG spine arrives.

use crate::types::*;
use crate::scene::types::*;
use crate::combat::types::*;
use crate::content::builders::*;
use crate::state::argument;

// ─── Entry ─────────────────────────────────────────────────────────

/// Chapter 4 entry — into Varela country.
pub fn varela_approach() -> Scene {
    scene(
        "rh_varela_approach", "varela_country", "4_1",
        PacingTag::Exploration,
        vec![
            narrate_with(
                "The sheriff's trail from Black Willow leads into stock country. \
                 Rolling grass, fence lines, cattle trails, windmill pumps. The \
                 landscape changes from swamp to bone-dry range.",
                EmotionTag::Neutral,
            ),
            // Rosa entry differs by prologue choice
            say_if_with("narrator",
                "A woman on horseback meets you at a boundary marker. She has \
                 a rope coiled on her saddle and the look of someone who decided \
                 about you before you opened your mouth. But there's a debt here \
                 — you helped her people once, at the homestead. She's testing \
                 whether that was real.",
                vec![flag_eq("beat5_choice", "homestead_first")],
                EmotionTag::Tense,
            ),
            say_if_with("narrator",
                "A woman on horseback finds you before you find the homestead. \
                 She has a rope coiled on her saddle and the look of someone who \
                 decided about you before you arrived. The sheriff's trail crosses \
                 Varela land, and she will not have outsiders moving through her \
                 territory without a Varela watching.",
                vec![flag_eq("beat5_choice", "town_direct")],
                EmotionTag::Tense,
            ),
            say_with("rosa",
                "Rosa Varela. You're on my land. You move when I say.",
                EmotionTag::Bitter,
            ),
            say_if_with("rosa",
                "And if you damage more than you're worth, I will make that plain.",
                vec![flag_eq("beat5_choice", "town_direct")],
                EmotionTag::Bitter,
            ),
            say_if_with("rosa",
                "My mother says you helped before. I'm here to see if \
                 that holds weight or was just geography.",
                vec![flag_eq("beat5_choice", "homestead_first")],
                EmotionTag::Tense,
            ),
        ],
        vec![
            choice("Accept her terms", vec![
                relate("galen", "rosa", 0),
            ], to_scene("rh_homestead")),
        ],
        vec![],
    )
}

/// The Varela homestead — land under paper siege.
pub fn homestead_scene() -> Scene {
    scene(
        "rh_homestead", "varela_homestead", "4_2",
        PacingTag::Pressure,
        vec![
            narrate(
                "The Varela homestead: stone-and-timber house older than the rail. \
                 Corrals, a well, a kitchen garden feeding more people than planned. \
                 Claim papers sit next to ammunition in the same cabinet.",
            ),
            say_with("alma",
                "Alma Varela. My daughter tells me you're following the same \
                 paper trail that's eating our fence lines.",
                EmotionTag::Bitter,
            ),
            narrate(
                "The cattle are thinner than they should be. The creek bed \
                 downstream is cracked and white. A diversion dam — legal — is \
                 killing the Varela water supply slowly.",
            ),
        ],
        vec![
            choice("Visit the water claim", vec![], to_scene("rh_water_claim")),
        ],
        vec![],
    )
}

/// The water claim — the central argument.
pub fn water_claim_scene() -> Scene {
    scene(
        "rh_water_claim", "varela_water_claim", "4_3",
        PacingTag::Crisis,
        vec![
            narrate_with(
                "The creek junction where Varela water rights and a smaller \
                 homestead family's sold rights intersect with a Briar Line \
                 diversion dam. The dam is legal. The creek bed downstream \
                 is white and cracked.",
                EmotionTag::Tense,
            ),
            // The party argues
            say_with("rosa",
                "Cut the diversion. My cattle are dying. Legal channels have \
                 failed for three years.",
                EmotionTag::Bitter,
            ),
            say_with("ada",
                "Violence will bring marshals. Your legal position gets worse. \
                 More people get hurt.",
                EmotionTag::Tense,
            ),
            say_with("eli",
                "I can forge counter-filings. Create enough doubt to stall \
                 the claim. Nobody gets shot.",
                EmotionTag::Dry,
            ),
            say_with("ada",
                "That con might destroy the smaller family who sold their \
                 rights to survive. You're using the same paper logic being \
                 used against the Varelas.",
                EmotionTag::Bitter,
            ),
        ],
        vec![
            choice("Cut the diversion by force — Rosa is right", vec![
                set_text("ch4_stance", "force"),
                rep(ReputationAxis::Rancher, 10),
                rep(ReputationAxis::Railroad, -10),
                relate("galen", "rosa", 8),
                relate("galen", "ada", -5),
            ], to_scene("rh_ropehouse_approach")),
            choice("Use Eli's con — quieter, no blood", vec![
                set_text("ch4_stance", "con"),
                relate("galen", "eli", 5),
                relate("galen", "rosa", -3),
                relate("galen", "ada", -2),
            ], to_scene("rh_ropehouse_approach")),
            choice("Negotiate with medical evidence — Ada's way", vec![
                set_text("ch4_stance", "negotiate"),
                relate("galen", "ada", 8),
                relate("galen", "rosa", -2),
            ], to_scene("rh_ropehouse_approach")),
        ],
        vec![],
    )
}

/// Ropehouse approach — the hearing that breaks.
pub fn ropehouse_approach() -> Scene {
    scene(
        "rh_ropehouse_approach", "ropehouse", "4_5",
        PacingTag::Crisis,
        vec![
            narrate_with(
                "The Ropehouse: a repurposed barn where ranch country holds its \
                 own justice. Wooden benches, a table serving as dock and judge's \
                 bench, a rope coil on the wall everyone pretends is decorative.",
                EmotionTag::Tense,
            ),
            narrate(
                "A captured railroad surveyor sits at the table. Ranch families \
                 on one side, rail men on the other. The hearing is about the \
                 poisoned well, the water claim, and who owns the ground.",
            ),
            narrate("Then armed railroad men arrive to extract the prisoner."),
            say("rosa", "They're not taking him."),
            narrate_with(
                "The hearing breaks. The fight is inside and outside the Ropehouse.",
                EmotionTag::Tense,
            ),
        ],
        vec![
            choice("Hold the Ropehouse", vec![], to_combat("ropehouse_fight")),
        ],
        vec![],
    )
}

/// Post-Ropehouse aftermath — "we won the fight and lost the room."
pub fn ropehouse_aftermath() -> Scene {
    scene(
        "rh_aftermath", "ropehouse", "4_5",
        PacingTag::Intimate,
        vec![
            narrate_with(
                "The Ropehouse is damaged. Benches splintered. The hearing is \
                 destroyed. Whatever justice was being attempted is now replaced \
                 by the fact of violence.",
                EmotionTag::Grief,
            ),
            narrate(
                "We won the fight and lost the room.",
            ),
            // Combat outcome: witness protection objective result
            say_if_with("narrator",
                "The surveyor-witness is safe. His testimony survived the \
                 Ropehouse. Whether anyone will hear it is another question.",
                vec![flag_is("witness_secured", true)],
                EmotionTag::Quiet,
            ),
            say_if_with("narrator",
                "The surveyor was extracted during the fight. Whatever he \
                 knew is now property of the men who took him.",
                vec![flag_is("witness_extracted", true)],
                EmotionTag::Bitter,
            ),
            // Stance-dependent reactions
            say_if_with("rosa",
                "You stood with us. That's more than talk.",
                vec![flag_eq("ch4_stance", "force")],
                EmotionTag::Warm,
            ),
            say_if_with("ada",
                "The marshals will come now. I hope that was worth it.",
                vec![flag_eq("ch4_stance", "force")],
                EmotionTag::Bitter,
            ),
            say_if_with("eli",
                "The filings bought us time. Whether the family I burned \
                 forgives us is another matter.",
                vec![flag_eq("ch4_stance", "con")],
                EmotionTag::Quiet,
            ),
            say_if_with("rosa",
                "You used tricks where blood or iron would have been honest.",
                vec![flag_eq("ch4_stance", "con")],
                EmotionTag::Bitter,
            ),
            say_if_with("ada",
                "The evidence held. The water data shows both families are \
                 being poisoned by the same geology the diversion worsened.",
                vec![flag_eq("ch4_stance", "negotiate")],
                EmotionTag::Neutral,
            ),
            say_if_with("rosa",
                "Talk works until it doesn't. But you tried. I'll give you that.",
                vec![flag_eq("ch4_stance", "negotiate")],
                EmotionTag::Quiet,
            ),
        ],
        vec![
            choice("Continue", vec![], to_scene("rh_chapter_close")),
        ],
        vec![],
    )
}

/// Chapter close — Rosa joins permanently.
pub fn chapter_close() -> Scene {
    scene_with_memory(
        "rh_chapter_close", "varela_country", "4_6",
        PacingTag::Intimate,
        vec![
            say_with("rosa",
                "The sheriff's trail goes through country I know better than \
                 you. And my mother can't hold the land alone while the paper \
                 keeps moving.",
                EmotionTag::Neutral,
            ),
            say_if_with("rosa",
                "You stood. That's enough to ride with. For now.",
                vec![flag_eq("ch4_stance", "force")],
                EmotionTag::Quiet,
            ),
            say_if_with("rosa",
                "I don't trust your methods. But I trust you're still walking \
                 the right direction.",
                vec![flag_eq("ch4_stance", "con")],
                EmotionTag::Bitter,
            ),
            say_if_with("rosa",
                "You tried the decent thing first. That's rarer than you think.",
                vec![flag_eq("ch4_stance", "negotiate")],
                EmotionTag::Quiet,
            ),
            narrate_with(
                "Rosa joins the party. Not as friendship. As territorial necessity.",
                EmotionTag::Neutral,
            ),
        ],
        vec![],
        vec![
            StateEffect::AddPartyMember(CharacterId::new("rosa")),
            set_flag("rosa_joined", true),
            set_flag("ch4_complete", true),
        ],
        vec![
            MemoryRef {
                object: MemoryObjectId::new("ropehouse_damage"),
                callback_type: MemoryCallbackType::Echo,
                target_chapter: Some(ChapterId::new("ch10")),
            },
        ],
    )
}

// ─── Encounter ─────────────────────────────────────────────────────

/// The Ropehouse fight — the first full 4-person party battle.
/// Inside: tight quarters, rope work, cover play.
/// Outside: wider yard, positioning, disruption.
pub fn ropehouse_encounter() -> Encounter {
    Encounter {
        id: EncounterId::new("ropehouse_fight"),
        phases: vec![
            // Phase 1 — Inside the Ropehouse
            CombatPhase {
                id: "inside".to_string(),
                description: "Tight quarters. Benches, table, rope coil. \
                              Rosa's territory.".to_string(),
                enemies: vec![
                    enemy_full("rail_enforcer_a", "Rail Enforcer", 28, 20, 9, 55, 7, 15, 6),
                    enemy_full("rail_enforcer_b", "Rail Enforcer", 26, 18, 8, 52, 8, 15, 6),
                ],
                npc_allies: vec![],
                entry_conditions: vec![],
                phase_effects: vec![],
            },
            // Phase 2 — Outside in the yard
            CombatPhase {
                id: "yard".to_string(),
                description: "The fight opens into the wider yard. Fence lines, \
                              troughs, a wagon. Positioning matters.".to_string(),
                enemies: vec![
                    enemy_full("hired_gun_a", "Hired Gun", 30, 22, 10, 58, 7, 20, 7),
                    enemy_full("hired_gun_b", "Hired Gun", 28, 20, 9, 55, 6, 15, 6),
                    enemy("ranch_hand_ally_turned", "Panicked Bystander", 12, 5, 3, 25, 5),
                ],
                npc_allies: vec![],
                entry_conditions: vec![],
                phase_effects: vec![],
            },
        ],
        standoff: Some(Standoff {
            postures: vec![StandoffPosture::EarlyDraw, StandoffPosture::SteadyHand, StandoffPosture::Bait],
            allow_focus: true,
            eli_influence: true,
        }),
        party_slots: 4,
        terrain: Terrain {
            name: "The Ropehouse".to_string(),
            cover: vec![
                CoverElement { name: "Overturned bench".to_string(), durability: 20, destructible: true },
                CoverElement { name: "Judge's table".to_string(), durability: 40, destructible: true },
                CoverElement { name: "Yard fence".to_string(), durability: 30, destructible: true },
                CoverElement { name: "Stone trough".to_string(), durability: 80, destructible: false },
            ],
            hazards: vec![],
        },
        objectives: vec![
            Objective {
                id: "hold_ropehouse".to_string(),
                label: "Hold the Ropehouse".to_string(),
                objective_type: ObjectiveType::Primary,
                fail_consequence: vec![
                    set_flag("ropehouse_lost", true),
                ],
                success_consequence: vec![
                    set_flag("ropehouse_held", true),
                ],
            },
            Objective {
                id: "protect_witness".to_string(),
                label: "Protect the surveyor-witness".to_string(),
                objective_type: ObjectiveType::Secondary,
                fail_consequence: vec![
                    set_flag("witness_extracted", true),
                ],
                success_consequence: vec![
                    set_flag("witness_secured", true),
                ],
            },
        ],
        outcome_effects: vec![],
        escapable: true,
    }
}

// ─── Scene Registry ────────────────────────────────────────────────

pub fn get_scene(id: &str) -> Option<Scene> {
    match id {
        "rh_varela_approach" => Some(varela_approach()),
        "rh_homestead" => Some(homestead_scene()),
        "rh_water_claim" => Some(water_claim_scene()),
        "rh_ropehouse_approach" => Some(ropehouse_approach()),
        "rh_aftermath" => Some(ropehouse_aftermath()),
        "rh_chapter_close" => Some(chapter_close()),
        _ => None,
    }
}

pub fn get_encounter(id: &str) -> Option<Encounter> {
    match id {
        "ropehouse_fight" => Some(ropehouse_encounter()),
        _ => None,
    }
}