mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
feat: penetration testing
This commit is contained in:
1 parent
1a008a4852
commit
b176ec6c96
7 files changed
+53
-23
No files matched your search
@@ -1,16 +1,21 @@
|
|||||||
import { ShellType } from "../protos";
|
import { Equalizer, ShellType } from "../protos";
|
||||||
|
|
||||||
export function resolvePenetrationCoefficient(
|
export function resolvePenetrationCoefficient(
|
||||||
calibratedShells: boolean,
|
calibratedShells: boolean,
|
||||||
|
equalize: boolean,
|
||||||
type: ShellType,
|
type: ShellType,
|
||||||
|
equalizerObj?: Equalizer,
|
||||||
) {
|
) {
|
||||||
if (!calibratedShells) return 1;
|
const calibrated = calibratedShells
|
||||||
|
? type === ShellType.SHELL_TYPE_AP
|
||||||
|
? 1.08
|
||||||
|
: type === ShellType.SHELL_TYPE_APCR
|
||||||
|
? 1.05
|
||||||
|
: type === ShellType.SHELL_TYPE_HEAT
|
||||||
|
? 1.13
|
||||||
|
: 1.08
|
||||||
|
: 1;
|
||||||
|
const equalizer = (equalize ? equalizerObj?.penetration : undefined) ?? 1;
|
||||||
|
|
||||||
return type === ShellType.SHELL_TYPE_AP
|
return calibrated * equalizer;
|
||||||
? 1.08
|
|
||||||
: type === ShellType.SHELL_TYPE_APCR
|
|
||||||
? 1.05
|
|
||||||
: type === ShellType.SHELL_TYPE_HEAT
|
|
||||||
? 1.13
|
|
||||||
: 1.08;
|
|
||||||
}
|
}
|
||||||
+6
-1
@@ -151,7 +151,12 @@ export function PrimaryArmorSceneComponent({
|
|||||||
|
|
||||||
material.uniforms.penetration.value =
|
material.uniforms.penetration.value =
|
||||||
penetration *
|
penetration *
|
||||||
resolvePenetrationCoefficient(hasCalibratedShells, shell.type) *
|
resolvePenetrationCoefficient(
|
||||||
|
hasCalibratedShells,
|
||||||
|
Duel.state.equalize,
|
||||||
|
shell.type,
|
||||||
|
Duel.state.antagonist.tank.equalizer,
|
||||||
|
) *
|
||||||
equalize;
|
equalize;
|
||||||
|
|
||||||
if (!noInvalidate) invalidate();
|
if (!noInvalidate) invalidate();
|
||||||
|
|||||||
+6
-1
@@ -85,7 +85,12 @@ export function SpacedArmorSubExternal({
|
|||||||
|
|
||||||
material.uniforms.penetration.value =
|
material.uniforms.penetration.value =
|
||||||
penetration *
|
penetration *
|
||||||
resolvePenetrationCoefficient(hasCalibratedShells, shell.type) *
|
resolvePenetrationCoefficient(
|
||||||
|
hasCalibratedShells,
|
||||||
|
Duel.state.equalize,
|
||||||
|
shell.type,
|
||||||
|
Duel.state.antagonist.tank.equalizer,
|
||||||
|
) *
|
||||||
equalize;
|
equalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -95,7 +95,12 @@ export function SpacedArmorSubSpaced({
|
|||||||
|
|
||||||
material.uniforms.penetration.value =
|
material.uniforms.penetration.value =
|
||||||
penetration *
|
penetration *
|
||||||
resolvePenetrationCoefficient(hasCalibratedShells, shell.type) *
|
resolvePenetrationCoefficient(
|
||||||
|
hasCalibratedShells,
|
||||||
|
Duel.state.equalize,
|
||||||
|
shell.type,
|
||||||
|
Duel.state.antagonist.tank.equalizer,
|
||||||
|
) *
|
||||||
equalize;
|
equalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+16
-6
@@ -18,6 +18,7 @@ import {
|
|||||||
import { degToRad } from "three/src/math/MathUtils.js";
|
import { degToRad } from "three/src/math/MathUtils.js";
|
||||||
import { hasEquipment } from "../../../../core/blitzkit/hasEquipment";
|
import { hasEquipment } from "../../../../core/blitzkit/hasEquipment";
|
||||||
import { jsxTree } from "../../../../core/blitzkit/jsxTree";
|
import { jsxTree } from "../../../../core/blitzkit/jsxTree";
|
||||||
|
import { defaultEqualizer } from "../../../../core/blitzkit/tankToDuelMember";
|
||||||
import { discardClippingPlane } from "../../../../core/three/discardClippingPlane";
|
import { discardClippingPlane } from "../../../../core/three/discardClippingPlane";
|
||||||
import { Duel } from "../../../../stores/duel";
|
import { Duel } from "../../../../stores/duel";
|
||||||
import {
|
import {
|
||||||
@@ -88,9 +89,12 @@ export function SpacedArmorSceneComponent({
|
|||||||
const { customShell } = Tankopedia.state;
|
const { customShell } = Tankopedia.state;
|
||||||
const shell = customShell ?? Duel.state.antagonist.shell;
|
const shell = customShell ?? Duel.state.antagonist.shell;
|
||||||
const { equalize } = Duel.state;
|
const { equalize } = Duel.state;
|
||||||
const equalizer =
|
const protagonistEqualizer =
|
||||||
(equalize ? Duel.state.antagonist.tank.equalizer?.damage : undefined) ??
|
(equalize ? Duel.state.protagonist.tank.equalizer : undefined) ??
|
||||||
1;
|
defaultEqualizer;
|
||||||
|
const antagonistEqualizer =
|
||||||
|
(equalize ? Duel.state.antagonist.tank.equalizer : undefined) ??
|
||||||
|
defaultEqualizer;
|
||||||
const cameraNormal = camera.position.clone().sub(point).normalize();
|
const cameraNormal = camera.position.clone().sub(point).normalize();
|
||||||
const shot: Shot = {
|
const shot: Shot = {
|
||||||
splashRadius:
|
splashRadius:
|
||||||
@@ -118,8 +122,14 @@ export function SpacedArmorSceneComponent({
|
|||||||
);
|
);
|
||||||
const penetration =
|
const penetration =
|
||||||
shell.penetration!.near *
|
shell.penetration!.near *
|
||||||
resolvePenetrationCoefficient(hasCalibratedShells, shell.type);
|
resolvePenetrationCoefficient(
|
||||||
const thicknessCoefficient = hasEnhancedArmor ? 1.03 : 1;
|
hasCalibratedShells,
|
||||||
|
equalize,
|
||||||
|
shell.type,
|
||||||
|
antagonistEqualizer,
|
||||||
|
);
|
||||||
|
const thicknessCoefficient =
|
||||||
|
(hasEnhancedArmor ? 1.03 : 1) * protagonistEqualizer.armor;
|
||||||
const filteredIntersections = intersections.filter(
|
const filteredIntersections = intersections.filter(
|
||||||
(intersection) =>
|
(intersection) =>
|
||||||
"type" in intersection.object.userData &&
|
"type" in intersection.object.userData &&
|
||||||
@@ -371,7 +381,7 @@ export function SpacedArmorSceneComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shot.damage *= equalizer;
|
shot.damage *= antagonistEqualizer.damage;
|
||||||
|
|
||||||
return shot;
|
return shot;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ export function Options({ thicknessRange, canvas, skeleton }: OptionsProps) {
|
|||||||
value: (
|
value: (
|
||||||
resolvePenetrationCoefficient(
|
resolvePenetrationCoefficient(
|
||||||
hasCalibratedShells,
|
hasCalibratedShells,
|
||||||
|
false,
|
||||||
antagonistShell.type,
|
antagonistShell.type,
|
||||||
) * antagonistShell.penetration!.near
|
) * antagonistShell.penetration!.near
|
||||||
).toFixed(0),
|
).toFixed(0),
|
||||||
|
|||||||
@@ -181,11 +181,10 @@ export function tankCharacteristics(
|
|||||||
(coefficient([hasGunRammer, -0.05]) *
|
(coefficient([hasGunRammer, -0.05]) *
|
||||||
coefficient([true, degressiveStat(loaderMastery)])) /
|
coefficient([true, degressiveStat(loaderMastery)])) /
|
||||||
coefficient([hasAdrenaline && gun.gun_type!.$case === "regular", 0.17]);
|
coefficient([hasAdrenaline && gun.gun_type!.$case === "regular", 0.17]);
|
||||||
const penetrationCoefficient =
|
const penetrationCoefficient = coefficient([
|
||||||
coefficient([
|
hasCalibratedShells,
|
||||||
hasCalibratedShells,
|
resolvePenetrationCoefficient(true, equalize, shell.type, equalizer) - 1,
|
||||||
resolvePenetrationCoefficient(true, shell.type) - 1,
|
]);
|
||||||
]) * equalizer.penetration;
|
|
||||||
const healthCoefficient =
|
const healthCoefficient =
|
||||||
coefficient(
|
coefficient(
|
||||||
[hasSandbagArmor, 0.03],
|
[hasSandbagArmor, 0.03],
|
||||||
|
|||||||
Reference in new issue
Block a user