feat(engine): add faction power system with event triggers

- Add FactionData model with power and members fields
- Add FactionEventResult model for faction event responses
- Add faction field to AgentState
- Implement faction classification based on emotion
- Add faction event triggers (festival/panic) when power >= 5
- Update StepResponse to include triggered_faction_event
- Add tests for new faction 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:
empty
2025-12-30 12:01:07 +08:00
parent 012956f817
commit 1fd318c9e3
6 changed files with 181 additions and 27 deletions

View File

@@ -2,12 +2,14 @@ from __future__ import annotations
from typing import List, Optional, Tuple
from .models import (
WorldState, AgentState, Event, Action, Emotion, Weather,
GlobalEventResult, GlobalEventInfo
GlobalEventResult, GlobalEventInfo, FactionEventResult
)
from .global_events import GLOBAL_EVENT_POOL, GlobalEvent
from .opinions import generate_opinions
from .social_influence import apply_social_influence
from .factions import update_factions, apply_faction_influence
from .factions import (
update_factions, apply_faction_influence, check_and_trigger_faction_event
)
MAX_EVENTS = 20
MAX_MEMORY_PER_AGENT = 3