Add campaign chapter metadata
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
- `scripts/core/battle_state.gd`: Battle rules, unit state, turns, AI, and victory checks.
|
||||
- `scripts/scenes/battle_scene.gd`: Rendering, input handling, and HUD wiring.
|
||||
- `audio/bgm/*.wav` and `audio/sfx/*.wav`: Placeholder music loops and interface/action stingers.
|
||||
- `data/campaign/campaign.json`: Campaign order and scenario paths.
|
||||
- `data/campaign/campaign.json`: Campaign chapter ranges, scenario order, and scenario paths.
|
||||
- `data/defs/*.json`: Officers, classes, terrain, items, and skills.
|
||||
- `data/scenarios/*.json`: Scenario definitions.
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
- `data/defs/items.json`: Weapons, armor, accessories, and consumables.
|
||||
- `data/defs/skills.json`: MP tactic definitions for damage, healing, target rules, and range.
|
||||
- `data/defs/terrain.json`: Terrain colors, defense, avoid, and movement costs.
|
||||
- `data/campaign/campaign.json`: Scenario sequence, titles, and resource paths.
|
||||
- `data/campaign/campaign.json`: Chapter ranges, scenario sequence, titles, and resource paths.
|
||||
- `data/scenarios/*.json`: Dialogue, deployments, rewards, and branching flags.
|
||||
|
||||
## Battle Loop
|
||||
@@ -35,7 +35,7 @@
|
||||
1. Load battle data.
|
||||
2. Hydrate deployments through `DataCatalog`.
|
||||
3. Dispatch battle-start scenario events.
|
||||
4. Show scenario briefing with the campaign battle header, objective summary, and optional pre-battle shop, Armory, Roster, and Formation setup.
|
||||
4. Show scenario briefing with the campaign chapter header, battle header, objective summary, and optional pre-battle shop, Armory, Roster, and Formation setup.
|
||||
5. Player selects a unit.
|
||||
6. Briefing completion dispatches battle-begin events, including opening dialogue.
|
||||
7. Unit moves, attacks, chooses a tactic or consumable item from the side menu, changes equipment, counters, gains EXP, levels up, promotes at class thresholds, or waits. Tactic buttons show MP cost, kind, range, and power or support effect. Physical attacks roll hit chance from unit agility and target terrain avoid; misses give reduced EXP. The scene plays placeholder SFX, a short movement slide, low-HP warning rings, hover target preview badges, and floating combat text for core action and UI feedback.
|
||||
@@ -58,6 +58,6 @@ Joined officers gate whether `requires_joined` player deployments are loaded at
|
||||
|
||||
Inventory and campaign flags are copied from `CampaignState` into `BattleState` when a scenario starts. Pre-battle shop stock comes from the loaded scenario's `shop.items` list plus matching `shop.conditional_items` blocks. Shop purchases and 50% sell-back are campaign transactions: they update saved gold and unequipped inventory immediately, write the save file, and refresh the already-loaded battle inventory before the player begins the battle. Pre-battle Armory equipment changes use the same equipment rules as battle HUD equipment changes, then immediately save merged roster equipment/stat snapshots and inventory stock. Pre-battle Roster uses scenario `roster.max_units`, `roster.required_officers`, and `roster.required_units` to mark optional player deployments as sortie or reserve; reserve units remain in the candidate list but are excluded from board occupancy, drawing, selection, AI targeting, and living-unit victory checks. Non-controllable player units can act as protected escort targets: enemies can attack them and conditions can reference them, but they are skipped by player selection, Armory, Formation, counterattacks, and campaign roster progression snapshots when `persist_progression` is false. Scenario `ai_target_priority` nudges enemy movement and damage-skill scoring toward important targets such as envoys without overriding defeat bonuses or range checks. Pre-battle Formation uses the loaded scenario's `formation.cells` and only mutates current battle unit positions before battle-begin events fire. Destination victory cells from `unit_reaches_tile` conditions are exposed to the scene for objective overlays and tile info. Movement-triggered `unit_reaches_tile` events receive the unit that just moved, so ambushes fire on entry rather than from units already standing on a marker. Briefing data can append matching `briefing.conditional_lines`, and scenario events can use `when.campaign_flags` to branch dialogue, objective changes, and reinforcements from saved campaign choices. Consumable use can restore HP or MP, and in-battle item use plus equipment swaps mutate only the battle copy until victory; defeats and restarts do not spend saved items or preserve in-battle gear changes. Post-battle choices write campaign `flags` only after the result-panel button is pressed; if the player reloads after rewards are saved but before selecting, the pending scenario id restores the victory choice panel without replaying rewards. The next battle button stays locked until the campaign choice save succeeds. Equipment rewards share the same `item_id -> count` inventory stock, cover weapon, armor, and accessory slots, can be equipped from the side HUD before the selected unit moves or acts, and do not appear in the consumable action menu. Already completed scenarios can be replayed without granting duplicate rewards, choices, or replay inventory consumption; pre-battle Shop, Armory, Roster, and Formation are disabled on completed-scenario replays to avoid side effects.
|
||||
|
||||
The battle scene owns presentation feedback: briefing and result states use menu BGM, briefing headers combine `CampaignState` campaign order and title data with `BattleState` briefing and objective text, active battles use battle BGM, dialogue lines can show optional portrait textures or speaker-initial fallback panels and can place the portrait on the left or right side of the dialogue panel, board units render low-HP warning rings and HP bar color states from battle state fields, hover previews are rendered as target badges from existing `BattleState` forecast APIs, log/result hooks trigger placeholder SFX, `BattleState.unit_motion_requested` asks the scene to interpolate a unit's draw position during movement, and `BattleState.combat_feedback_requested` asks the scene to draw transient floating combat text without changing battle rules.
|
||||
The battle scene owns presentation feedback: briefing and result states use menu BGM, briefing headers combine `CampaignState` chapter ranges, campaign order, and title data with `BattleState` briefing and objective text, active battles use battle BGM, dialogue lines can show optional portrait textures or speaker-initial fallback panels and can place the portrait on the left or right side of the dialogue panel, board units render low-HP warning rings and HP bar color states from battle state fields, hover previews are rendered as target badges from existing `BattleState` forecast APIs, log/result hooks trigger placeholder SFX, `BattleState.unit_motion_requested` asks the scene to interpolate a unit's draw position during movement, and `BattleState.combat_feedback_requested` asks the scene to draw transient floating combat text without changing battle rules.
|
||||
|
||||
The `New Campaign` button clears `user://campaign_save.json`, resets campaign state to the first scenario, and reloads the opening briefing.
|
||||
|
||||
@@ -82,7 +82,7 @@ data/scenarios/067_outer_islands.json
|
||||
|
||||
## Campaign
|
||||
|
||||
The campaign file defines scenario order, resource paths, and officers who are available at the start of a new campaign.
|
||||
The campaign file defines chapter ranges, scenario order, resource paths, and officers who are available at the start of a new campaign.
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -90,6 +90,14 @@ The campaign file defines scenario order, resource paths, and officers who are a
|
||||
"title": "Cao Cao Campaign",
|
||||
"start_scenario": "001_yellow_turbans",
|
||||
"initial_joined_officers": ["cao_cao", "xiahou_dun"],
|
||||
"chapters": [
|
||||
{
|
||||
"id": "rise_through_turmoil",
|
||||
"title": "Rise Through Turmoil",
|
||||
"start_scenario": "001_yellow_turbans",
|
||||
"end_scenario": "009_xiapi_siege"
|
||||
}
|
||||
],
|
||||
"scenarios": [
|
||||
{ "id": "001_yellow_turbans", "title": "Yingchuan Skirmish", "path": "res://data/scenarios/001_yellow_turbans.json" },
|
||||
{ "id": "002_sishui_gate", "title": "Sishui Gate Vanguard", "path": "res://data/scenarios/002_sishui_gate.json" },
|
||||
@@ -162,6 +170,8 @@ The campaign file defines scenario order, resource paths, and officers who are a
|
||||
}
|
||||
```
|
||||
|
||||
`chapters` are display metadata for campaign presentation. Each chapter has a stable lowercase `id`, non-empty `title`, and inclusive `start_scenario`/`end_scenario` ids from the linear scenario order. When chapters are present, the validator requires the ranges to cover every campaign scenario exactly once, without overlaps or gaps. `CampaignState` uses them for briefing headers and chapter-local battle numbering; save files still store scenario ids, not chapter ids.
|
||||
|
||||
## Officers
|
||||
|
||||
Officers hold identity, personal base stats, initial class, and starting equipment.
|
||||
@@ -479,4 +489,4 @@ Before a battle starts, `BattleScene` can buy priced items through `CampaignStat
|
||||
|
||||
When every campaign scenario id is present in `completed_scenarios`, the battle scene shows a campaign completion panel. Starting a new campaign clears the save file and resets `current_scenario_id` to `start_scenario`.
|
||||
|
||||
Run `tools/validate_data.ps1` after data edits to check campaign paths, map dimensions, terrain keys, class/officer/item/skill references, item effect names and amounts, equipment slot compatibility including accessory types, promotion routes and promotion equipment compatibility, condition/event names, condition unit references, destination condition coordinates, campaign flag references, joined-officer gates, briefing line blocks, deployment ids, deployment bounds, impassable spawn cells, shop stock, roster rules, formation cells, post-battle dialogue, post-battle choices, and reward item ids.
|
||||
Run `tools/validate_data.ps1` after data edits to check campaign paths, chapter ranges, map dimensions, terrain keys, class/officer/item/skill references, item effect names and amounts, equipment slot compatibility including accessory types, promotion routes and promotion equipment compatibility, condition/event names, condition unit references, destination condition coordinates, campaign flag references, joined-officer gates, briefing line blocks, deployment ids, deployment bounds, impassable spawn cells, shop stock, roster rules, formation cells, post-battle dialogue, post-battle choices, and reward item ids.
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
## Milestone 1: Playable Battle Prototype
|
||||
|
||||
- Scenario briefing before battle with a campaign battle header and objective summary.
|
||||
- Scenario briefing before battle with a campaign chapter header, battle header, and objective summary.
|
||||
- Select player units.
|
||||
- Show move and attack ranges.
|
||||
- Show hover tile and unit information.
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
## Milestone 3: Scenario Layer
|
||||
|
||||
- Pre-battle briefing exists with a campaign battle header and objective summary. Full dialogue scenes are still planned.
|
||||
- Pre-battle briefing exists with a campaign chapter header, battle header, and objective summary. Full dialogue scenes are still planned.
|
||||
- Scenario events exist for battle start, battle begin, turn start, and movement-triggered map tiles.
|
||||
- Mid-battle map/action events have a first action system with movement ambushes.
|
||||
- Opening battle dialogue exists through event actions.
|
||||
@@ -52,7 +52,7 @@
|
||||
- Party roster persistence has a first save-file skeleton.
|
||||
- Level, experience, and equipment persistence.
|
||||
- Chapter selection and save/load.
|
||||
- Linear sixty-seven-scenario campaign order exists.
|
||||
- Linear sixty-seven-scenario campaign order exists with chapter ranges for story arcs.
|
||||
- Save reset exists.
|
||||
- Victory rewards, consumable counts, equipment stock, and equipped gear persist.
|
||||
- A basic pre-battle shop with scenario-specific stock and 50% sell-back exists. Richer item management is still planned.
|
||||
@@ -134,7 +134,7 @@
|
||||
- Unit sprites and animations. Board movement now has a short slide animation, and board units show low-HP warning rings.
|
||||
- Battle effects. First floating combat text now covers damage, recovery, misses, support effects, level-ups, and promotions. Hover target preview badges summarize attacks, tactics, and items.
|
||||
- Music and sound. Basic placeholder BGM and SFX now play for menus, battle flow, unit actions, tactics, items, and result states.
|
||||
- Chapter UI and visual novel scenes. Pre-battle briefing now has a first campaign battle header, and dialogue lines can choose left or right portrait placement; chapter-aware numbering remains planned once chapter data exists.
|
||||
- Chapter UI and visual novel scenes. Pre-battle briefing now uses campaign chapter ranges for chapter-aware numbering, and dialogue lines can choose left or right portrait placement.
|
||||
|
||||
## Milestone 6: Content Expansion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user