AgentSkillsCN

Encounter Designer

遭遇设计师

SKILL.md

Encounter Designer Skill

RPG Pipeline Only — This skill creates combat encounter data files using a CRPG engine encounter schema with enemy composition, victory/defeat conditions, environmental hazards, and loot tables. For non-RPG games, adapt the encounter structure to your game's challenge system. The encounter design methodology applies broadly to any game with structured challenges.

Workflow Context

FieldValue
Assigned Agentcontent-architect
Sprint PhasePhase B (Implementation) — parallel with developer agents
Directory Scopedata/encounters/
GenreRPG / CRPG only
Schema DependencyRequires crpg_engine/schemas/encounter_schema.json
Workflow ReferenceSee docs/agent-team-workflow.md

This skill creates encounter data files (.json) that define combat encounters, boss fights, ambushes, and other challenge events. It generates balanced encounters with appropriate enemies, rewards, and conditions that integrate with quests and the world.

IMPORTANT: This skill generates encounter files that conform to the official schema at: crpg_engine/schemas/encounter_schema.json

Always reference this schema for the authoritative definitions.


Skill Hierarchy Position

code
                    ┌─────────────────────────────┐
                    │      GAME IDEATOR           │
                    │   (Creative Foundation)      │
                    │                             │
                    │   Outputs: docs/design/     │
                    │   • world-bible.md          │
                    │   • narrative-bible.md      │
                    │   • design-pillars.md       │
                    └─────────────────────────────┘
                                 │
                    ┌─────────────────────────────┐
                    │   NARRATIVE ARCHITECT       │
                    │   (Story & Character Detail)│
                    │                             │
                    │   Outputs: docs/narrative/  │
                    │   • character-profiles.md   │
                    │   • quest-hooks.md          │
                    └─────────────────────────────┘
                                 │
         ┌───────────────────────┼───────────────────────┐
         ▼                       ▼                       ▼
┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│ WORLD           │    │ CHARACTER       │    │ QUEST           │
│ BUILDER         │    │ CREATOR         │    │ DESIGNER        │
│                 │    │                 │    │                 │
│ → .worldmap.json│    │ → .char files   │    │ → .json quests  │
└─────────────────┘    └─────────────────┘    └─────────────────┘
         │                       │                       │
         └───────────────────────┼───────────────────────┘
                                 │
                    ┌────────────┴────────────┐
                    ▼                         ▼
         ┌─────────────────┐       ┌─────────────────┐
         │ DIALOGUE        │       │ ENCOUNTER       │  ◄── THIS SKILL
         │ DESIGNER        │       │ DESIGNER        │
         │ → .dtree files  │       │ → .json files   │
         └─────────────────┘       └─────────────────┘
                    │                         │
                    └────────────┬────────────┘
                                 ▼
                    ┌─────────────────────────────┐
                    │     CAMPAIGN CREATOR        │
                    │   (Assembles all content)   │
                    │                             │
                    │   → data/campaigns/*.json   │
                    └─────────────────────────────┘

WORKFLOW PATHS:
─────────────────────────────────────────────────────────────────
INCREMENTAL: Use individual skills to create content piece by piece
             character-creator (enemies) → encounter-designer → ...

BULK:        Use test-campaign-generator + test-campaign-scaffolder
             for rapid campaign generation from specifications
─────────────────────────────────────────────────────────────────

CRITICAL: What This Skill Does and Does NOT Do

code
+------------------------------------------+------------------------------------------+
|              THIS SKILL DOES             |          THIS SKILL DOES NOT DO         |
+------------------------------------------+------------------------------------------+
| Create .json encounter files             | Create enemy character files            |
| Define enemy composition and positioning | (use character-creator for that)        |
|                                          |                                          |
| Set victory/defeat conditions            | Create quest files                      |
| Configure environmental hazards          | (use quest-designer for that)           |
|                                          |                                          |
| Define rewards (gold, XP, loot)          | Create dialogue files                   |
| Set trigger conditions                   | (use dialogue-designer for that)        |
|                                          |                                          |
| Configure boss phases and behaviors      | Create location/worldmap files          |
| Link dialogues for intro/victory scenes  | (use world-map-builder for that)        |
|                                          |                                          |
| Save encounter files to data/encounters/ | Scaffold entire campaigns               |
|                                          | (use test-campaign-scaffolder for that) |
+------------------------------------------+------------------------------------------+

When to Use This Skill

Invoke this skill when the user:

  • Says "create encounter for [quest/location]" or "design a combat encounter"
  • Asks to "generate a boss fight for [enemy/location]"
  • Says "use encounter-designer"
  • Wants to create ambushes, random encounters, or scripted battles
  • Needs combat encounters referenced by quests

DO NOT use this skill if:

  • User wants to create enemy characters (use character-creator)
  • User wants to create quests (use quest-designer)
  • User wants to create dialogues (use dialogue-designer)

Prerequisites

Before running this skill, check for:

  1. Enemy characters (required):

    • Enemy .char files must exist in data/characters/enemies/
    • Check for enemy IDs that will be used in the encounter
  2. Quest context (if quest-linked):

    • Quest file should exist or be planned
    • Know the objective that triggers this encounter
  3. Location context (recommended):

    • Location ID where encounter occurs
    • Understanding of the environment for hazards/terrain

If enemy characters don't exist, note them as dependencies to be created.


Phase 0: Input Mode Selection

ALWAYS start by asking how the user wants to provide encounter information:

markdown
## Encounter Designer Session

How would you like to define your encounter(s)?

**Input Mode:**
- [ ] **Quest-linked** - Create an encounter for a specific quest objective
- [ ] **Location-based** - Design encounters for a specific location/area
- [ ] **Enemy-focused** - Build an encounter around specific enemies or a boss
- [ ] **Type-based** - Create a specific encounter type (ambush, wave defense, etc.)
- [ ] **D&D/Tabletop Import** - Translate encounters from D&D or other tabletop modules
- [ ] **Random Table** - Generate random encounter tables for a region

Select your preferred input mode to continue.

Wait for user response before proceeding to the appropriate phase.


Phase 0-DND: D&D/Tabletop Encounter Import

If user selects D&D/Tabletop Import:

markdown
## D&D Encounter Import

I'll help you translate D&D encounters into CRPG engine format.

**Source Information:**
1. What D&D module/adventure are these encounters from?
2. Do you have specific encounter descriptions to translate?
3. What's the expected party level in D&D terms?

**Provide encounter details:**
- Copy/paste the encounter description from your module
- OR describe the encounter setup (enemies, location, conditions)
- OR list monster names and quantities

D&D to CRPG Encounter Translation

D&D ElementCRPG EquivalentConversion Notes
Monster nameenemy_id referenceCreate .char file first via character-creator
Number of creaturescount in enemies arrayDirect mapping
Challenge Rating (CR)difficulty + level_rangeSee CR conversion table
Lair actionsenvironment.hazardsAs periodic effects
Legendary actionsboss.phases[].abilitiesAs boss phase abilities
Terrain/coverenvironment.terrain_effectsAs modifiers
Treasurerewards.itemsConvert to CRPG items
XP rewardrewards.experienceCR × 100 base

CR to Difficulty Conversion

D&D CRParty LevelCRPG DifficultyLevel Range
CR 1/8 - 1/41trivialmin: 1, max: 1
CR 1/2 - 11-2easymin: 1, max: 2
CR 2-32-4normalmin: 2, max: 4
CR 4-54-6hardmin: 4, max: 6
CR 6-86-8deadlymin: 5, max: 8
CR 9+8+nightmaremin: 7, max: 10

D&D Monster to CRPG Enemy Mapping

Common D&D monsters and their CRPG equivalents:

D&D MonsterCRPG Enemy IDTypeNotes
Skeletonenemy_skeleton_warriorundeadBasic melee
Skeleton Archerenemy_skeleton_archerundeadRanged
Zombieenemy_zombieundeadSlow, tough
Banditenemy_bandit_thughumanoidBasic melee
Bandit Captainenemy_bandit_captainhumanoidLeader type
Orcenemy_orc_warriorhumanoidAggressive
Orc War Chiefenemy_orc_warchiefhumanoidBoss type
Wolfenemy_wolfbeastPack tactics
Dire Wolfenemy_dire_wolfbeastLarger, tougher
Manticoreenemy_manticoremonstrosityBoss, ranged + melee
Dragon (Young)enemy_young_dragondragonMajor boss
Dragon (Adult)enemy_adult_dragondragonEnd-game boss

Note: If the D&D monster doesn't have a CRPG equivalent, use character-creator first to create the enemy .char file.

Dragons of Icespire Peak Encounter Examples

D&D EncounterCRPG IDEnemiesDifficultyLocation
Dwarven Excavation - Ochre Jelliesenc_dwarven_excavation_jellies2× ochre_jellynormalloc_dwarven_excavation
Gnomengarde - Mimicsenc_gnomengarde_mimics2× mimichardloc_gnomengarde
Umbrage Hill - Manticoreenc_umbrage_hill_manticore1× manticorehardloc_umbrage_hill
Mountain's Toe - Wereratsenc_mountains_toe_wererats4× wereratnormalloc_mountains_toe
Axeholm - Bansheeenc_axeholm_banshee1× bansheedeadlyloc_axeholm
Dragon Barrow - Undeadenc_dragon_barrow_undead6× skeleton, 2× ghoulhardloc_dragon_barrow
Icespire Hold - Cryovainenc_cryovain_boss1× young_white_dragondeadlyloc_icespire_hold

D&D Condition to CRPG Effect Mapping

D&D ConditionCRPG EffectDuration
Frightenedfearturns or until save
Poisonedpoisonturns with damage
Paralyzedstunturns or until save
Proneknockdownuntil stand action
Restrainedimmobilizeturns or until escape
Blindedblindturns or until cure

Input

The skill accepts encounter requests in several forms:

  1. Quest-linked: "Create the ambush encounter for MQ03"
  2. Location-based: "Design a random encounter for the forest road"
  3. Enemy-focused: "Create a boss fight with the Shadow Guardian"
  4. Type-based: "I need a defense encounter with waves of enemies"

Output

File Location

data/encounters/[encounter_id].json

Naming Conventions

  • Quest encounters: enc_[quest_id]_[description].json
  • Boss encounters: enc_[boss_name]_boss.json
  • Random encounters: enc_[location]_random.json
  • Ambush encounters: enc_[location]_ambush.json
  • Wave/Defense: enc_[location]_wave_[number].json

Schema Reference

Schema: crpg_engine/schemas/encounter_schema.json

Required Top-Level Fields

json
{
  "id": "encounter_id",           // Unique identifier (lowercase, underscores)
  "display_name": "Display Name", // Name shown to players
  "encounter_type": "combat"      // Type of encounter
}

Encounter Types

TypeUse CaseTypical Settings
combatStandard fightNormal victory/defeat
bossMajor enemy battleSpecial conditions, phases
ambushSurprise attackEnemy advantage, positioning
trapEnvironmental dangerHazards, skill checks
puzzleNon-combat challengeCustom victory conditions
eventScripted sequenceDialogue-heavy, choices
scriptedCutscene battleFixed outcomes possible
environmentalNature/hazard focusSurvival conditions
socialSocial confrontationDialogue resolution possible

Difficulty Levels

LevelDescriptionEnemy StrengthTypical Level Range
trivialTutorial/warmupVery weak1 below party
easyLow challengeSlightly weakParty level
normalStandard fightBalancedParty level
hardSignificant challengeStrongParty level +1
deadlyHigh risk of failureVery strongParty level +2
nightmareExtreme challengeOverwhelmingParty level +3
scaledAdjusts to partyDynamicVaries

Enemy Entry Definition

json
{
  "character_id": "enemy_id",      // Reference to .char file
  "count": 3,                      // Fixed count
  "count_range": {"min": 2, "max": 4}, // OR random range
  "level_offset": 0,               // Level adjustment (-2 to +3 typical)
  "position": "front",             // Starting position
  "behavior": "aggressive",        // AI behavior
  "is_leader": false,              // Is this the encounter leader?
  "is_optional": false,            // Required for victory?
  "spawn_condition": {             // Conditional spawn
    "leader_health_below": 0.5
  }
}

Position Values

PositionDescription
frontFront line, first engaged
backBack line, protected
flank_leftLeft flank position
flank_rightRight flank position
randomRandom placement
ambushHidden until triggered

Behavior Values

BehaviorDescription
aggressivePrioritizes attacking, pursues
defensiveProtects self and allies
supportFocuses on buffs/heals
flee_when_hurtRetreats at low HP
protect_leaderGuards the leader enemy

Ally Entry Definition

For encounters where NPCs fight alongside the party:

json
{
  "character_id": "ally_npc_id",
  "permanent": false,              // Joins party permanently after?
  "must_survive": true             // Death causes encounter failure?
}

Trigger Conditions

Define when/how the encounter activates:

json
{
  "trigger_conditions": {
    "quest_active": "quest_id",        // Quest must be active
    "quest_complete": "quest_id",      // Quest must be completed
    "objective_active": "obj_id",      // Specific objective active
    "objective_complete": "obj_id",    // Specific objective complete
    "flag_set": ["flag1", "flag2"],    // Flags that must be set
    "flag_not_set": ["blocked_flag"],  // Flags that must NOT be set
    "time_of_day": ["night", "dusk"],  // Required time
    "weather": ["rain", "storm"],      // Required weather
    "party_size_min": 2,               // Minimum party members
    "party_level_min": 3,              // Minimum average level
    "random_chance": 0.25,             // 25% chance to trigger
    "cooldown": 120,                   // Minutes between repeats
    "max_occurrences": 3               // Maximum times this can occur
  }
}

Victory Conditions

json
{
  "victory": {
    "defeat_all_enemies": true,        // Must kill all enemies
    "defeat_leader": false,            // Only need to kill leader
    "survive_turns": 5,                // Survive X turns to win
    "reach_location": "exit_point",    // Reach map location
    "protect_target": "npc_id",        // Keep NPC alive
    "custom": "script_condition"       // Custom script condition
  }
}

Common Victory Patterns

PatternConfiguration
Standard combatdefeat_all_enemies: true
Boss killdefeat_leader: true, defeat_all_enemies: false
Survivalsurvive_turns: X
Escortprotect_target: "npc_id" + reach location
Escapereach_location: "exit"

Defeat Conditions

json
{
  "defeat": {
    "party_wipe": true,               // All party members fall
    "protagonist_death": false,       // Main character death = loss
    "npc_death": "protected_npc",     // Specific NPC death = loss
    "time_limit": 10,                 // Fail after X turns
    "custom": "script_condition"      // Custom script condition
  }
}

Rewards Definition

json
{
  "rewards": {
    "gold": 150,
    "xp": 400,
    "loot_table": "bandit_loot",       // Random loot table ID
    "guaranteed_items": [
      {"item_id": "boss_key", "quantity": 1},
      {"item_id": "health_potion", "quantity": 2}
    ],
    "reputation": [
      {"faction": "village", "change": 10},
      {"faction": "bandits", "change": -20}
    ],
    "unlock_abilities": ["ability_id"],
    "bonus_conditions": [
      {
        "condition": "no_party_deaths",
        "gold_bonus": 50,
        "xp_bonus": 100,
        "item_bonus": "bonus_item_id"
      },
      {
        "condition": "under_3_turns",
        "xp_bonus": 150
      }
    ]
  }
}

Bonus Condition Types

ConditionDescription
no_party_deathsNo party members fell
under_X_turnsCompleted in X turns or less
no_items_usedNo consumables used
no_damage_takenPerfect run
stealth_approachStarted from stealth

Environment Settings

json
{
  "environment": {
    "terrain": "difficult",           // Terrain type
    "lighting": "dim",                // Lighting conditions
    "hazards": [
      {
        "type": "fire",
        "damage": 10,
        "interval": 2,
        "positions": ["northwest", "center"]
      }
    ],
    "cover_positions": ["pillar_1", "crate_stack"],
    "escape_route": true              // Can party flee?
  }
}

Terrain Types

TerrainEffect
normalNo movement penalty
difficultReduced movement speed
waterSwimming required, penalties
lavaDamage when traversed
iceSlippery, chance to fall
mudHeavy movement penalty
sandLight movement penalty

Lighting Types

LightingEffect
brightFull visibility
normalStandard visibility
dimReduced perception
darkHeavily obscured
magical_darknessDarkvision doesn't help

Hazard Types

HazardDescription
fireBurns, damage over time
poison_gasPoison damage, debuffs
falling_rocksRandom falling damage
lightningPeriodic lightning strikes
freezingCold damage, slow
spikesGround traps

Dialogue Hooks

Connect dialogues to encounter events:

json
{
  "dialogue": {
    "intro": "dialogue_id",           // Before combat starts
    "victory": "dialogue_id",         // After winning
    "defeat": "dialogue_id",          // After losing (if not game over)
    "surrender_offer": "dialogue_id", // If enemies can surrender
    "mid_combat": [
      {
        "trigger": "enemy_leader_50_health",
        "dialogue_id": "boss_phase2_dialogue"
      },
      {
        "trigger": "turn_5",
        "dialogue_id": "reinforcements_dialogue"
      }
    ]
  }
}

Mid-Combat Triggers

Trigger PatternDescription
enemy_leader_50_healthLeader at 50% HP
enemy_leader_25_healthLeader at 25% HP
ally_deathAny ally falls
turn_XSpecific turn number
enemy_count_XX enemies remaining

Flags

json
{
  "flags_set_on_complete": [
    "encounter_cleared",
    "boss_defeated"
  ],
  "flags_set_on_defeat": [
    "party_lost_battle"
  ]
}

Other Settings

json
{
  "one_time": true,                   // Can only occur once
  "can_flee": true,                   // Party can attempt escape
  "flee_penalty": {
    "gold_loss": 50,
    "item_loss_chance": 0.1
  },
  "scales_with_level": false,         // Enemy levels scale with party
  "music": "res://audio/music/boss.ogg",
  "ambience": "res://audio/ambient/dungeon.ogg",
  "map_scene": "res://scenes/combat/arena.tscn",
  "tags": ["boss", "undead", "act2"],
  "campaign_id": "campaign_name"
}

Workflow

Phase 1: Gather Context

Step 1.1: Identify the Purpose

Determine:

  • Is this linked to a quest? Which objective triggers it?
  • What's the narrative context? (ambush, boss fight, random encounter)
  • Where does it occur? (location_id)

Step 1.2: Identify Enemies

Check existing enemies in data/characters/enemies/:

  • List available enemy character IDs
  • Note if new enemies need to be created
  • Determine appropriate enemy levels

Step 1.3: Determine Difficulty

Based on:

  • Quest difficulty
  • Story importance
  • Player level expectations
  • Whether it's optional or required

Phase 2: Interactive Design

Ask the user targeted questions:

markdown
## Encounter Design: [Encounter Name]

**1. Basic Info**
- Display Name: [name shown to player]
- Type: combat / boss / ambush / trap / event / environmental / social
- Difficulty: trivial / easy / normal / hard / deadly / nightmare
- Level Range: min [X] - max [Y]

**2. Location & Trigger**
- Location ID: [where this occurs]
- Quest Link: [quest_id if applicable]
- Objective Trigger: [objective_id if applicable]
- Other Conditions: [flags, time of day, random chance]

**3. Enemy Composition**
What enemies should appear?
| Enemy ID | Count | Position | Behavior | Leader? |
|----------|-------|----------|----------|---------|
| [enemy_id] | [1-5] | [position] | [behavior] | [yes/no] |

**4. Victory Conditions**
How does the player win?
- [ ] Defeat all enemies
- [ ] Defeat the leader only
- [ ] Survive X turns
- [ ] Reach a location
- [ ] Protect an NPC
- [ ] Custom condition

**5. Defeat Conditions**
What causes failure?
- [ ] Party wipe (default)
- [ ] Protagonist death
- [ ] NPC death
- [ ] Time limit (turns)
- [ ] Custom condition

**6. Environment**
Any special conditions?
- Terrain: normal / difficult / water / etc.
- Lighting: bright / normal / dim / dark
- Hazards: [describe any environmental dangers]
- Can flee? [yes/no]

**7. Rewards**
- Gold: [amount]
- XP: [amount]
- Guaranteed Items: [list]
- Loot Table: [table_id or none]
- Bonus Conditions: [special achievement rewards]

**8. Dialogue Hooks**
Any dialogue during this encounter?
- Intro dialogue: [dialogue_id or none]
- Victory dialogue: [dialogue_id or none]
- Mid-combat triggers: [describe or none]

**9. Flags**
What flags should this set?
- On Victory: [list flags]
- On Defeat: [list flags]

Wait for user response before generating.

Phase 3: Encounter Generation

Step 3.1: Validate Dependencies

Before generating:

  • Verify enemy character_ids exist (or note as dependencies)
  • Verify location_id exists (or note as dependency)
  • Note any dialogues that need creation

Step 3.2: Generate Encounter File

Create the complete JSON structure following the schema.

Step 3.3: Save File

Save to: data/encounters/[encounter_id].json

Phase 4: Output Report

markdown
## Encounter Created

**File:** `data/encounters/[encounter_id].json`
**Type:** [Encounter Type]
**Difficulty:** [Difficulty] (Level [X]-[Y])

### Summary
- **Enemies:** [count] total ([breakdown by type])
- **Leader:** [leader enemy or "none"]
- **Victory:** [condition]
- **Can Flee:** [yes/no]

### Enemy Composition
| Enemy | Count | Position | Behavior |
|-------|-------|----------|----------|
| [name] | [count] | [position] | [behavior] |

### Rewards
- Gold: [amount]
- XP: [amount]
- Items: [list]
- Bonuses: [conditions]

### Dependencies (May Need Creation)
- [ ] Enemy: [enemy_id] - [if doesn't exist]
- [ ] Dialogue: [dialogue_id] - [if referenced]
- [ ] Location: [location_id] - [if doesn't exist]

### Integration Notes
- Triggered by: [quest/objective or conditions]
- Sets flags: [list]
- Link from quest: Add to quest's `encounters` array

### Testing Checklist
1. Verify all enemies load correctly
2. Test victory condition triggers
3. Test defeat condition triggers
4. Verify rewards are granted
5. Check flags are set
6. Test flee mechanics (if enabled)

Encounter Templates

Template: Simple Combat

json
{
  "_meta": {
    "created": "[date]",
    "modified": "[date]",
    "author": "Encounter Designer Skill",
    "campaign_id": "[campaign_id]",
    "notes": "[design notes]"
  },
  "id": "enc_[name]",
  "display_name": "[Display Name]",
  "description": "[Narrative description of the encounter]",
  "encounter_type": "combat",
  "difficulty": "normal",
  "level_range": {
    "min": 2,
    "max": 4
  },
  "location_id": "[location_id]",
  "enemies": [
    {
      "character_id": "[enemy_id]",
      "count": 3,
      "position": "front",
      "behavior": "aggressive",
      "is_leader": false,
      "is_optional": false
    }
  ],
  "victory": {
    "defeat_all_enemies": true
  },
  "defeat": {
    "party_wipe": true
  },
  "rewards": {
    "gold": 50,
    "xp": 150,
    "loot_table": "[loot_table_id]"
  },
  "one_time": true,
  "can_flee": true,
  "scales_with_level": false,
  "flags_set_on_complete": ["[encounter_id]_cleared"],
  "trigger_conditions": {
    "quest_active": "[quest_id]"
  }
}

CRITICAL: The campaign_id field in _meta is REQUIRED for editor filtering. Without it, the encounter won't appear in the Encounter Designer when filtering by campaign.

Template: Boss Encounter

json
{
  "_meta": {
    "created": "[date]",
    "modified": "[date]",
    "author": "Encounter Designer Skill",
    "campaign_id": "[campaign_id]",
    "notes": "Boss encounter with phases"
  },
  "id": "enc_[boss_name]_boss",
  "display_name": "[Boss Display Name]",
  "description": "[Epic description of the boss confrontation]",
  "encounter_type": "boss",
  "difficulty": "hard",
  "level_range": {
    "min": 5,
    "max": 8
  },
  "location_id": "[boss_arena_location]",
  "map_scene": "res://scenes/combat/[boss_arena].tscn",
  "enemies": [
    {
      "character_id": "[boss_enemy_id]",
      "count": 1,
      "position": "back",
      "behavior": "aggressive",
      "is_leader": true,
      "is_optional": false
    },
    {
      "character_id": "[minion_enemy_id]",
      "count": 2,
      "position": "front",
      "behavior": "protect_leader",
      "is_leader": false,
      "is_optional": true
    },
    {
      "character_id": "[reinforcement_id]",
      "count_range": {"min": 2, "max": 3},
      "position": "flank_left",
      "behavior": "aggressive",
      "is_optional": true,
      "spawn_condition": {
        "leader_health_below": 0.5
      }
    }
  ],
  "victory": {
    "defeat_leader": true,
    "defeat_all_enemies": false
  },
  "defeat": {
    "party_wipe": true,
    "protagonist_death": true
  },
  "environment": {
    "lighting": "dim",
    "terrain": "normal",
    "hazards": [
      {
        "type": "[hazard_type]",
        "damage": 10,
        "interval": 3,
        "positions": ["northwest", "southeast"]
      }
    ],
    "escape_route": false
  },
  "dialogue": {
    "intro": "[boss_intro_dialogue]",
    "victory": "[boss_victory_dialogue]",
    "mid_combat": [
      {
        "trigger": "enemy_leader_50_health",
        "dialogue_id": "[boss_phase2_dialogue]"
      }
    ]
  },
  "rewards": {
    "gold": 500,
    "xp": 1000,
    "guaranteed_items": [
      {"item_id": "[boss_drop_1]", "quantity": 1},
      {"item_id": "[boss_drop_2]", "quantity": 1}
    ],
    "bonus_conditions": [
      {
        "condition": "no_party_deaths",
        "xp_bonus": 250,
        "item_bonus": "[bonus_item]"
      }
    ]
  },
  "one_time": true,
  "can_flee": false,
  "scales_with_level": false,
  "music": "res://audio/music/boss_battle.ogg",
  "flags_set_on_complete": ["[boss_id]_defeated", "[area]_cleared"],
  "trigger_conditions": {
    "quest_active": "[quest_id]",
    "objective_active": "[objective_id]"
  }
}

Template: Ambush Encounter

json
{
  "_meta": {
    "created": "[date]",
    "modified": "[date]",
    "author": "Encounter Designer Skill",
    "campaign_id": "[campaign_id]",
    "notes": "Surprise attack encounter"
  },
  "id": "enc_[location]_ambush",
  "display_name": "[Ambush Name]",
  "description": "[Description of the ambush scenario]",
  "encounter_type": "ambush",
  "difficulty": "normal",
  "level_range": {
    "min": 3,
    "max": 5
  },
  "location_id": "[location_id]",
  "enemies": [
    {
      "character_id": "[ambusher_id]",
      "count": 2,
      "position": "ambush",
      "behavior": "aggressive",
      "is_leader": false,
      "is_optional": false
    },
    {
      "character_id": "[ambusher_leader_id]",
      "count": 1,
      "position": "back",
      "behavior": "defensive",
      "is_leader": true,
      "is_optional": false
    }
  ],
  "victory": {
    "defeat_all_enemies": true
  },
  "defeat": {
    "party_wipe": true
  },
  "rewards": {
    "gold": 75,
    "xp": 200,
    "loot_table": "[ambusher_loot]"
  },
  "one_time": true,
  "can_flee": true,
  "flee_penalty": {
    "gold_loss": 25,
    "item_loss_chance": 0.15
  },
  "scales_with_level": false,
  "flags_set_on_complete": ["[ambush_id]_survived"],
  "trigger_conditions": {
    "quest_active": "[quest_id]",
    "flag_not_set": ["[ambush_id]_avoided"]
  }
}

Template: Random/Repeatable Encounter

json
{
  "_meta": {
    "created": "[date]",
    "modified": "[date]",
    "author": "Encounter Designer Skill",
    "campaign_id": "[campaign_id]",
    "notes": "Random encounter for [area]"
  },
  "id": "enc_[location]_random_[type]",
  "display_name": "[Encounter Name]",
  "description": "[Description of the random encounter]",
  "encounter_type": "combat",
  "difficulty": "easy",
  "level_range": {
    "min": 1,
    "max": 5
  },
  "location_id": "[location_id]",
  "enemies": [
    {
      "character_id": "[common_enemy_id]",
      "count_range": {"min": 2, "max": 4},
      "position": "random",
      "behavior": "aggressive",
      "is_leader": false,
      "is_optional": false
    }
  ],
  "victory": {
    "defeat_all_enemies": true
  },
  "defeat": {
    "party_wipe": true
  },
  "rewards": {
    "xp": 75,
    "loot_table": "[random_loot]"
  },
  "one_time": false,
  "can_flee": true,
  "scales_with_level": true,
  "trigger_conditions": {
    "random_chance": 0.2,
    "time_of_day": ["dusk", "night"],
    "cooldown": 60,
    "max_occurrences": 5
  }
}

Template: Defense/Wave Encounter

json
{
  "_meta": {
    "created": "[date]",
    "modified": "[date]",
    "author": "Encounter Designer Skill",
    "campaign_id": "[campaign_id]",
    "notes": "Wave-based defense encounter"
  },
  "id": "enc_[location]_defense",
  "display_name": "[Defense Encounter Name]",
  "description": "[Description of what's being defended and why]",
  "encounter_type": "combat",
  "difficulty": "hard",
  "level_range": {
    "min": 4,
    "max": 7
  },
  "location_id": "[location_id]",
  "enemies": [
    {
      "character_id": "[wave1_enemy]",
      "count": 3,
      "position": "front",
      "behavior": "aggressive",
      "is_optional": false,
      "spawn_condition": {"wave": 1}
    },
    {
      "character_id": "[wave2_enemy]",
      "count": 4,
      "position": "flank_left",
      "behavior": "aggressive",
      "is_optional": false,
      "spawn_condition": {"wave": 2, "turn": 3}
    },
    {
      "character_id": "[wave3_leader]",
      "count": 1,
      "position": "back",
      "behavior": "aggressive",
      "is_leader": true,
      "is_optional": false,
      "spawn_condition": {"wave": 3, "turn": 6}
    }
  ],
  "allies": [
    {
      "character_id": "[defended_npc]",
      "permanent": false,
      "must_survive": true
    }
  ],
  "victory": {
    "defeat_all_enemies": true,
    "protect_target": "[defended_npc]"
  },
  "defeat": {
    "party_wipe": true,
    "npc_death": "[defended_npc]"
  },
  "rewards": {
    "gold": 200,
    "xp": 500,
    "guaranteed_items": [
      {"item_id": "[defense_reward]", "quantity": 1}
    ],
    "bonus_conditions": [
      {
        "condition": "no_party_deaths",
        "gold_bonus": 100,
        "xp_bonus": 150
      }
    ]
  },
  "one_time": true,
  "can_flee": false,
  "scales_with_level": false,
  "flags_set_on_complete": ["[location]_defended"],
  "flags_set_on_defeat": ["[location]_fell"],
  "trigger_conditions": {
    "quest_active": "[quest_id]",
    "objective_active": "[defense_objective]"
  }
}

Template: Escort Encounter

json
{
  "_meta": {
    "created": "[date]",
    "modified": "[date]",
    "author": "Encounter Designer Skill",
    "campaign_id": "[campaign_id]",
    "notes": "Encounter during escort quest"
  },
  "id": "enc_[escort]_attack",
  "display_name": "[Attack on Escort]",
  "description": "[Description of enemies attacking the escorted NPC]",
  "encounter_type": "ambush",
  "difficulty": "normal",
  "level_range": {
    "min": 3,
    "max": 5
  },
  "location_id": "[route_location]",
  "enemies": [
    {
      "character_id": "[attacker_id]",
      "count": 3,
      "position": "ambush",
      "behavior": "aggressive",
      "is_optional": false
    }
  ],
  "allies": [
    {
      "character_id": "[escort_npc]",
      "permanent": false,
      "must_survive": true
    }
  ],
  "victory": {
    "defeat_all_enemies": true,
    "protect_target": "[escort_npc]"
  },
  "defeat": {
    "party_wipe": true,
    "npc_death": "[escort_npc]"
  },
  "rewards": {
    "xp": 175,
    "loot_table": "[attacker_loot]"
  },
  "one_time": true,
  "can_flee": false,
  "flags_set_on_complete": ["escort_attack_repelled"],
  "flags_set_on_defeat": ["[escort_npc]_killed"],
  "trigger_conditions": {
    "quest_active": "[escort_quest]",
    "objective_active": "[escort_objective]"
  }
}

Integration with Other Skills

SkillRelationship
game-ideatorProvides tone/setting context from world-bible.md
narrative-architectProvides enemy concepts from character-profiles.md
character-creatorEnemy characters must exist in data/characters/enemies/
quest-designerQuests reference encounters in encounters array
dialogue-designerEncounter dialogues (intro, victory) need creation
world-builderLocations reference encounters in custom_data.encounter
campaign-creatorAssembles all content into final campaign
test-campaign-scaffolderReferences generated encounters for bulk creation

Workflow Paths

Incremental Content Creation (Piece by Piece):

code
1. character-creator → Create enemy .char files
2. encounter-designer → Create encounter .json files (THIS SKILL)
3. quest-designer → Create quests that reference encounters
4. dialogue-designer → Create intro/victory dialogues
5. world-builder → Create locations that reference encounters
6. campaign-creator → Assemble into final campaign

Bulk Content Creation (From Specification):

code
1. test-campaign-generator → Create campaign specification
2. test-campaign-scaffolder → Generate all files including encounters

D&D/Tabletop Import Path:

code
1. Use Phase 0-DND to translate D&D encounters
2. character-creator → Create missing enemy types
3. encounter-designer → Generate CRPG encounter files
4. Continue with quest/dialogue as needed

Balancing Guidelines

Enemy Count by Difficulty

Difficultyvs Party Size 1vs Party Size 2vs Party Size 3vs Party Size 4
Trivial1-2 weak2-3 weak3-4 weak4-5 weak
Easy2-33-44-55-6
Normal3-44-55-66-8
Hard4-5 + leader5-6 + leader6-8 + leader8-10 + leader
Deadly5+ strong6+ strong8+ strong10+ strong

Reward Scaling

DifficultyGold (base)XP (base)
Trivial10-2525-50
Easy25-5050-100
Normal50-100100-200
Hard100-250200-400
Deadly250-500400-800
Boss300-1000500-1500

Example Invocations

Standard Encounters:

  • "Create an encounter for the cellar rats quest"
  • "Design a boss fight with the Shadow Guardian"
  • "Generate a random wolf encounter for the forest"
  • "I need an ambush encounter on the road to the village"
  • "Create a wave defense encounter for the bridge"

D&D/Tabletop Import:

  • "Translate the Manticore encounter from Umbrage Hill"
  • "Import the Cryovain dragon fight from Dragons of Icespire Peak"
  • "Create CRPG encounters from my D&D module's Chapter 2"
  • "Convert this D&D encounter: 4 orcs and 1 orc war chief, CR 3"
  • "Translate the Gnomengarde mimic encounters"

Checklist Before Completing

  • Identified purpose and quest link (if applicable)
  • Verified enemy character IDs exist (or noted as dependencies)
  • Asked clarifying questions about composition/rewards/conditions
  • Generated valid JSON structure conforming to schema
  • _meta.campaign_id is set (CRITICAL for editor filtering!)
  • All enemy entries have valid character_ids
  • Victory and defeat conditions are appropriate
  • Rewards are balanced for difficulty
  • Trigger conditions are correct
  • Saved to data/encounters/[id].json
  • Listed dialogues/enemies that need creation
  • Provided integration notes for quest linking

Troubleshooting

Issue: Encounter doesn't trigger

Check:

  1. Trigger conditions are met (quest active, flags set)
  2. Location_id matches where player is
  3. For random encounters, random_chance and cooldown settings
  4. max_occurrences hasn't been reached

Issue: Enemies don't appear

Check:

  1. character_id matches existing .char file exactly
  2. Enemy .char file is in data/characters/enemies/
  3. spawn_condition (if used) can be met
  4. count or count_range is valid

Issue: Victory doesn't trigger

Check:

  1. Victory conditions match actual situation
  2. If defeat_leader is true, is_leader is set on an enemy
  3. If protect_target set, ally exists with that ID
  4. For survive_turns, turn count is correct

Issue: Rewards not granted

Check:

  1. rewards object is properly structured
  2. Item IDs in guaranteed_items exist
  3. loot_table reference is valid
  4. bonus_conditions have valid condition strings

Issue: Dialogue doesn't play

Check:

  1. dialogue_id references exist in data/dialogue/
  2. mid_combat triggers use valid trigger strings
  3. Dialogue hooks are in correct format