mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
reload
This commit is contained in:
1 parent
474e71843d
commit
7cb3df3da2
5 files changed
+51
-21
No files matched your search
@@ -1,9 +1,24 @@
|
|||||||
import { ConsumablesCommon, OptionalDevices } from "../../../types";
|
import { ConsumablesCommon, OptionalDevices } from "../../../types";
|
||||||
|
import { BlitzEffectScript } from "../../../types/blitzEffectScript";
|
||||||
import { BlitzScripts } from "../../../types/blitzScripts";
|
import { BlitzScripts } from "../../../types/blitzScripts";
|
||||||
import { AbstractVFS } from "../../vfs";
|
import { AbstractVFS } from "../../vfs";
|
||||||
import { Cache } from "./0_base";
|
import { Cache } from "./0_base";
|
||||||
import { ServerBlitzKitAPI10 } from "./10_avatars";
|
import { ServerBlitzKitAPI10 } from "./10_avatars";
|
||||||
|
|
||||||
|
function assignNormalizedScript(
|
||||||
|
target: Record<string, BlitzEffectScript>,
|
||||||
|
key: number,
|
||||||
|
script?: BlitzEffectScript,
|
||||||
|
) {
|
||||||
|
if (script === undefined) return;
|
||||||
|
|
||||||
|
if (script["#text"] === "StaticFactorDevice") {
|
||||||
|
script["#text"] = script.attribute!;
|
||||||
|
}
|
||||||
|
|
||||||
|
target[key] = script;
|
||||||
|
}
|
||||||
|
|
||||||
export abstract class ServerBlitzKitAPI11 extends ServerBlitzKitAPI10 {
|
export abstract class ServerBlitzKitAPI11 extends ServerBlitzKitAPI10 {
|
||||||
@Cache()
|
@Cache()
|
||||||
async scripts() {
|
async scripts() {
|
||||||
@@ -19,7 +34,8 @@ export abstract class ServerBlitzKitAPI11 extends ServerBlitzKitAPI10 {
|
|||||||
|
|
||||||
for (const key in optionalDevices.root) {
|
for (const key in optionalDevices.root) {
|
||||||
const equipment = optionalDevices.root[key];
|
const equipment = optionalDevices.root[key];
|
||||||
scripts.equipment[equipment.id] = equipment.script;
|
|
||||||
|
assignNormalizedScript(scripts.equipment, equipment.id, equipment.script);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function assign(
|
async function assign(
|
||||||
@@ -38,7 +54,12 @@ export abstract class ServerBlitzKitAPI11 extends ServerBlitzKitAPI10 {
|
|||||||
|
|
||||||
for (const key in things.root) {
|
for (const key in things.root) {
|
||||||
const thing = things.root[key];
|
const thing = things.root[key];
|
||||||
scripts[target][thing.id] = things.root[key].script;
|
|
||||||
|
assignNormalizedScript(
|
||||||
|
scripts[target],
|
||||||
|
thing.id,
|
||||||
|
things.root[key].script,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
"deg": "{value}°",
|
"deg": "{value}°",
|
||||||
"hp": "{value}hp",
|
"hp": "{value}hp",
|
||||||
"x": "x{value}",
|
"x": "x{value}",
|
||||||
|
"s": "{value}s",
|
||||||
"percentage": "{value}%",
|
"percentage": "{value}%",
|
||||||
"deg_s": "{value}°/s",
|
"deg_s": "{value}°/s",
|
||||||
"plus": "+{value}"
|
"plus": "+{value}"
|
||||||
|
|||||||
@@ -87,12 +87,36 @@ export const characteristics = {
|
|||||||
let coefficient = 1;
|
let coefficient = 1;
|
||||||
|
|
||||||
script("protagonist", "CalibratedShells", (effect) => {
|
script("protagonist", "CalibratedShells", (effect) => {
|
||||||
coefficient *=
|
coefficient +=
|
||||||
1 +
|
|
||||||
effect.piercingFactors![blitzkitToBlitzShellKind[shell.type]] / 100;
|
effect.piercingFactors![blitzkitToBlitzShellKind[shell.type]] / 100;
|
||||||
});
|
});
|
||||||
|
|
||||||
return coefficient * shell.penetration!.near;
|
return coefficient * shell.penetration!.near;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
reload: {
|
||||||
|
type: CharacteristicType.Number,
|
||||||
|
|
||||||
|
should_render({ gun }) {
|
||||||
|
return gun.gun_type!.$case !== "auto_reloader";
|
||||||
|
},
|
||||||
|
|
||||||
|
compute({ gun, script }) {
|
||||||
|
// should never happen! just for typescript
|
||||||
|
if (gun.gun_type!.$case === "auto_reloader") return -Infinity;
|
||||||
|
|
||||||
|
let coefficient = 1;
|
||||||
|
|
||||||
|
script("protagonist", "miscAttrs/gunReloadTimeFactor", (effect) => {
|
||||||
|
coefficient += effect.bonusValues!.percent / 100;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (gun.gun_type!.$case === "regular") {
|
||||||
|
return coefficient * gun.gun_type!.value.reload;
|
||||||
|
}
|
||||||
|
|
||||||
|
return gun.gun_type!.value.clip_reload;
|
||||||
|
},
|
||||||
|
},
|
||||||
} satisfies Record<string, Characteristic>;
|
} satisfies Record<string, Characteristic>;
|
||||||
@@ -362,7 +362,6 @@ export function tankCharacteristics(
|
|||||||
: undefined;
|
: undefined;
|
||||||
const damageWithoutAssault =
|
const damageWithoutAssault =
|
||||||
shell.armor_damage * damageCoefficientWithoutAssault;
|
shell.armor_damage * damageCoefficientWithoutAssault;
|
||||||
const damage = shell.armor_damage * damageCoefficient;
|
|
||||||
const dpmEffective =
|
const dpmEffective =
|
||||||
gun.gun_type!.$case === "auto_reloader"
|
gun.gun_type!.$case === "auto_reloader"
|
||||||
? gun.gun_type!.value.shell_reloads[0] >
|
? gun.gun_type!.value.shell_reloads[0] >
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { literalsArray } from "@blitzkit/i18n/src/literals";
|
import { literalsArray } from "@blitzkit/i18n/src/literals";
|
||||||
import { useMemo, type ReactNode } from "react";
|
import { type ReactNode } from "react";
|
||||||
import { Text } from "../components/Text";
|
import { Text } from "../components/Text";
|
||||||
import { characteristicsGroups } from "../config/characteristicsGroups";
|
|
||||||
import type {
|
import type {
|
||||||
CharacteristicRenderConfig,
|
CharacteristicRenderConfig,
|
||||||
CharacteristicReturnType,
|
CharacteristicReturnType,
|
||||||
@@ -10,20 +9,6 @@ import { useLocale } from "./useLocale";
|
|||||||
import { useStrings } from "./useStrings";
|
import { useStrings } from "./useStrings";
|
||||||
|
|
||||||
export function useCharacteristicRenderer() {
|
export function useCharacteristicRenderer() {
|
||||||
const groups = useMemo(() => {
|
|
||||||
const groups: string[] = [];
|
|
||||||
|
|
||||||
for (const group of characteristicsGroups) {
|
|
||||||
for (const item of group.order) {
|
|
||||||
if ("strings" in item && item.strings) {
|
|
||||||
groups.push(item.strings);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return groups;
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const locale = useLocale();
|
const locale = useLocale();
|
||||||
const strings = useStrings();
|
const strings = useStrings();
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user