Skip to content

Commit

Permalink
Add flag to indicate n/a enemy not really sunk
Browse files Browse the repository at this point in the history
  • Loading branch information
sinsinpub committed Mar 11, 2023
1 parent a665eb9 commit 3dc46b5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions misc/kcSHIPDATA.js
Original file line number Diff line number Diff line change
Expand Up @@ -13545,7 +13545,7 @@ var SHIPDATA_ = {
unknownstats: true,
RNG: 5,
SPD: 5,
SLOTS: [30, 30, 28, 0, 0],
SLOTS: [18, 35, 35, 0, 0],
EQUIPS: [1617, 1618, 1619, 1632, 1608],
},
2147: {
Expand Down Expand Up @@ -13587,7 +13587,7 @@ var SHIPDATA_ = {
unknownstats: true,
RNG: 5,
SPD: 5,
SLOTS: [58, 58, 52, 0, 0],
SLOTS: [32, 68, 68, 0, 0],
EQUIPS: [1617, 1618, 1619, 1633, 1608],
},
2149: {
Expand Down
2 changes: 1 addition & 1 deletion src/library/modules/BattlePrediction.js
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,7 @@
// hp = "N/A" string implemented since event Spring 2023:
// under verification, known: client-side uses isNaN, invisible flag on, internal hp is 1;
// server-side rank S if others sunk, damage gauge uncertain
if (isNaN(ship.hp)) return Object.assign({}, ship, { hp: 0, sunk: true });
if (isNaN(ship.hp)) return Object.assign({}, ship, { hp: 0, sunk: true, inv: true });
return ship.hp < 0 ? Object.assign({}, ship, { hp: 0 }) : ship;
});

Expand Down
2 changes: 1 addition & 1 deletion src/library/modules/BattlePrediction/rank/Rank.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
// hp = "N/A" string implemented since event Spring 2023:
// under verification, known: client-side uses isNaN, invisible flag on, internal hp is 1;
// server-side rank S if others sunk, damage gauge uncertain
if (isNaN(ship.hp)) return Object.assign({}, ship, { hp: 0, sunk: true });
if (isNaN(ship.hp)) return Object.assign({}, ship, { hp: 0, sunk: true, inv: true });
return ship.hp < 0 ? Object.assign({}, ship, { hp: 0 }) : ship;
});

Expand Down
6 changes: 3 additions & 3 deletions src/library/objects/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -799,13 +799,13 @@ Used by SortieManager
}
result.fleets.enemyMain.forEach((ship, position) => {
this.enemyHP[position] = ship;
this.enemySunk[position] = ship.sunk;
this.enemySunk[position] = ship.sunk && !ship.inv;
});
result.fleets.enemyEscort.forEach((ship, index) => {
const position = index + 6;

this.enemyHP[position] = ship;
this.enemySunk[position] = ship.sunk;
this.enemySunk[position] = ship.sunk && !ship.inv;
});

this.unexpectedList = this.unexpectedList || [];
Expand Down Expand Up @@ -1079,7 +1079,7 @@ Used by SortieManager
const enemyResult = isAgainstEnemyEscort ? result.fleets.enemyEscort : result.fleets.enemyMain;
enemyResult.forEach((ship, position) => {
this.enemyHP[position] = ship;
this.enemySunk[position] = ship.sunk;
this.enemySunk[position] = ship.sunk && !ship.inv;
});

this.unexpectedList = this.unexpectedList || [];
Expand Down
4 changes: 2 additions & 2 deletions tests/library/modules/BattlePrediction/rank/Rank.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ QUnit.module('modules > BattlePrediction > Rank', function () {
{ hp: 0, sunk: true, dameConConsumed: false },
{ hp: 0, sunk: true, dameConConsumed: false },
{ hp: 0, sunk: true, dameConConsumed: false },
{ hp: 0, sunk: true, dameConConsumed: false },
{ hp: 0, sunk: true, dameConConsumed: false },
{ hp: 0, sunk: true, dameConConsumed: false, inv: true },
{ hp: 0, sunk: true, dameConConsumed: false, inv: true },
]);
});

Expand Down

0 comments on commit 3dc46b5

Please sign in to comment.