Repository navigation
feat(fleets): combat statistics, defense repair, moon chance and plunder - #47
Merged
Merged
Conversation
A unit left under 70% of its hull now gets an explosion roll on each shot that gets through, as in the game, instead of a single roll at the end of the round. Shots on a unit already wrecked this round are wasted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and plunder simulateCombat now reports, for each battle, the destroyed defenses that come back (repairFactor, 0.7 by default), the moon chance given by the debris field, and what a winning attacker carries away when `plunder` says what lies on the planet. Defenses can leave debris at their own defenseDebrisFactor. simulateCombats runs the same battle many times, and getCombatStatistics averages a set of results: share of wins, average losses, survivors, rebuilt defenses, lost resources, debris, moon chance and plunder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🎉 This PR is included in version 4.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Why
First building block of a combat simulator on ogame.rolljee.fr: the site needs averaged outcomes over many battles, not one random run.
What
simulateCombatnow also returns:defender.rebuilt: each destroyed defense comes back with arepairFactorchance (0.7 by default)moonChance: 1% per 100 000 debris, capped at 20%plunder: withoptions.plunder = { resources, ratio = 0.5, hyperspaceLevel, … }, what a winning attacker's survivors can carry (capacity viagetCargoCapacity), spread like the resources on the planetdefenseDebrisFactoroption (mapsdebrisFactorDefof serverData);defenseDebris: truekeeps workingsimulateCombats(attacker, defender, { runs, seed, … })andgetCombatStatistics(results): win shares, average rounds, survivors, losses, rebuilt defenses, lost resources (rebuilt defenses excluded), debris, moon chance, plunder.Non-breaking: new fields and functions only. Battles replayed with the same seed give different outcomes because of the explosion fix.
Known approximations (to validate against OSimulate)
Checks
npm run lint && npm test && npm run types: 399 tests pass.🤖 Generated with Claude Code