feat: consumables

This commit is contained in:
TrèsAbhi committed 2024-02-11 14:55:21 -06:00
1 parent 12cf05cb50
commit 9d7c60e92d
6 files changed
+76 -54

No files matched your search

+2 -1
View File
@@ -25,7 +25,6 @@ export type TankFilterDefinition =
export interface ConsumableEntry {
id: number;
name: string;
effects?: Record<string, number>;
include: TankFilterDefinition[];
exclude?: TankFilterDefinition[];
}
@@ -37,3 +36,5 @@ export interface ConsumableDefinitions {
export const consumableDefinitions = fetchCdonLz4<ConsumableDefinitions>(
asset('definitions/consumables.cdon.lz4'),
);
consumableDefinitions.then(console.log);
+3 -1
View File
@@ -4,13 +4,15 @@ export function resolveDpm(
gun: GunDefinition,
shell: ShellDefinition,
hasRammer = false,
hasShellReloadBoost = false,
) {
if (gun.type === 'regular') {
return (shell.damage.armor / ((hasRammer ? 0.93 : 1) * gun.reload)) * 60;
} else if (gun.type === 'autoLoader') {
return (
((shell.damage.armor * gun.count) /
(gun.reload + (gun.count - 1) * gun.interClip)) *
(gun.reload +
(gun.count - 1) * gun.interClip * (hasShellReloadBoost ? 0.7 : 1))) *
60
);
} else {
+6
View File
@@ -0,0 +1,6 @@
import { useTankopediaTemporary } from '../../stores/tankopedia';
export function useConsumable(id: number) {
const consumables = useTankopediaTemporary((state) => state.consumables);
return consumables.includes(id);
}