Sprint 14-B: Police Raid Mini-Game + Bail/Hospital Severity Scaling - #94
Merged
Merged
Conversation
POLICE RAID ENGINE (policeRaidEngine.ts) - Replaced tick-based engine with time-based rAF engine (advanceRaid, tapMember, evacProgress, secondsRemaining, caughtMembers, savedMembers, isTileThreatened) - Police units spawn top+bottom per occupied column, advance 1 row/second - Tap-to-evac mechanic: player taps deployed members to start 1.5s evacuation - Outcome resolves clean/partial/disaster based on caught vs saved ratio - estimateHeld() derives cash+drugs from incomePerTick for seizure calculation POLICE RAID COMPONENT (components/raid/PoliceRaidGame.tsx) - New 8x8 grid UI driven by rAF clock off performance.now() - Reads selectedBlockId from blockStore (no prop drilling) - Animated police unit tokens, member tap targets, evac progress bars - Outcome screen with jailed/saved/seized summary RAID REWARDS (components/raid/policeRaidRewards.ts) - applyRaidConsequences(): seizes cash (capped at balance), drains cheapest drugs first, jails caught members, resets block heat to POST_RAID_HEAT, removes caught members from block placements RAID TRIGGER (utils/raidTrigger.ts) - selectRaidTarget(): fires interactive raid when block heat >= 5 - suppressesBackgroundRaid(): prevents double-jailing same crew - Integrated into gameLoopEngine.ts tick BAIL/HOSPITAL SYSTEM (utils/bailHospitalSystem.ts) - severityTier(): 5-tier scale (0=minor..4=critical) for both bail and hospital - scaledBailCost(): base * severity multiplier * repeat-offense multiplier (capped) - scaledHospitalCost(): same formula keyed off damage taken - waitTicks(): base wait + severity + repeat-offense, capped at WAIT_TICKS_CAP - isLifer(): member with 5+ arrests is permanently jailed (no bail) - quoteRecovery(): full quote with cost, waitTicksRemaining, severityTier, lifer flag - updateHeldSince() / overdueMembers() / applyAbandonmentPenalty() preserved BAIL/HOSPITAL PANEL (components/contacts/BailHospitalPanel.tsx) - New panel showing all jailed/injured members with cost quotes - Displays wait time countdown, severity tier, lifer badge - Integrated into Contacts screen TOPDOWN POLICERAID (components/topdown/PoliceRaidGame.tsx) - Updated to use new time-based engine API (advanceRaid, tapMember, etc.) - Preserves blockId+onResolved props for BlockModeView integration TESTS (430 passing) - policeRaidEngine.test.ts: 28 tests covering all engine functions - bailHospitalSystem.test.ts: 47 tests covering severity tiers, cost scaling, wait times, lifer detection, detention tracking, abandonment penalties - policeRaid.test.ts: integration tests for raid consequences - vitest downgraded 4.x -> 2.1.8 for Vite 5 compatibility
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sprint 14-B — Police Raid Mini-Game + Bail/Hospital Severity Scaling
What's in this PR
Police Raid Engine (
policeRaidEngine.ts)Replaced the tick-based engine with a time-based rAF engine. Police units spawn top+bottom per occupied column and advance 1 row per second. The player taps deployed members to start a 1.5s evacuation window before the unit reaches them. Outcome resolves as
clean/partial/disasterbased on the caught-vs-saved ratio.Police Raid Component (
components/raid/PoliceRaidGame.tsx)New 8×8 grid UI driven by a single
requestAnimationFrameclock. ReadsselectedBlockIdfromblockStore(no prop drilling). Shows animated police unit tokens, member tap targets with evac progress bars, and a post-raid outcome screen with jailed/saved/seized summary.Raid Rewards (
components/raid/policeRaidRewards.ts)applyRaidConsequences()seizes cash (capped at balance), drains cheapest drugs first, jails caught members, resets block heat toPOST_RAID_HEAT, and removes caught members from block placements.Raid Trigger (
utils/raidTrigger.ts)selectRaidTarget()fires the interactive raid when block heat ≥ 5.suppressesBackgroundRaid()prevents double-jailing the same crew. Integrated into the game loop tick.Bail/Hospital System (
utils/bailHospitalSystem.ts)Per your spec — damage/charges determine cost, prior arrests/hospitalizations increase both cost and wait time:
severityTier(): 5-tier scale (0=minor → 4=critical) for both bail and hospitalscaledBailCost(): base × severity multiplier × repeat-offense multiplier (capped)scaledHospitalCost(): same formula keyed off damage takenwaitTicks(): base wait + severity + repeat-offense, capped atWAIT_TICKS_CAPisLifer(): member with 5+ arrests is permanently jailed — no bail possiblequoteRecovery(): full quote with cost,waitTicksRemaining,severityTier, lifer flagBail/Hospital Panel (
components/contacts/BailHospitalPanel.tsx)New panel in Contacts showing all jailed/injured members with cost quotes, wait time countdown, severity tier badge, and lifer indicator.
Tests — 430 passing ✅
policeRaidEngine.test.ts: 28 tests (engine functions, unit movement, catch/evac logic)bailHospitalSystem.test.ts: 47 tests (severity tiers, cost scaling, wait times, lifer detection, detention tracking, abandonment penalties)policeRaid.test.ts: integration tests for raid consequences