fix: CrewShipFusion bug with SubroutineIndex (#2714)
All checks were successful
Build Docker image / docker-arm64 (push) Successful in 1m2s
Build Docker image / docker-amd64 (push) Successful in 51s
Build / build (push) Successful in 2m19s

Crewship fusion didn't agree with player's choice.

Expected results: ![image.png](/attachments/a61c96c7-1624-4dd4-9e4c-c6199d5af95a)

What I actually get: ![image.png](/attachments/cf58aed4-18d9-4d97-8894-6c53762f366d)

```
export interface ICrewShipComponentFingerprint extends IInnateDamageFingerprint {
    SubroutineIndex?: number;
}
```

The interface already demand SubroutineIndex to exist, so it would be unnecessary to check.

Meanwhile, inferiorFingerprint.SubroutineIndex could be 0, 1, 2... and might be handled incorrectly as true/ false.

Co-authored-by: AlexisinGit <136088944+AlexisinGit@users.noreply.github.com>
Reviewed-on: #2714
Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com>
Co-authored-by: AlexisinGit <alexisingit@noreply.localhost>
Co-committed-by: AlexisinGit <alexisingit@noreply.localhost>
This commit is contained in:
AlexisinGit 2025-08-28 05:50:28 -07:00 committed by Sainan
parent 5a2fa2c2c3
commit a2171c80a5

View File

@ -81,7 +81,7 @@ export const crewShipFusionController: RequestHandler = async (req, res) => {
const newFval = (newPerc - rangeA[0]) / (rangeA[1] - rangeA[0]);
buffA.Value = Math.trunc(newFval * 0x3fffffff);
}
if (inferiorFingerprint.SubroutineIndex) {
if (inferiorFingerprint.SubroutineIndex !== undefined) {
const useSuperiorSubroutine = tierA < tierB ? !payload.UseSubroutineA : payload.UseSubroutineA;
if (!useSuperiorSubroutine) {
fingerprint.SubroutineIndex = inferiorFingerprint.SubroutineIndex;