feat: characteristics

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
TrèsAbhiandCopilot committed 2026-04-28 22:31:28 -05:00
1 parent 7767481633
commit 249f62759e
3 files changed
+204 -61

No files matched your search

@@ -20,7 +20,6 @@ type Characteristic = (helpers: {
state: TankState;
tank: Tank;
parameters: StageParameters;
id: string;
}) => CharacteristicOutput;
export type CharacteristicName = keyof typeof characteristics;
@@ -409,8 +408,8 @@ export const characteristics = {
return tank.tank!.tank_type;
},
id({ id }) {
return id;
id({ state }) {
return state.id;
},
slug({ tank }) {
@@ -3,7 +3,7 @@ import {
ShellUpgradeSingleChange_AttributeName,
TankAttributeChange_AttributeName,
} from "@protos/game/proto/legacy/blitz_static_tank_upgrade_single_stage";
import { aggregateStageParameters } from "./aggregateParameters";
import { aggregateParameters } from "./aggregateParameters";
import {
characteristics,
type CharacteristicName,
@@ -16,15 +16,8 @@ export type ComputedCharacteristics = Record<
CharacteristicOutput
>;
export function computeCharacteristics(
id: string,
tank: Tank,
state: TankState,
) {
const parameters = aggregateStageParameters(
tank.tank!.base_stats!,
tank.tank!.upgrade_stages.slice(0, state.stage),
);
export function computeCharacteristics(tank: Tank, state: TankState) {
const parameters = aggregateParameters(tank.tank!, state.upgrades);
const computed: Partial<ComputedCharacteristics> = {};
@@ -94,7 +87,6 @@ export function computeCharacteristics(
state,
tank,
parameters,
id,
});
computed[name] = value;
}