mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 03:07:04 +02:00
feat: provisions
This commit is contained in:
1 parent
561b59d235
commit
5bbe93bcec
14 files changed
+233
-53
No files matched your search
@@ -1,12 +1,13 @@
|
||||
import { ConsumableEntry } from './consumablesDefinitions';
|
||||
import { ConsumableEntry } from './consumableDefinitions';
|
||||
import { ProvisionEntry } from './provisionDefinitions';
|
||||
import { GunDefinition, TankDefinition } from './tankDefinitions';
|
||||
|
||||
export function checkConsumableInclusivity(
|
||||
consumable: ConsumableEntry,
|
||||
export function checkConsumableProvisionInclusivity(
|
||||
consumableProvision: ConsumableEntry | ProvisionEntry,
|
||||
tank: TankDefinition,
|
||||
gun: GunDefinition,
|
||||
) {
|
||||
const included = consumable.include.every((rule) => {
|
||||
const included = consumableProvision.include.every((rule) => {
|
||||
switch (rule.type) {
|
||||
case 'tier':
|
||||
return rule.min <= tank.tier && tank.tier <= rule.max;
|
||||
@@ -18,7 +19,7 @@ export function checkConsumableInclusivity(
|
||||
throw new SyntaxError('Category filtering found in include rule');
|
||||
}
|
||||
});
|
||||
const excluded = consumable.exclude?.some((rule) => {
|
||||
const excluded = consumableProvision.exclude?.some((rule) => {
|
||||
switch (rule.type) {
|
||||
case 'tier':
|
||||
return rule.min <= tank.tier && tank.tier <= rule.max;
|
||||
|
||||
+5
-5
@@ -1,8 +1,8 @@
|
||||
import { asset } from './asset';
|
||||
|
||||
export type ConsumableDefinitionFilterCategory = 'clip';
|
||||
export type TankFilterDefinitionCategory = 'clip';
|
||||
|
||||
type ConsumableDefinitionFilter =
|
||||
export type TankFilterDefinition =
|
||||
| {
|
||||
type: 'tier';
|
||||
min: number;
|
||||
@@ -14,15 +14,15 @@ type ConsumableDefinitionFilter =
|
||||
}
|
||||
| {
|
||||
type: 'category';
|
||||
categories: ConsumableDefinitionFilterCategory[];
|
||||
categories: TankFilterDefinitionCategory[];
|
||||
};
|
||||
|
||||
export interface ConsumableEntry {
|
||||
id: number;
|
||||
name: string;
|
||||
effects?: Record<string, number>;
|
||||
include: ConsumableDefinitionFilter[];
|
||||
exclude?: ConsumableDefinitionFilter[];
|
||||
include: TankFilterDefinition[];
|
||||
exclude?: TankFilterDefinition[];
|
||||
}
|
||||
|
||||
export interface ConsumableDefinitions {
|
||||
@@ -0,0 +1,21 @@
|
||||
import { asset } from './asset';
|
||||
import { TankFilterDefinition } from './consumableDefinitions';
|
||||
|
||||
export interface ProvisionEntry {
|
||||
id: number;
|
||||
name: string;
|
||||
effects?: Record<string, number>;
|
||||
include: TankFilterDefinition[];
|
||||
exclude?: TankFilterDefinition[];
|
||||
}
|
||||
|
||||
export interface ProvisionDefinitions {
|
||||
[key: string]: ProvisionEntry;
|
||||
}
|
||||
|
||||
export const provisionDefinitions = fetch(
|
||||
asset('definitions/provisions.json'),
|
||||
{
|
||||
cache: 'no-cache',
|
||||
},
|
||||
).then(async (response) => response.json() as Promise<ProvisionDefinitions>);
|
||||
@@ -20,6 +20,7 @@ export interface TankDefinition {
|
||||
name_full?: string;
|
||||
tree_type: TreeTypeString;
|
||||
consumables: number;
|
||||
provisions: number;
|
||||
tier: Tier;
|
||||
type: TankType;
|
||||
testing?: boolean;
|
||||
|
||||
Reference in new issue
Block a user