Compare commits

...
3 Commits
Author SHA1 Message Date
tresabhi 5b4ad95a14 clean up a bit 2026-09-06 21:06:02 -05:00
tresabhi fe7282aae7 Merge branch 'main' into data-driven 2026-09-06 20:58:34 -05:00
tresabhi 84f950ade4 fix tag0 assumption 2026-09-02 16:32:46 -05:00
4 changed files with 27 additions and 34 deletions

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
# BlitzKit 1.31.2
This update fixes an issue that occurred with Wargaming chose to declare the class of a tank in the game code with a tag that isn't the first in the list.
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "blitzkit",
"version": "1.31.1",
"version": "1.31.2",
"license": "BlitzKit License",
"private": true,
"scripts": {
@@ -339,6 +339,17 @@ export abstract class ServerBlitzKitAPI1 extends ServerBlitzKitAPI0 {
equalizer = { health, penetration, module_health, damage, armor };
}
const blitzTankClass = tankTags.find(
(tag) => tag in this.blitzTankClassToBlitzkit,
);
if (blitzTankClass === undefined) {
throw new Error(`Unknown tank class for ${nation}:${tankKey}`);
}
const tankClass =
this.blitzTankClassToBlitzkit[blitzTankClass as BlitzTankClass];
tankDefinitions.tanks[tankId] = {
ancestors: [],
successors: [],
@@ -368,7 +379,7 @@ export abstract class ServerBlitzKitAPI1 extends ServerBlitzKitAPI0 {
? TankType.TANK_TYPE_PREMIUM
: TankType.TANK_TYPE_RESEARCHABLE,
tier: tank.level,
class: this.blitzTankClassToBlitzkit[tankTags[0] as BlitzTankClass],
class: tankClass,
testing: tankTags.includes("testTank"),
deprecated: tankTags.includes("deprecated"),
price: tankPrice,
+11 -32
View File
@@ -24,42 +24,21 @@ export const characteristics = {
},
},
assault_damage_coefficient: {
type: CharacteristicType.Number,
compute({ gun, shell, assault_distance }) {
if (
!gun.assault_ranges ||
!gun.assault_ranges.types.includes(shell.type)
) {
return 1;
}
return (
gun.assault_ranges.ranges.find(
({ distance }) => distance >= assault_distance,
)?.factor ?? 0
);
},
},
armor_damage_coefficient: {
type: CharacteristicType.Number,
compute() {
let coefficient = 1;
return coefficient;
},
},
damage: {
type: CharacteristicType.Number,
compute({ characteristic, shell, equalizer }) {
compute({ characteristic, gun, shell, equalizer, assault_distance }) {
let coefficient = 1;
coefficient *= characteristic("armor_damage_coefficient") as number;
coefficient *= characteristic("assault_damage_coefficient") as number;
if (gun.assault_ranges && gun.assault_ranges.types.includes(shell.type)) {
const match = gun.assault_ranges.ranges.find(
({ distance }) => distance >= assault_distance,
);
if (match !== undefined) {
coefficient *= match.factor;
}
}
coefficient *= equalizer.damage;
return coefficient * shell.armor_damage;