Enforce Dupes Clause and Shiny Clause rules
Dupes Clause greys out Pokemon in the encounter modal whose evolution family has already been caught, preventing duplicate selections. Shiny Clause adds a dedicated Shiny Box and lets shiny catches bypass the one-per-route lock via a new is_shiny column on encounters and a /pokemon/families endpoint that computes evolution family groups. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -50,8 +50,12 @@ async def create_encounter(
|
||||
detail="Cannot create encounter on a parent route. Use a child route instead.",
|
||||
)
|
||||
|
||||
# Shiny clause: shiny encounters bypass the route-lock check
|
||||
shiny_clause_on = run.rules.get("shinyClause", True) if run.rules else True
|
||||
skip_route_lock = data.is_shiny and shiny_clause_on
|
||||
|
||||
# If this route has a parent, check if sibling already has an encounter
|
||||
if route.parent_route_id is not None:
|
||||
if route.parent_route_id is not None and not skip_route_lock:
|
||||
# Get all sibling routes (routes with same parent, including this one)
|
||||
siblings_result = await session.execute(
|
||||
select(Route).where(Route.parent_route_id == route.parent_route_id)
|
||||
@@ -99,6 +103,7 @@ async def create_encounter(
|
||||
nickname=data.nickname,
|
||||
status=data.status,
|
||||
catch_level=data.catch_level,
|
||||
is_shiny=data.is_shiny,
|
||||
)
|
||||
session.add(encounter)
|
||||
await session.commit()
|
||||
|
||||
Reference in New Issue
Block a user