feat(engine): 实现阵营技能树系统
- 新增 FactionSkill、FactionSkillTree、FactionSkills 数据模型 - 创建 faction_skills.py 模块处理技能解锁和效果应用 - 技能解锁条件:power >= cost 且前置技能已解锁 - 技能效果:increase_positive_emotion、reduce_conflict、increase_fear、suppress_others - 添加 4 个技能树测试用例,全部 30 个测试通过 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -66,6 +66,25 @@ class Votes(BaseModel):
|
||||
voted_users: List[str] = Field(default_factory=list)
|
||||
|
||||
|
||||
class FactionSkill(BaseModel):
|
||||
"""单个技能"""
|
||||
unlocked: bool = False
|
||||
cost: int = 10
|
||||
effect: str = ""
|
||||
requires: List[str] = Field(default_factory=list)
|
||||
|
||||
|
||||
class FactionSkillTree(BaseModel):
|
||||
"""单个阵营的技能树"""
|
||||
skills: Dict[str, FactionSkill] = Field(default_factory=dict)
|
||||
|
||||
|
||||
class FactionSkills(BaseModel):
|
||||
"""所有阵营的技能树"""
|
||||
optimists: FactionSkillTree = Field(default_factory=FactionSkillTree)
|
||||
fearful: FactionSkillTree = Field(default_factory=FactionSkillTree)
|
||||
|
||||
|
||||
class FactionEventResult(BaseModel):
|
||||
"""阵营事件触发结果"""
|
||||
type: Optional[str] = None # "festival" | "panic" | None
|
||||
@@ -113,6 +132,7 @@ class WorldState(BaseModel):
|
||||
factions: Factions = Field(default_factory=Factions)
|
||||
story_arcs: Dict[str, StoryArc] = Field(default_factory=dict)
|
||||
votes: Votes = Field(default_factory=Votes)
|
||||
faction_skills: FactionSkills = Field(default_factory=FactionSkills)
|
||||
|
||||
|
||||
class Event(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user