feat(engine): add story arc system for narrative-driven world
- Add StoryArc and StoryEventResult models - Create story_arcs.py with progress tracking logic - Implement two story arcs: civil_unrest and golden_age - Progress updates based on faction power balance - Trigger story events when progress reaches threshold - Add 3 tests for story arc system 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -62,6 +62,23 @@ class FactionEventResult(BaseModel):
|
||||
source_faction: Optional[str] = None # "optimists" | "fearful"
|
||||
|
||||
|
||||
class StoryArc(BaseModel):
|
||||
"""剧情线"""
|
||||
progress: float = Field(default=0.0, ge=0.0, le=1.0)
|
||||
threshold: float = 1.0
|
||||
active: bool = True
|
||||
stage: int = 1 # 当前阶段
|
||||
description: str = ""
|
||||
|
||||
|
||||
class StoryEventResult(BaseModel):
|
||||
"""剧情事件触发结果"""
|
||||
triggered: bool = False
|
||||
arc_id: Optional[str] = None
|
||||
event_name: Optional[str] = None
|
||||
description: Optional[str] = None
|
||||
|
||||
|
||||
class AgentState(BaseModel):
|
||||
emotion: Emotion = Emotion.CALM
|
||||
goal: str = ""
|
||||
@@ -84,6 +101,7 @@ class WorldState(BaseModel):
|
||||
global_meter: GlobalMeter = Field(default_factory=GlobalMeter)
|
||||
world_effects: List[WorldEffect] = Field(default_factory=list)
|
||||
factions: Factions = Field(default_factory=Factions)
|
||||
story_arcs: Dict[str, StoryArc] = Field(default_factory=dict)
|
||||
|
||||
|
||||
class Event(BaseModel):
|
||||
@@ -120,3 +138,4 @@ class StepResponse(BaseModel):
|
||||
actions: List[Action]
|
||||
global_event: GlobalEventResult = Field(default_factory=GlobalEventResult)
|
||||
triggered_faction_event: FactionEventResult = Field(default_factory=FactionEventResult)
|
||||
story_event: StoryEventResult = Field(default_factory=StoryEventResult)
|
||||
|
||||
Reference in New Issue
Block a user