Repository navigation
refactor: unify transport point calculation - #138
Conversation
There was a problem hiding this comment.
Review:
No actionable findings.
The refactor preserves prior behavior in src/utils/transport.ts and the new src/utils/transport-adapter.ts: per-fleet flooring, the ship-type and equipment-category tables, the tank item-bonus table and the unscaled Kinu bonus, HP/retreat eligibility (retreat IDs are member ship IDs), expansion-slot de-duplication (transformToLibBattleClass nulls the ex slot inside poi_slot and exposes it only as poi_slot_ex), and the cargo-presence display gate all reproduce the pre-refactor implementation. The sole behavioral change is the intended one: deliverable (and thus the view's actual) now grants the Kinu +8 whenever an eligible Kinu participates instead of binding it to the first Kinu in array order, so a retreated first Kinu no longer suppresses a still-present second one. The recorded 205/446/468 fixtures still hold under the normalized input path.
There was a problem hiding this comment.
Review:
No actionable findings.
The direct-from-Poi calculateTransport path reproduces the pre-refactor behavior: the ship-type and equipment-category tables, the tank 0.75 base scaling plus item-specific bonuses, per-fleet Math.floor (verified against the recorded 205 / 446 fixtures), HP/retreat eligibility, and the cargo-presence gate on total all match the prior implementation. The only functional change is the intended one: the Kinu Kai Ni +8 is now granted whenever an eligible Kinu participates rather than being bound to the first Kinu in array order, so a retreated first Kinu no longer suppresses a still-present second one. Expansion-slot and empty-slot handling stays single-count through the aligned selector arrays, and the removed getTransportPoint / getTransportPointFromFleets entry points have no remaining callers (utils/index.ts re-exports the module, but nothing imports the deleted symbols).
There was a problem hiding this comment.
Review:
No actionable findings.
The extracted TransportPoints component (src/views/transport-points.tsx:66) reproduces the pre-extraction path exactly: the hasTransportCargo && planned > 0 visibility gate, the deliverable / planned label, and the Math.floor(deliverable * 0.7) A-rank tooltip all match the former displayedTP/shownTP logic in battle-view-area.tsx, and the moved inEvent/escapedShipId/tankTransportMaps selectors are unchanged. calculateTransport (src/utils/transport.ts:191) keeps per-fleet flooring, reads ship type/equipment category from master data and identity/HP from member data, counts the expansion slot once, and grants the unscaled Kinu +8 once per task force; the only functional change is the intended one where an eligible Kinu retains the bonus when another Kinu retreated. git grep confirms the removed getTransportPoint/getTransportPointFromFleets/transportPoints/isTankTransportMap/TPResult exports have no remaining callers, and the new vitest.config.ts host-module stubs are only consumed by the new test (no other test imports those host modules), so no reachable correctness, security, or CI defect is introduced.
Summary
Consolidate ordinary and tank transport into one formula-driven calculation, using Poi's existing ship and equipment member/master pairs directly. TP no longer depends on lib-battle view models, a TP adapter, or intermediate normalized objects.
Implements the refactoring suggestion on #137, updated to use existing Poi inputs without an adapter.
Scope and evidence
This does not introduce new map rules or a landing-point snapshot mechanism. Eligibility still uses Poi member HP rather than simulated battle HP. Existing rounding and Kinu behavior are preserved without presenting them as fully established source rules.
The formula document was recovered, and the complete ordinary/tank tables on Zekamashi were rechecked on 2026-09-15. The Japanese Wiki recheck was blocked by a verification page; its earlier 2026-09-01 notes are retained with that limitation stated. The English Wiki was not rechecked this time.
Validation
npm run validatepassed: typecheck, lint, full coverage suite, production build, Storybook build, and package dry-run.Existing non-failing module-type and Storybook chunk-size warnings remain. The package dry-run also includes local generated coverage/Storybook output under the existing packaging configuration; those outputs are not included in this PR, and packaging changes are out of scope.