feat(engine): add faction system for social emergence
- Add Factions model (optimists/fearful/neutral) - Implement classify_faction() based on stance thresholds - Add update_factions() to track faction distribution - Add apply_faction_influence() for faction→mood feedback - Integrate faction system into tick flow 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -44,6 +44,13 @@ class Stance(BaseModel):
|
||||
fear: float = Field(default=0.5, ge=0.0, le=1.0)
|
||||
|
||||
|
||||
class Factions(BaseModel):
|
||||
"""派系分布"""
|
||||
optimists: int = 0
|
||||
fearful: int = 0
|
||||
neutral: int = 0
|
||||
|
||||
|
||||
class AgentState(BaseModel):
|
||||
emotion: Emotion = Emotion.CALM
|
||||
goal: str = ""
|
||||
@@ -63,6 +70,7 @@ class WorldState(BaseModel):
|
||||
events: List[str] = Field(default_factory=list)
|
||||
global_meter: GlobalMeter = Field(default_factory=GlobalMeter)
|
||||
world_effects: List[WorldEffect] = Field(default_factory=list)
|
||||
factions: Factions = Field(default_factory=Factions)
|
||||
|
||||
|
||||
class Event(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user