# Teams, Rules, and Rewards

## Purpose
This document covers team modeling, round rule timing/conditions, and score/credit side effects.

## Authority map
- Team model registry: `Code/Game/Teams/Teams.cs`
  - Team registration, lookup, cleanup, and win-condition tick dispatch.
- Team behavior base: `Code/Game/Teams/BaseTeam.cs`
  - Team alignment, player membership, adversary rules, and win checks.
- Player team state: `Code/Game/Teams/TeamComponent.cs`
  - Synced `TeamEnum` on each player.
- Team assignment: `Code/Game/Teams/TeamAssigner.cs`
  - Assigns active participants into team distribution each round start.
- Win condition bridge: `Code/Game/Teams/TeamWinConditions.cs`
  - Connects team win checks into round-end condition flow.
- Round timing and game progression rules: `Code/Game/Round/RoundRulesSystem.cs`
  - Wait-for-players, prepare phase, round timers, haste rules, max rounds.
- Reward side effects: `Code/Game/Teams/RewardSystem.cs`
  - Score/credit rewards with live-round policy gating.

## Runtime behavior
- Team assignment happens for lifecycle-active participants (`PreRound`/`Playing`).
- Round rules system controls:
  - start gate (`MinPlayerCount`, postpone),
  - prepare duration,
  - round time and haste adjustments,
  - end-of-round delay.
- Team wins are checked continuously through `IRoundEndCondition` execution.
- Score/credit side effects are filtered through `RoundEventPolicy`.

## Team secrecy/alignment
- Team alignment (`Innocent`/`Traitor`/etc.) is modeled in `BaseTeam`.
- Team visibility and ally/adversary checks are centralized in team logic and used by UI/voice/chat gating flows.

## Related docs
- Host loop and dispatch: `Code/Core/Documentation/game-loop.md`
- Lifecycle participation: `Code/Core/Documentation/lifecycle.md`
- UI context/team perception: `Code/Core/Documentation/ui-architecture.md`

