Skip to content

feat(fleets): add moonbreak, expedition and moon-lock formulas - #45

Merged
rolljee merged 1 commit into
masterfrom
feat/expedition-moonbreak-formulas
Oct 1, 2026
Merged

rolljee merged 1 commit into
masterfrom
feat/expedition-moonbreak-formulas

Conversation

@rolljee

@rolljee rolljee commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Short description of what this resolves:

og-bot-discord and ogame-ui each carry their own copy of the moonbreak (!mb), expedition (!oge) and moon-lock (!ogl) calculations. They agree today (25 edge cases compared, bot against site, all identical), but nothing keeps them in step. This moves the three calculations into the library, so both consumers can call the same code, and makes the expedition find account for the character class and the lifeform bonuses.

Changes proposed in this pull request:

  • Fleets.getMoonbreakWaves, getWaveChance, getMoonbreakChance, getMoonbreakLosses: unrounded values, loss bands clamped to the fleet. Pinned to the figures the bot and the site show.
  • Fleets.getExpeditionFindBase, getExpeditionMaxFind. The class is a parameter: only a Discoverer gets the class bonus (explorerBonusIncreasedExpeditionOutcome) and the economy speed. The lifeform Discoverer enhancement amplifies the class bonus, and the lifeform expedition resource bonus multiplies the find. Both are taken as the totals the in-game bonus page shows. A Discoverer with a Pathfinder and no lifeform bonus gives exactly today's figure.
  • Fleets.getCargoCapacity: Hyperspace Technology plus any other bonus (Collector, lifeform), all shares of the base cargo.
  • Fleets.getMoonLockShips: ships to destroy for the 2 000 000 debris threshold.
  • README: API reference for the new functions, and a note in Known gaps on how lifeform bonuses are taken.

Lint, tests (382) and tsc pass. This is a feat:, so the expected release is 4.1.0.

To check before merging. Two points of the expedition formula come from community tools, not from a first-party source:

  1. Classes other than Discoverer: the economy speed is not applied (as OGLight does).
  2. The lifeform Discoverer enhancement scales the 0.5 class bonus (×1.6 at 20 %), not the whole find (OGLight: ×1.8).

They deserve a check against a few real expedition reports.

Fixes: —

🤖 Generated with Claude Code

og-bot-discord and ogame-ui each carried their own copy of three
calculations: the moonbreak chance and Deathstar losses (`!mb`), the
expedition maximum find (`!oge`) and the ships a moon lock needs
(`!ogl`). They agree today — 25 edge cases compared, bot against site,
identical — but nothing kept them that way. They now live here, so both
can call the same code:

- getMoonbreakWaves, getWaveChance, getMoonbreakChance and
  getMoonbreakLosses, unrounded, the loss bands clamped to the fleet;
- getExpeditionFindBase and getExpeditionMaxFind;
- getCargoCapacity, Hyperspace Technology plus any other bonus;
- getMoonLockShips.

getExpeditionMaxFind also covers what both copies hard-coded or left
out. The class is a parameter: only a Discoverer gets the class bonus
(`explorerBonusIncreasedExpeditionOutcome` in serverData) and the
economy speed, any other class gets the base alone. The two lifeform
bonuses that touch the find are taken as the totals the in-game bonus
page shows: the Discoverer enhancement amplifies the class bonus, the
expedition resource bonus multiplies the whole find. A Discoverer with
a Pathfinder and no lifeform bonus gives exactly the figure the bot and
the site have always shown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rolljee
rolljee merged commit ab137c6 into master Oct 1, 2026
3 checks passed
@rolljee
rolljee deleted the feat/expedition-moonbreak-formulas branch October 1, 2026 15:39
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 4.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant