mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-13 20:56:11 +01:00
ranges
This commit is contained in:
9 files changed
+98
-8
No files matched your search
@@ -37,7 +37,8 @@
|
|||||||
"hp_s": "{value}hp/s",
|
"hp_s": "{value}hp/s",
|
||||||
"m3": "{value}m³",
|
"m3": "{value}m³",
|
||||||
"plus": "+{value}",
|
"plus": "+{value}",
|
||||||
"fraction": "{numerator} / {denominator}"
|
"fraction": "{numerator} / {denominator}",
|
||||||
|
"interval": "{min} - {max}"
|
||||||
},
|
},
|
||||||
|
|
||||||
"tanks": {
|
"tanks": {
|
||||||
@@ -154,7 +155,9 @@
|
|||||||
"dpm_effective": "Effective by 60s",
|
"dpm_effective": "Effective by 60s",
|
||||||
"dpm_peekaboo": "Peek-a-boo",
|
"dpm_peekaboo": "Peek-a-boo",
|
||||||
"damage": "Damage",
|
"damage": "Damage",
|
||||||
|
"damage_range": "Range",
|
||||||
"module_damage": "Module damage",
|
"module_damage": "Module damage",
|
||||||
|
"module_damage_range": "Range",
|
||||||
"reload": "Reload",
|
"reload": "Reload",
|
||||||
"reloads": "Reloads",
|
"reloads": "Reloads",
|
||||||
"clipping_potential": "Clipping potential",
|
"clipping_potential": "Clipping potential",
|
||||||
|
|||||||
@@ -88,7 +88,7 @@
|
|||||||
|
|
||||||
&[data-variant="surface"],
|
&[data-variant="surface"],
|
||||||
&[data-variant="soft"] {
|
&[data-variant="soft"] {
|
||||||
background-color: var(--accent-4);
|
background-color: var(--accent-a3);
|
||||||
color: var(--gray-12);
|
color: var(--gray-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import type { Vector2Tuple } from "three";
|
||||||
import { metaSortTank, SEARCH_KEYS } from "@blitzkit/core";
|
import { metaSortTank, SEARCH_KEYS } from "@blitzkit/core";
|
||||||
import { literals } from "@blitzkit/i18n/src/literals";
|
import { literals } from "@blitzkit/i18n/src/literals";
|
||||||
import type { TankDefinition } from "@blitzkit/protos";
|
import type { TankDefinition } from "@blitzkit/protos";
|
||||||
@@ -134,6 +135,14 @@ export const TankSearch = memo<TankSearchProps>(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case CharacteristicType.Interval: {
|
||||||
|
const [low, high] = value as Vector2Tuple;
|
||||||
|
|
||||||
|
sortValue = (low + high) / 2;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case CharacteristicType.NumberList: {
|
case CharacteristicType.NumberList: {
|
||||||
const values = value as number[];
|
const values = value as number[];
|
||||||
if (values.length === 0) {
|
if (values.length === 0) {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import type { Vector2Tuple } from "three";
|
||||||
import {
|
import {
|
||||||
blitzkitToBlitzShellKind,
|
blitzkitToBlitzShellKind,
|
||||||
isExplosive,
|
isExplosive,
|
||||||
@@ -19,6 +20,7 @@ import {
|
|||||||
*/
|
*/
|
||||||
const PEEKABOO_MIN_CYCLE = 10;
|
const PEEKABOO_MIN_CYCLE = 10;
|
||||||
|
|
||||||
|
// characteristics prefixed with an underscore are compute time only; they are never rendered
|
||||||
export const characteristics = {
|
export const characteristics = {
|
||||||
gun_type: {
|
gun_type: {
|
||||||
type: CharacteristicType.Enum,
|
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: {
|
_reload_coefficient: {
|
||||||
type: CharacteristicType.Number,
|
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: {
|
module_damage: {
|
||||||
type: CharacteristicType.Number,
|
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: {
|
clip_size: {
|
||||||
type: CharacteristicType.Number,
|
type: CharacteristicType.Number,
|
||||||
|
|||||||
@@ -96,9 +96,21 @@ export const characteristicsGroups: CharacteristicsGroup[] = [
|
|||||||
indent: true,
|
indent: true,
|
||||||
},
|
},
|
||||||
{ name: "damage", decimals: 0, units: "hp", localize: 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", 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",
|
name: "reload",
|
||||||
decimals: 1,
|
decimals: 1,
|
||||||
@@ -236,7 +248,7 @@ export const characteristicsGroups: CharacteristicsGroup[] = [
|
|||||||
ranking: CharacteristicRanking.LowerIsBetter,
|
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 { literalsArray } from "@blitzkit/i18n/src/literals";
|
||||||
import { Fragment, type ReactNode } from "react";
|
import { Fragment, type ReactNode } from "react";
|
||||||
import { Text } from "../components/Text";
|
import { Text } from "../components/Text";
|
||||||
@@ -59,6 +60,20 @@ export function useCharacteristicRenderer() {
|
|||||||
case CharacteristicType.Number:
|
case CharacteristicType.Number:
|
||||||
return renderNumber(characteristic as number, config.units);
|
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: {
|
case CharacteristicType.NumberList: {
|
||||||
const values = (characteristic as number[]).map((value, index) => (
|
const values = (characteristic as number[]).map((value, index) => (
|
||||||
<Fragment key={index}>
|
<Fragment key={index}>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import type { Vector2Tuple } from "three";
|
||||||
import { characteristics as characteristicDefinitions } from "../config/characteristics";
|
import { characteristics as characteristicDefinitions } from "../config/characteristics";
|
||||||
import { characteristicsGroups } from "../config/characteristicsGroups";
|
import { characteristicsGroups } from "../config/characteristicsGroups";
|
||||||
import {
|
import {
|
||||||
@@ -40,6 +41,10 @@ function rankingValue(
|
|||||||
case CharacteristicType.Number:
|
case CharacteristicType.Number:
|
||||||
return value as number;
|
return value as number;
|
||||||
|
|
||||||
|
case CharacteristicType.Interval:
|
||||||
|
const [a, b] = value as Vector2Tuple;
|
||||||
|
return (a + b) / 2;
|
||||||
|
|
||||||
case CharacteristicType.NumberList: {
|
case CharacteristicType.NumberList: {
|
||||||
const values = value as number[];
|
const values = value as number[];
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
const sortableCharacteristicTypes = new Set<CharacteristicType>([
|
const sortableCharacteristicTypes = new Set<CharacteristicType>([
|
||||||
CharacteristicType.Number,
|
CharacteristicType.Number,
|
||||||
CharacteristicType.NumberList,
|
CharacteristicType.NumberList,
|
||||||
|
CharacteristicType.Interval,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const sortableCharacteristics = new Set<CharacteristicName>();
|
export const sortableCharacteristics = new Set<CharacteristicName>();
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import type {
|
|||||||
TurretDefinition,
|
TurretDefinition,
|
||||||
} from "@blitzkit/protos";
|
} from "@blitzkit/protos";
|
||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
|
import type { Vector2Tuple } from "three";
|
||||||
import type { characteristics } from "../config/characteristics";
|
import type { characteristics } from "../config/characteristics";
|
||||||
import type { toys } from "../config/toys";
|
import type { toys } from "../config/toys";
|
||||||
import type { DuelSide } from "../hooks/useEquipment";
|
import type { DuelSide } from "../hooks/useEquipment";
|
||||||
@@ -31,6 +32,10 @@ export type Characteristic = {
|
|||||||
type: CharacteristicType.NumberList;
|
type: CharacteristicType.NumberList;
|
||||||
compute(context: CharacteristicContext): number[];
|
compute(context: CharacteristicContext): number[];
|
||||||
}
|
}
|
||||||
|
| {
|
||||||
|
type: CharacteristicType.Interval;
|
||||||
|
compute(context: CharacteristicContext): Vector2Tuple;
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export type CharacteristicScript = (
|
export type CharacteristicScript = (
|
||||||
@@ -68,6 +73,7 @@ export enum CharacteristicType {
|
|||||||
Enum,
|
Enum,
|
||||||
Number,
|
Number,
|
||||||
NumberList,
|
NumberList,
|
||||||
|
Interval,
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum CharacteristicRanking {
|
export enum CharacteristicRanking {
|
||||||
|
|||||||
Reference in new issue
Block a user