You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Weekly time totals, point allowances, and balances can now be negative. Future added time offsets deficits; free and gifted draws remain available.
Card effects now use combined time for applicable transfers and deductions. Charity, fixed 30-minute theft, and 50/50 gamble outcomes follow updated rules.
Weekly protection blocks other players’ harmful effects while still allowing beneficial effects.
Updates
Card draw rules now explain negative time and balances, draw eligibility, and updated card effects.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
Walkthrough
Weekly duration and point calculations now preserve negative values. Card effects, draw eligibility, and displayed rules use signed totals and balances. Tests cover these accounting changes and the updated card behavior.
Changes: Weekly economy and card behavior
Layer / File(s)
Summary
Signed duration and point accounting packages/shared/src/utils/weekly-economy.ts, apps/api/src/common/utils/weekly-economy.spec.ts, apps/api/src/modules/points/points.service.spec.ts, apps/api/src/modules/cards/card-storage.integration.spec.ts, apps/api/src/modules/cards/cards.service.spec.ts, apps/api/src/modules/assessment/assessment-engine.spec.ts, apps/api/src/modules/stats/stats.service.spec.ts
Comprehensive duration and point calculations no longer clamp negative values to zero. The tests cover signed adjustments, balances, and assessment totals.
Card effects and draw resolution apps/api/src/modules/cards/card-catalog.ts, apps/api/src/modules/cards/card-engine.ts, apps/api/src/modules/cards/card-engine.spec.ts, apps/api/src/modules/cards/card-complete-review.spec.ts, apps/api/src/modules/cards/card-storage.integration.spec.ts
Card effects use signed comprehensive duration. Immunity blocks harmful effects from other players but permits beneficial effects. Updated rules cover gamble, charity, thief, and arrows behavior, with tests for defenses, transfers, draws, and persistence.
Draw interface and published rules apps/web/src/pages/cards/CardsPage.tsx, apps/web/src/pages/cards/CardsPage.test.tsx, apps/web/src/features/cards/DrawRulesDialog.tsx, deploy/cards-assessment.md
The cards page displays negative balances and keeps free or gifted draws available when the balance is negative. The dialog and assessment document describe signed totals and updated card rules.
sequenceDiagram
participant CardEngine
participant resolveTarget
participant change
participant weeklyDrawPoints
CardEngine->>resolveTarget: Check harmful-effect immunity
CardEngine->>change: Apply signed time delta
change->>weeklyDrawPoints: Calculate signed point balance
weeklyDrawPoints-->>change: Return validated point balance
change-->>CardEngine: Store updated balance
Loading
Possibly related PRs
lec-org/LecPunch#13: Changes the same weekly-economy and card-engine rules, including duration clamping, balances, and immunity.
lec-org/LecPunch#12: Introduces the weekly card engine and accounting rules that this pull request updates.
Merge Risk: Minimal · up to 13e8b
The changed rules consistently allow negative balances while retaining paid-draw checks. No specific issue requiring a fix before merge is established; normal validation remains appropriate.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly identifies the main changes: correcting 赌枪 and 无懈可击 behavior and supporting negative point settlement.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 14 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
🧪 Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
ESLint
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
apps/api/src/common/utils/weekly-economy.spec.ts
ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.
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
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.
赌枪原来只有扣时或无事发生,无懈可击会拦截队友增益,部分转移仍只读取独立娱乐余额。本次调整卡牌结算,并让综合时长和抽卡积分的负差额直接显示。
变化
例如综合时长为-30分钟、已消费60积分时,显示余额-90;后续增加30分钟后余额为-60。免费/赠送机会可继续使用,但不能赊账付费抽卡。
验证
Follow-up to #13.
Summary by CodeRabbit