Skip to content

Add UPON_COOLDOWN_SET bonus end type for Energy Drink#2356

Open
kanyaveral wants to merge 1 commit intomainfrom
urco.upon-cooldown-energy-drink
Open

Add UPON_COOLDOWN_SET bonus end type for Energy Drink#2356
kanyaveral wants to merge 1 commit intomainfrom
urco.upon-cooldown-energy-drink

Conversation

@kanyaveral
Copy link
Contributor

@kanyaveral kanyaveral commented Feb 11, 2026

Summary

  • Introduces UPON_COOLDOWN_SET end type so cooldown bonuses (Energy Drink) live on a separate path from harvest bonuses
  • LibBonus.resetUponCooldownSet() is called after every resetCooldown() in: HarvestStart, HarvestCollect, HarvestStop, HarvestLiquidate
  • Client updated to query and display the new end type ("til next cooldown")
  • clearAll() updated to include the new type

Bugs Fixed

  1. Feeding wasted Energy Drink — regular food called resetUponHarvestAction which wiped the drink's bonus, even though feeding never sets cooldown
  2. Liquidation exploit — killer's cooldown bonus was never consumed, giving permanent -30s cooldown across repeated kills

Notion Data Change Required

In the allos table, update the COOLDOWN-30s row's Terminator column:

UPON_HARVEST_ACTION  →  UPON_COOLDOWN_SET

Without this data change, the Energy Drink will still register under the old end type and the code fix won't take effect.

Summary by CodeRabbit

Release Notes

  • New Features
    • Added a new bonus expiration type that triggers when cooldowns reset. Bonuses of this type will automatically expire during all harvest-related operations, including collecting items, liquidating resources, starting new harvests, and stopping ongoing harvests. This mechanic enables time-sensitive strategic gameplay elements tied to cooldown cycles and management.

Energy Drink's COOLDOWN-30s bonus was incorrectly routed through
UPON_HARVEST_ACTION, causing two bugs:

1. Feeding regular food wiped the drink (feed resets harvest bonuses
   but never sets cooldown — bonus destroyed for nothing)
2. Liquidation never consumed it (killer gets permanent -30s cooldown
   as long as they keep killing without collecting)

New UPON_COOLDOWN_SET end type is consumed after every resetCooldown()
call: deploy, collect, stop, and liquidate. Feeding no longer touches it.
@vercel
Copy link

vercel bot commented Feb 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
kamigotchi-client Ready Ready Preview, Comment Feb 11, 2026 7:48pm

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 11, 2026

Walkthrough

The pull request adds support for a new bonus end type, UPON_COOLDOWN_SET, enabling bonuses to be cleared when cooldowns are set. Changes span client-side bonus handling (getters and parsing) and contract-side bonus reset logic across multiple harvest systems.

Changes

Cohort / File(s) Summary
Client bonus handling
packages/client/src/app/cache/bonus/getters.ts, packages/client/src/network/shapes/Bonus/interpretation.ts
Added UPON_COOLDOWN_SET case to bonus end-type getter and interpreter; displays "til next cooldown" in UI.
Contract bonus library
packages/contracts/src/libraries/LibBonus.sol
Introduced new public function resetUponCooldownSet to unassign bonuses with UPON_COOLDOWN_SET anchor; integrated into clearAll for consistent bonus cleanup.
Harvest system integrations
packages/contracts/src/systems/HarvestCollectSystem.sol, packages/contracts/src/systems/HarvestLiquidateSystem.sol, packages/contracts/src/systems/HarvestStartSystem.sol, packages/contracts/src/systems/HarvestStopSystem.sol
Added calls to LibBonus.resetUponCooldownSet after cooldown resets in harvest operations, triggering bonus consumption on cooldown set events.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • chlwys
  • JirAcheron
  • Xenofluxx

Poem

🐰 A cooldown sets, and bonuses fade,
Through systems aligned, the changes cascade,
From client to contracts, a synchronized quest—
UPON_COOLDOWN_SET handles all the rest! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add UPON_COOLDOWN_SET bonus end type for Energy Drink' clearly and specifically summarizes the main change: introducing a new bonus end type with a concrete example (Energy Drink). It is directly related to the primary objective of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch urco.upon-cooldown-energy-drink

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants