This commit is contained in:
tresabhi committed 2026-11-11 23:23:53 -06:00
1 parent cf0a1dd1ab
commit 4097730803
9 files changed
+98 -8

No files matched your search

+4 -1
View File
@@ -37,7 +37,8 @@
"hp_s": "{value}hp/s",
"m3": "{value}m³",
"plus": "+{value}",
"fraction": "{numerator} / {denominator}"
"fraction": "{numerator} / {denominator}",
"interval": "{min} - {max}"
},
"tanks": {
@@ -154,7 +155,9 @@
"dpm_effective": "Effective by 60s",
"dpm_peekaboo": "Peek-a-boo",
"damage": "Damage",
"damage_range": "Range",
"module_damage": "Module damage",
"module_damage_range": "Range",
"reload": "Reload",
"reloads": "Reloads",
"clipping_potential": "Clipping potential",
@@ -88,7 +88,7 @@
&[data-variant="surface"],
&[data-variant="soft"] {
background-color: var(--accent-4);
background-color: var(--accent-a3);
color: var(--gray-12);
}
@@ -1,3 +1,4 @@
import type { Vector2Tuple } from "three";
import { metaSortTank, SEARCH_KEYS } from "@blitzkit/core";
import { literals } from "@blitzkit/i18n/src/literals";
import type { TankDefinition } from "@blitzkit/protos";
@@ -134,6 +135,14 @@ export const TankSearch = memo<TankSearchProps>(
break;
}
case CharacteristicType.Interval: {
const [low, high] = value as Vector2Tuple;
sortValue = (low + high) / 2;
break;
}
case CharacteristicType.NumberList: {
const values = value as number[];
if (values.length === 0) {
+42 -3
View File
@@ -1,3 +1,4 @@
import type { Vector2Tuple } from "three";
import {
blitzkitToBlitzShellKind,
isExplosive,
@@ -19,6 +20,7 @@ import {
*/
const PEEKABOO_MIN_CYCLE = 10;
// characteristics prefixed with an underscore are compute time only; they are never rendered
export const characteristics = {
gun_type: {
type: CharacteristicType.Enum,
@@ -66,7 +68,6 @@ export const characteristics = {
},
},
// characteristics prefixed with an underscore are compute time only; they are never rendered
_reload_coefficient: {
type: CharacteristicType.Number,
@@ -240,7 +241,35 @@ export const characteristics = {
},
},
// damage_range: unavailable,
// damage rolls within +-25% unless tungsten tips raise the lower end
_damage_spread: {
type: CharacteristicType.Interval,
compute({ script }) {
let low = 0.75;
let high = 1.25;
script("protagonist", "TungstenTip", (effect) => {
low = effect.minDamageFactor;
high = effect.maxDamageFactor;
});
return [low, high] satisfies Vector2Tuple;
},
},
damage_range: {
type: CharacteristicType.Interval,
compute({ characteristic }): Vector2Tuple {
const [low, high] = characteristic("_damage_spread") as Vector2Tuple;
// damage already folds in the average of the spread
const base = (characteristic("damage") as number) / ((low + high) / 2);
return [base * low, base * high];
},
},
module_damage: {
type: CharacteristicType.Number,
@@ -255,7 +284,17 @@ export const characteristics = {
},
},
// module_damage_range: unavailable,
module_damage_range: {
type: CharacteristicType.Interval,
compute({ characteristic }): Vector2Tuple {
const [low, high] = characteristic("_damage_spread") as Vector2Tuple;
const base =
(characteristic("module_damage") as number) / ((low + high) / 2);
return [base * low, base * high];
},
},
clip_size: {
type: CharacteristicType.Number,
@@ -96,9 +96,21 @@ export const characteristicsGroups: CharacteristicsGroup[] = [
indent: true,
},
{ name: "damage", decimals: 0, units: "hp", localize: true },
{ name: "damage_range", decimals: 0, units: "hp", localize: true },
{
name: "damage_range",
decimals: 0,
units: "hp",
localize: true,
indent: true,
},
{ name: "module_damage", decimals: 0, units: "hp", localize: true },
{ name: "module_damage_range", decimals: 0, units: "hp", localize: true },
{
name: "module_damage_range",
decimals: 0,
units: "hp",
localize: true,
indent: true,
},
{
name: "reload",
decimals: 1,
@@ -236,7 +248,7 @@ export const characteristicsGroups: CharacteristicsGroup[] = [
ranking: CharacteristicRanking.LowerIsBetter,
},
{ toy: "aim_time" },
// { toy: "aim_time" },
],
},
@@ -1,3 +1,4 @@
import type { Vector2Tuple } from "three";
import { literalsArray } from "@blitzkit/i18n/src/literals";
import { Fragment, type ReactNode } from "react";
import { Text } from "../components/Text";
@@ -59,6 +60,20 @@ export function useCharacteristicRenderer() {
case CharacteristicType.Number:
return renderNumber(characteristic as number, config.units);
case CharacteristicType.Interval: {
const [low, high] = characteristic as Vector2Tuple;
const rendered = literalsArray(strings.units.interval, {
min: renderNumber(low, undefined),
max: renderNumber(high, undefined),
});
if (config.units === undefined) return rendered;
return literalsArray(strings.units[config.units], {
value: <Text>{rendered}</Text>,
});
}
case CharacteristicType.NumberList: {
const values = (characteristic as number[]).map((value, index) => (
<Fragment key={index}>
@@ -1,3 +1,4 @@
import type { Vector2Tuple } from "three";
import { characteristics as characteristicDefinitions } from "../config/characteristics";
import { characteristicsGroups } from "../config/characteristicsGroups";
import {
@@ -40,6 +41,10 @@ function rankingValue(
case CharacteristicType.Number:
return value as number;
case CharacteristicType.Interval:
const [a, b] = value as Vector2Tuple;
return (a + b) / 2;
case CharacteristicType.NumberList: {
const values = value as number[];
@@ -8,6 +8,7 @@ import {
const sortableCharacteristicTypes = new Set<CharacteristicType>([
CharacteristicType.Number,
CharacteristicType.NumberList,
CharacteristicType.Interval,
]);
export const sortableCharacteristics = new Set<CharacteristicName>();
@@ -11,6 +11,7 @@ import type {
TurretDefinition,
} from "@blitzkit/protos";
import type { ReactNode } from "react";
import type { Vector2Tuple } from "three";
import type { characteristics } from "../config/characteristics";
import type { toys } from "../config/toys";
import type { DuelSide } from "../hooks/useEquipment";
@@ -31,6 +32,10 @@ export type Characteristic = {
type: CharacteristicType.NumberList;
compute(context: CharacteristicContext): number[];
}
| {
type: CharacteristicType.Interval;
compute(context: CharacteristicContext): Vector2Tuple;
}
);
export type CharacteristicScript = (
@@ -68,6 +73,7 @@ export enum CharacteristicType {
Enum,
Number,
NumberList,
Interval,
}
export enum CharacteristicRanking {