Files
nuzlocke-tracker/.beans/nuzlocke-tracker-bs0y--add-type-restriction-rules-monolocke.md

34 lines
1.9 KiB
Markdown
Raw Normal View History

---
# nuzlocke-tracker-bs0y
title: Add type restriction rules (monolocke)
status: in-progress
type: feature
priority: normal
created_at: 2026-02-20T19:56:16Z
updated_at: 2026-02-21T11:12:40Z
parent: nuzlocke-tracker-49xj
---
Restrict team composition to specific types (monolocke and similar variants).
## Design Decisions
**Type selection:** Multi-select from the 18 standard Pokemon types. A monolocke selects one type; multi-type variants (e.g., "fire and water only") select multiple.
**Dual-type matching:** A Pokemon qualifies if at least one of its types is in the allowed set. This matches the community standard for monolocke — e.g., in a Fire monolocke, Charizard (Fire/Flying) is allowed because it has Fire.
**Enforcement:** Soft enforcement via UI warnings, not hard blocks. The tracker warns when a caught Pokemon doesn't match the allowed types but doesn't prevent logging it. Reason: players sometimes need to use HM slaves or have edge cases the tracker shouldn't block.
**Data model:** Add `allowedTypes: string[]` to `NuzlockeRules`. Empty array means no restriction (disabled). This keeps it in the existing JSONB rules blob on the run.
**UI:** Add a "Type Restrictions" section to `RulesConfiguration` with a multi-select type picker (reuse the type badge styling from `TypeBadge`). Show a warning badge on encounters that don't match.
## Checklist
- [x] Add `allowedTypes: string[]` to `NuzlockeRules` interface (default: `[]`)
- [x] Add a new `BooleanRuleKeys` type to `RuleDefinition` to exclude non-boolean fields
- [x] Add type multi-select UI to `RulesConfiguration` (shown when allowedTypes toggle is on)
- [x] Show warning indicator on `PokemonCard` and encounter list for Pokemon that don't match allowed types
- [x] Add `RuleBadge` display for active type restriction (e.g., "Monolocke: Fire")
- [x] Update `RuleBadges` to handle `allowedTypes` separately from boolean rules