feat(ui): Phase 30 ship-class calculator with goal-seek and reach circles
Tests · UI / test (push) Successful in 2m14s
Tests · Go / test (push) Successful in 2m25s

Fuse the standalone ship-class designer (Phases 17/18) into a sidebar calculator: live mass/speed/attack/defence/bombing results, a planet build-rate readout, single-target goal-seek, a modernization-cost mode, and auto reach circles on the map for the selected planet.

pkg/calc becomes the single source for the new math (no mirroring): extract BombingPower from the engine model and the per-turn ship-production loop from controller.ProduceShip into pkg/calc (engine now delegates), and add inverse goal-seek solvers in pkg/calc/solve.go. Thin-bridge the combat, planet-build, and solver functions through ui/core/calc + ui/wasm and rebuild core.wasm.

Remove the standalone designer view/route; the ship-classes table and the view/bottom menus open the calculator via a shared request store.

Docs: rewrite ui/PLAN.md Phase 30, adjust Phase 34 (realistic forecast + CAP/COL ownership), add ui/docs/calculator-ux.md, extend calc-bridge.md, fix navigation.md; remove ui/CALCULATOR.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilia Denisov
2026-05-21 19:52:08 +02:00
parent 00159ddf7c
commit 9ae7b88b89
53 changed files with 3748 additions and 1298 deletions
+23
View File
@@ -65,3 +65,26 @@ func CarryingMass(load, cargoTech float64) float64 {
func BlockUpgradeCost(blockMass, currentBlockTech, targetBlockTech float64) float64 {
return calc.BlockUpgradeCost(blockMass, currentBlockTech, targetBlockTech)
}
// EffectiveAttack wraps `calc.EffectiveAttack` (`pkg/calc/ship.go`):
// combat attack power of a ship, equal to its weapons block times the
// player's weapons tech.
func EffectiveAttack(weapons, weaponsTech float64) float64 {
return calc.EffectiveAttack(weapons, weaponsTech)
}
// EffectiveDefence wraps `calc.EffectiveDefence` (`pkg/calc/ship.go`):
// combat defence power of a ship, its shields block times the player's
// shields tech, normalised by the cube root of full mass (bigger hulls
// defend worse per shield point). Zero when defendingFullMass ≤ 0.
func EffectiveDefence(defendingShields, defendingShieldsTech, defendingFullMass float64) float64 {
return calc.EffectiveDefence(defendingShields, defendingShieldsTech, defendingFullMass)
}
// BombingPower wraps `calc.BombingPower` (`pkg/calc/ship.go`): the
// planet-bombing power of number ships with the given weapons block,
// weapons tech, and armament. The calculator passes number = 1 for a
// per-ship reading.
func BombingPower(weapons, weaponsTech, armament, number float64) float64 {
return calc.BombingPower(weapons, weaponsTech, armament, number)
}