Merge pull request #119 from tresabhi/main

This commit is contained in:
TrèsAbhi authored and GitHub committed 2024-05-22 13:06:10 -05:00
commit fda4f76be3
9 files changed
+118 -66

No files matched your search

+1 -1
View File
@@ -98,7 +98,7 @@ export default function Page() {
stockGun: thisMember.tank.turrets[0].guns[0], stockGun: thisMember.tank.turrets[0].guns[0],
stockTrack: thisMember.tank.tracks[0], stockTrack: thisMember.tank.tracks[0],
stockTurret: thisMember.tank.turrets[0], stockTurret: thisMember.tank.turrets[0],
applyReactive: members.some( applyReactiveArmor: members.some(
(member) => (member) =>
member.key !== thisMember.key && member.key !== thisMember.key &&
member.consumables.includes(33), member.consumables.includes(33),
@@ -49,7 +49,7 @@ export function Characteristics() {
? total + awaitedProvisionDefinitions[provision].crew! / 100 ? total + awaitedProvisionDefinitions[provision].crew! / 100
: total, : total,
0, 0,
) + (hasImprovedVentilation ? 0.05 : 0); ) + (hasImprovedVentilation ? 0.08 : 0);
const commanderMastery = crewMastery + provisionCrewBonus; const commanderMastery = crewMastery + provisionCrewBonus;
const crewMemberMastery = commanderMastery * 1.1; const crewMemberMastery = commanderMastery * 1.1;
const consumables = useDuel((state) => state.protagonist!.consumables); const consumables = useDuel((state) => state.protagonist!.consumables);
@@ -85,7 +85,7 @@ export function Characteristics() {
stockGun, stockGun,
stockTrack, stockTrack,
stockTurret, stockTurret,
applyReactive: false, applyReactiveArmor: false,
applyDynamicArmor: false, applyDynamicArmor: false,
applySpallLiner: false, applySpallLiner: false,
}, },
@@ -101,11 +101,17 @@ export function Characteristics() {
const hasImprovedVerticalStabilizer = useEquipment(122); const hasImprovedVerticalStabilizer = useEquipment(122);
const penetrationCoefficient = coefficient([ const penetrationCoefficient = coefficient([
hasCalibratedShells, hasCalibratedShells,
isExplosive(shell.type) ? 0.1 : 0.05, shell.type === 'ap'
? 0.08
: shell.type === 'ap_cr'
? 0.05
: shell.type === 'hc'
? 0.13
: 0.8,
]); ]);
const penetrationLossOverDistanceCoefficient = coefficient([ const penetrationLossOverDistanceCoefficient = coefficient([
hasSupercharger, hasSupercharger,
-0.5, -0.6,
]); ]);
useEffect(() => { useEffect(() => {
@@ -91,7 +91,7 @@ export function CoreArmorSceneComponent({
equipment, equipment,
); );
material.uniforms.thickness.value = hasEnhancedArmor material.uniforms.thickness.value = hasEnhancedArmor
? thickness * 1.04 ? thickness * 1.03
: thickness; : thickness;
} }
async function handleAntagonistEquipmentChange(equipment: EquipmentMatrix) { async function handleAntagonistEquipmentChange(equipment: EquipmentMatrix) {
@@ -106,7 +106,14 @@ export function CoreArmorSceneComponent({
); );
material.uniforms.penetration.value = hasCalibratedShells material.uniforms.penetration.value = hasCalibratedShells
? penetration * (isExplosive(duel.antagonist!.shell.type) ? 1.1 : 1.05) ? penetration *
(duel.antagonist!.shell.type === 'ap'
? 0.08
: duel.antagonist!.shell.type === 'ap_cr'
? 0.05
: duel.antagonist!.shell.type === 'hc'
? 0.13
: 0.8)
: penetration; : penetration;
} }
@@ -7,7 +7,6 @@ import {
ShaderMaterial, ShaderMaterial,
} from 'three'; } from 'three';
import { ArmorUserData, ExternalModuleVariant } from '../..'; import { ArmorUserData, ExternalModuleVariant } from '../..';
import { isExplosive } from '../../../../../../core/blitz/isExplosive';
import { resolveNearPenetration } from '../../../../../../core/blitz/resolveNearPenetration'; import { resolveNearPenetration } from '../../../../../../core/blitz/resolveNearPenetration';
import { hasEquipment } from '../../../../../../core/blitzkit/hasEquipment'; import { hasEquipment } from '../../../../../../core/blitzkit/hasEquipment';
import { jsxTree } from '../../../../../../core/blitzkit/jsxTree'; import { jsxTree } from '../../../../../../core/blitzkit/jsxTree';
@@ -62,7 +61,7 @@ export function SpacedArmorSubExternal({
equipment, equipment,
); );
material.uniforms.thickness.value = hasEnhancedArmor material.uniforms.thickness.value = hasEnhancedArmor
? thickness * 1.04 ? thickness * 1.03
: thickness; : thickness;
} }
async function handleAntagonistEquipmentChange(equipment: EquipmentMatrix) { async function handleAntagonistEquipmentChange(equipment: EquipmentMatrix) {
@@ -76,7 +75,14 @@ export function SpacedArmorSubExternal({
equipment, equipment,
); );
material.uniforms.penetration.value = hasCalibratedShells material.uniforms.penetration.value = hasCalibratedShells
? penetration * (isExplosive(duel.antagonist!.shell.type) ? 1.1 : 1.05) ? penetration *
(duel.antagonist!.shell.type === 'ap'
? 0.08
: duel.antagonist!.shell.type === 'ap_cr'
? 0.05
: duel.antagonist!.shell.type === 'hc'
? 0.13
: 0.8)
: penetration; : penetration;
} }
@@ -7,7 +7,6 @@ import {
} from 'three'; } from 'three';
import { degToRad } from 'three/src/math/MathUtils'; import { degToRad } from 'three/src/math/MathUtils';
import { ArmorUserData } from '../..'; import { ArmorUserData } from '../..';
import { isExplosive } from '../../../../../../core/blitz/isExplosive';
import { resolveNearPenetration } from '../../../../../../core/blitz/resolveNearPenetration'; import { resolveNearPenetration } from '../../../../../../core/blitz/resolveNearPenetration';
import { hasEquipment } from '../../../../../../core/blitzkit/hasEquipment'; import { hasEquipment } from '../../../../../../core/blitzkit/hasEquipment';
import { jsxTree } from '../../../../../../core/blitzkit/jsxTree'; import { jsxTree } from '../../../../../../core/blitzkit/jsxTree';
@@ -69,7 +68,7 @@ export function SpacedArmorSubSpaced({
equipment, equipment,
); );
material.uniforms.thickness.value = hasEnhancedArmor material.uniforms.thickness.value = hasEnhancedArmor
? thickness * 1.04 ? thickness * 1.03
: thickness; : thickness;
} }
async function handleAntagonistEquipmentChange(equipment: EquipmentMatrix) { async function handleAntagonistEquipmentChange(equipment: EquipmentMatrix) {
@@ -82,7 +81,14 @@ export function SpacedArmorSubSpaced({
equipment, equipment,
); );
material.uniforms.penetration.value = hasCalibratedShells material.uniforms.penetration.value = hasCalibratedShells
? penetration * (isExplosive(shell.type) ? 1.1 : 1.05) ? penetration *
(duel.antagonist!.shell.type === 'ap'
? 0.08
: duel.antagonist!.shell.type === 'ap_cr'
? 0.05
: duel.antagonist!.shell.type === 'hc'
? 0.13
: 0.8)
: penetration; : penetration;
} }
@@ -105,16 +105,20 @@ export function SpacedArmorSceneComponent({
duel.protagonist!.tank.equipment, duel.protagonist!.tank.equipment,
duel.protagonist!.equipmentMatrix, duel.protagonist!.equipmentMatrix,
); );
const thicknessCoefficient = hasEnhancedArmor ? 1.04 : 1; const thicknessCoefficient = hasEnhancedArmor ? 1.03 : 1;
const shell = useDuel.getState().antagonist!.shell; const shell = useDuel.getState().antagonist!.shell;
const explosive = isExplosive(shell.type); const explosive = isExplosive(shell.type);
const splashing = canSplash(shell.type); const splashing = canSplash(shell.type);
const penetration = const penetration =
resolveNearPenetration(shell.penetration) * resolveNearPenetration(shell.penetration) *
(hasCalibratedShells (hasCalibratedShells
? isExplosive(shell.type) ? duel.antagonist!.shell.type === 'ap'
? 1.1 ? 0.08
: 1.05 : duel.antagonist!.shell.type === 'ap_cr'
? 0.05
: duel.antagonist!.shell.type === 'hc'
? 0.13
: 0.8
: 1); : 1);
const shot: Shot = { const shot: Shot = {
layers: [], layers: [],
+1 -1
View File
@@ -46,7 +46,7 @@ export function ConsumablesManager({
cooldown={ cooldown={
timers timers
? consumable.cooldown * ? consumable.cooldown *
(hasConsumableDeliverySystem ? 0.85 : 1) * (hasConsumableDeliverySystem ? 0.88 : 1) *
(1 - cooldownBooster! * 0.1) (1 - cooldownBooster! * 0.1)
: undefined : undefined
} }
+4 -3
View File
@@ -19,9 +19,10 @@ export function applyPitchYawLimits(
); );
} }
const pitchBuff = verticalStabilizer ? degToRad(3) : 0; const depressionBuff = verticalStabilizer ? degToRad(4) : 0;
let lowerPitch = -degToRad(pitchLimits.max) - pitchBuff; const elevationBuff = verticalStabilizer ? degToRad(3) : 0;
let upperPitch = -degToRad(pitchLimits.min) + pitchBuff; let lowerPitch = -degToRad(pitchLimits.max) - depressionBuff;
let upperPitch = -degToRad(pitchLimits.min) + elevationBuff;
const transition = degToRad(pitchLimits.transition ?? 10); const transition = degToRad(pitchLimits.transition ?? 10);
if (pitchLimits.back) { if (pitchLimits.back) {
+67 -45
View File
@@ -1,5 +1,4 @@
import { EquipmentMatrix } from '../../stores/duel'; import { EquipmentMatrix } from '../../stores/duel';
import { isExplosive } from '../blitz/isExplosive';
import { resolveNearPenetration } from '../blitz/resolveNearPenetration'; import { resolveNearPenetration } from '../blitz/resolveNearPenetration';
import { coefficient } from './coefficient'; import { coefficient } from './coefficient';
import { degressiveStat } from './degressiveStat'; import { degressiveStat } from './degressiveStat';
@@ -38,7 +37,7 @@ export function tankCharacteristics(
stockTrack, stockTrack,
stockTurret, stockTurret,
stockGun, stockGun,
applyReactive, applyReactiveArmor,
applyDynamicArmor, applyDynamicArmor,
applySpallLiner, applySpallLiner,
}: { }: {
@@ -58,7 +57,7 @@ export function tankCharacteristics(
provisions: number[]; provisions: number[];
crewSkills: Record<string, number>; crewSkills: Record<string, number>;
camouflage: boolean; camouflage: boolean;
applyReactive: boolean; applyReactiveArmor: boolean;
applyDynamicArmor: boolean; applyDynamicArmor: boolean;
applySpallLiner: boolean; applySpallLiner: boolean;
}, },
@@ -94,7 +93,7 @@ export function tankCharacteristics(
return provisions.includes(id); return provisions.includes(id);
} }
const hasRammer = equipment(100); const hasGunRammer = equipment(100);
const hasImprovedVentilation = equipment(102); const hasImprovedVentilation = equipment(102);
const hasCalibratedShells = equipment(103); const hasCalibratedShells = equipment(103);
const hasEnhancedGunLayingDrive = equipment(104); const hasEnhancedGunLayingDrive = equipment(104);
@@ -115,6 +114,7 @@ export function tankCharacteristics(
const hasEnginePowerBoost = consumable(14); const hasEnginePowerBoost = consumable(14);
const hasImprovedEnginePowerBoost = consumable(27); const hasImprovedEnginePowerBoost = consumable(27);
const hasReticleCalibration = consumable(28); const hasReticleCalibration = consumable(28);
const hasReducedEnginePowerBoost = consumable(80);
const hasStandardFuel = provision(18); const hasStandardFuel = provision(18);
const hasImprovedFuel = provision(19); const hasImprovedFuel = provision(19);
@@ -133,7 +133,7 @@ export function tankCharacteristics(
? total + provisionDefinitions[provision].crew! / 100 ? total + provisionDefinitions[provision].crew! / 100
: total, : total,
0, 0,
) + (hasImprovedVentilation ? 0.05 : 0); ) + (hasImprovedVentilation ? 0.08 : 0);
const commanderMastery = crewMastery + provisionCrewBonus; const commanderMastery = crewMastery + provisionCrewBonus;
const crewMemberMastery = commanderMastery * 1.1; const crewMemberMastery = commanderMastery * 1.1;
@@ -141,42 +141,48 @@ export function tankCharacteristics(
const damageCoefficient = const damageCoefficient =
coefficient([hasTungsten, 0.15]) * coefficient([hasTungsten, 0.15]) *
coefficient( coefficient(
[applyReactive, -0.2], [applyReactiveArmor, -0.27],
[applyDynamicArmor, -0.1], [applyDynamicArmor, -0.1],
[applySpallLiner && shell.type === 'he', -0.2], [applySpallLiner && shell.type === 'he', -0.2],
); );
const reloadCoefficient = const reloadCoefficient =
(coefficient([hasRammer, -0.07]) * (coefficient([hasGunRammer, -0.05]) *
coefficient([true, degressiveStat(crewMemberMastery)])) / coefficient([true, degressiveStat(crewMemberMastery)])) /
coefficient([hasAdrenaline && gun.type === 'regular', 0.2]); coefficient([hasAdrenaline && gun.type === 'regular', 0.17]);
const penetrationCoefficient = coefficient([ const penetrationCoefficient = coefficient([
hasCalibratedShells, hasCalibratedShells,
isExplosive(shell.type) ? 0.1 : 0.05, shell.type === 'ap'
? 0.08
: shell.type === 'ap_cr'
? 0.05
: shell.type === 'hc'
? 0.13
: 0.8,
]); ]);
const healthCoefficient = coefficient( const healthCoefficient = coefficient(
[hasSandbagArmor, 0.03], [hasSandbagArmor, 0.03],
[hasEnhancedSandbagArmor, 0.06], [hasEnhancedSandbagArmor, 0.06],
[hasImprovedAssembly, 0.06], [hasImprovedAssembly, 0.04],
); );
const shellVelocityCoefficient = coefficient( const shellVelocityCoefficient = coefficient(
[hasSupercharger, 0.3], [hasSupercharger, 0.35],
[hasImprovedGunPowder, 0.3], [hasImprovedGunPowder, 0.3],
); );
const penetrationLossOverDistanceCoefficient = coefficient([ const penetrationLossOverDistanceCoefficient = coefficient([
hasSupercharger, hasSupercharger,
-0.5, -0.6,
]); ]);
const aimTimeCoefficient = const aimTimeCoefficient =
coefficient( coefficient(
[hasEnhancedGunLayingDrive, -0.1], [hasEnhancedGunLayingDrive, -0.15],
[hasReticleCalibration, -0.4], [hasReticleCalibration, -0.3],
) * coefficient([true, degressiveStat(crewMemberMastery)]); ) * coefficient([true, degressiveStat(crewMemberMastery)]);
const dispersionStillCoefficient = const dispersionStillCoefficient =
coefficient([hasRefinedGun, -0.1], [hasReticleCalibration, -0.4]) * coefficient([hasRefinedGun, -0.15], [hasReticleCalibration, -0.3]) *
coefficient([true, degressiveStat(crewMemberMastery)]); coefficient([true, degressiveStat(crewMemberMastery)]);
const dispersionDamagedCoefficient = coefficient([ const dispersionDamagedCoefficient = coefficient([
hasVerticalStabilizer, hasVerticalStabilizer,
-0.15, -0.12,
]); ]);
const dispersionHullTraverseCoefficient = coefficient( const dispersionHullTraverseCoefficient = coefficient(
[hasVerticalStabilizer, -0.15], [hasVerticalStabilizer, -0.15],
@@ -196,17 +202,12 @@ export function tankCharacteristics(
); );
const enginePowerCoefficient = coefficient( const enginePowerCoefficient = coefficient(
[ [
hasEngineAccelerator && hasEngineAccelerator,
(tank.class === 'lightTank' || tank.class === 'mediumTank'), tank.class === 'heavyTank' || tank.class === 'AT-SPG' ? 0.05 : 0.04,
0.05,
],
[
hasEngineAccelerator &&
(tank.class === 'heavyTank' || tank.class === 'AT-SPG'),
0.07,
], ],
[hasReducedEnginePowerBoost, 0.1],
[hasEnginePowerBoost, 0.2], [hasEnginePowerBoost, 0.2],
[hasImprovedEnginePowerBoost, 0.4], [hasImprovedEnginePowerBoost, 0.35],
[hasStandardFuel, 0.03], [hasStandardFuel, 0.03],
[hasImprovedFuel, 0.1], [hasImprovedFuel, 0.1],
[hasGearOil, 0.03], [hasGearOil, 0.03],
@@ -217,32 +218,50 @@ export function tankCharacteristics(
coefficient([true, progressiveStat(crewMemberMastery)]); coefficient([true, progressiveStat(crewMemberMastery)]);
const hullTraverseCoefficient = const hullTraverseCoefficient =
coefficient( coefficient(
[hasImprovedControl, 0.1], [hasImprovedControl, 0.11],
[hasImprovedEnginePowerBoost, 0.05], [hasImprovedEnginePowerBoost, 0.01],
[true, crewSkills.virtuoso / 100], [true, crewSkills.virtuoso / 100],
) * coefficient([true, progressiveStat(crewMemberMastery)]); ) * coefficient([true, progressiveStat(crewMemberMastery)]);
const resistanceCoefficient = coefficient([hasImprovedSuspension, -0.25]); const resistanceHardCoefficient = coefficient([hasImprovedSuspension, -0.2]);
const resistanceMediumCoefficient = coefficient([
hasImprovedSuspension,
-0.15,
]);
const resistanceSoftCoefficient = coefficient([hasImprovedSuspension, -0.3]);
const viewRangeCoefficient = const viewRangeCoefficient =
coefficient([ coefficient([
hasImprovedOptics, hasImprovedOptics,
tank.class === 'AT-SPG' ? 0.05 : tank.class === 'heavyTank' ? 0.07 : 0.1, tank.class === 'heavyTank'
? 0.06
: tank.class === 'mediumTank'
? 0.08
: tank.class === 'lightTank'
? 0.11
: 0.04,
]) * coefficient([true, progressiveStat(commanderMastery)]); ]) * coefficient([true, progressiveStat(commanderMastery)]);
const fireChanceCoefficient = coefficient([hasProtectiveKit, -0.2]); const fireChanceCoefficient = coefficient([hasProtectiveKit, -0.2]);
const speedForwardsSum = sum( const speedForwardsSum = sum(
[hasImprovedEnginePowerBoost, 5], [hasImprovedEnginePowerBoost, 4],
[hasGearOil, 2], [hasGearOil, 2],
[hasImprovedGearOil, 4], [hasImprovedGearOil, 4],
); );
const speedBackwardsSum = sum( const speedBackwardsSum = sum(
[hasImprovedEnginePowerBoost, 10], [hasImprovedEnginePowerBoost, 8],
[hasGearOil, 2], [hasGearOil, 2],
[hasImprovedGearOil, 4], [hasImprovedGearOil, 4],
); );
const camouflageSumMoving = sum( const camouflageSumMoving = sum(
[ [
hasCamouflageNet, hasCamouflageNet,
tank.class === 'heavyTank' ? 0.03 : tank.class === 'AT-SPG' ? 0.07 : 0.05,
tank.class === 'heavyTank'
? 0.02
: tank.class === 'mediumTank'
? 0.04
: tank.class === 'lightTank'
? 0.07
: 0.1,
], ],
[ [
camouflage, camouflage,
@@ -252,12 +271,13 @@ export function tankCharacteristics(
const camouflageSumStill = sum( const camouflageSumStill = sum(
[ [
hasCamouflageNet, hasCamouflageNet,
2 * tank.class === 'heavyTank'
(tank.class === 'heavyTank' ? 0.04
? 0.03 : tank.class === 'mediumTank'
: tank.class === 'AT-SPG' ? 0.08
? 0.07 : tank.class === 'lightTank'
: 0.05), ? 0.14
: 0.2,
], ],
[ [
camouflage, camouflage,
@@ -362,7 +382,7 @@ export function tankCharacteristics(
const gunDepression = const gunDepression =
gunModelDefinition.pitch.max + gunModelDefinition.pitch.max +
gunDefaultPitch + gunDefaultPitch +
(hasImprovedVerticalStabilizer ? 3 : 0); (hasImprovedVerticalStabilizer ? 4 : 0);
const gunElevation = const gunElevation =
-gunModelDefinition.pitch.min - -gunModelDefinition.pitch.min -
gunDefaultPitch + gunDefaultPitch +
@@ -385,35 +405,37 @@ export function tankCharacteristics(
const powerToWeightRatioHardTerrain = const powerToWeightRatioHardTerrain =
resolvedEnginePower / resolvedEnginePower /
weightTons / weightTons /
(track.resistance.hard * resistanceCoefficient); (track.resistance.hard * resistanceHardCoefficient);
const powerToWeightRatioMediumTerrain = const powerToWeightRatioMediumTerrain =
resolvedEnginePower / resolvedEnginePower /
weightTons / weightTons /
(track.resistance.medium * resistanceCoefficient); (track.resistance.medium * resistanceMediumCoefficient);
const powerToWeightRatioSoftTerrain = const powerToWeightRatioSoftTerrain =
resolvedEnginePower / resolvedEnginePower /
weightTons / weightTons /
(track.resistance.soft * resistanceCoefficient); (track.resistance.soft * resistanceSoftCoefficient);
const weight = weightTons; const weight = weightTons;
const turretTraverseSpeed = turret.traverseSpeed * turretTraverseCoefficient; const turretTraverseSpeed = turret.traverseSpeed * turretTraverseCoefficient;
const hullTraverseHardTerrain = const hullTraverseHardTerrain =
(resolvedEnginePower / stockEngine.power) * (resolvedEnginePower / stockEngine.power) *
track.traverseSpeed * track.traverseSpeed *
hullTraverseCoefficient * hullTraverseCoefficient *
(track.resistance.hard / (track.resistance.hard * resistanceCoefficient)) * (track.resistance.hard /
(track.resistance.hard * resistanceHardCoefficient)) *
(stockWeight / weightKg); (stockWeight / weightKg);
const hullTraverseMediumTerrain = const hullTraverseMediumTerrain =
(resolvedEnginePower / stockEngine.power) * (resolvedEnginePower / stockEngine.power) *
track.traverseSpeed * track.traverseSpeed *
hullTraverseCoefficient * hullTraverseCoefficient *
(track.resistance.hard / (track.resistance.hard /
(track.resistance.medium * resistanceCoefficient)) * (track.resistance.medium * resistanceMediumCoefficient)) *
(stockWeight / weightKg); (stockWeight / weightKg);
const hullTraverseSoftTerrain = const hullTraverseSoftTerrain =
(resolvedEnginePower / stockEngine.power) * (resolvedEnginePower / stockEngine.power) *
track.traverseSpeed * track.traverseSpeed *
hullTraverseCoefficient * hullTraverseCoefficient *
(track.resistance.hard / (track.resistance.soft * resistanceCoefficient)) * (track.resistance.hard /
(track.resistance.soft * resistanceSoftCoefficient)) *
(stockWeight / weightKg); (stockWeight / weightKg);
const health = (tank.health + turret.health) * healthCoefficient; const health = (tank.health + turret.health) * healthCoefficient;
const fireChance = engine.fireChance * fireChanceCoefficient; const fireChance = engine.fireChance * fireChanceCoefficient;