mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
terrain coeffs
This commit is contained in:
1 parent
62da186a25
commit
9a66fb5115
6 files changed
+113
-8
No files matched your search
Vendored
+1
@@ -157,6 +157,7 @@
|
||||
"ownedtanks",
|
||||
"padder",
|
||||
"partytown",
|
||||
"passability",
|
||||
"patchnotes",
|
||||
"PIXELFORMAT",
|
||||
"playerachievements",
|
||||
|
||||
@@ -70,7 +70,12 @@
|
||||
"brake_force": "Brake force",
|
||||
"weight": "Weight",
|
||||
"power_to_weight": "Power to weight",
|
||||
"terrain_coefficient": "Terrain coefficient",
|
||||
"hard_terrain_coefficient": "Hard terrain coefficient",
|
||||
"medium_terrain_coefficient": "Medium terrain coefficient",
|
||||
"soft_terrain_coefficient": "Soft terrain coefficient",
|
||||
"hard_terrain_coefficient_raw": "Raw hard terrain coefficient",
|
||||
"medium_terrain_coefficient_raw": "Raw medium terrain coefficient",
|
||||
"soft_terrain_coefficient_raw": "Raw soft terrain coefficient",
|
||||
"hull_traverse_speed": "Hull traverse speed",
|
||||
"turret_traverse_speed": "Turret traverse speed",
|
||||
"gun_traverse_speed": "Gun traverse speed",
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
type Characteristic,
|
||||
type CharacteristicContext,
|
||||
} from "../types/characteristics";
|
||||
import { rawTerrainCoefficient } from "../tankopedia/rawTerrainCoefficient";
|
||||
|
||||
function intraClipCoefficient({
|
||||
script,
|
||||
@@ -621,7 +622,66 @@ export const characteristics = {
|
||||
},
|
||||
|
||||
// brake_force: unavailable,
|
||||
// terrain_coefficient: unavailable,
|
||||
|
||||
hard_terrain_coefficient_raw: {
|
||||
type: CharacteristicType.Number,
|
||||
compute({ track, degressive, script }) {
|
||||
return rawTerrainCoefficient(
|
||||
track.resistance_hard,
|
||||
"firmGroundPassabilityIncrease",
|
||||
degressive("driver"),
|
||||
script,
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
hard_terrain_coefficient: {
|
||||
type: CharacteristicType.Number,
|
||||
compute({ characteristic }) {
|
||||
const raw = characteristic("hard_terrain_coefficient_raw") as number;
|
||||
return 100 / raw;
|
||||
},
|
||||
},
|
||||
|
||||
medium_terrain_coefficient_raw: {
|
||||
type: CharacteristicType.Number,
|
||||
compute({ track, degressive, script }) {
|
||||
return rawTerrainCoefficient(
|
||||
track.resistance_medium,
|
||||
"mediumGroundPassabilityIncrease",
|
||||
degressive("driver"),
|
||||
script,
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
medium_terrain_coefficient: {
|
||||
type: CharacteristicType.Number,
|
||||
compute({ characteristic }) {
|
||||
const raw = characteristic("medium_terrain_coefficient_raw") as number;
|
||||
return 100 / raw;
|
||||
},
|
||||
},
|
||||
|
||||
soft_terrain_coefficient_raw: {
|
||||
type: CharacteristicType.Number,
|
||||
compute({ track, degressive, script }) {
|
||||
return rawTerrainCoefficient(
|
||||
track.resistance_soft,
|
||||
"softGroundPassabilityIncrease",
|
||||
degressive("driver"),
|
||||
script,
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
soft_terrain_coefficient: {
|
||||
type: CharacteristicType.Number,
|
||||
compute({ characteristic }) {
|
||||
const raw = characteristic("soft_terrain_coefficient_raw") as number;
|
||||
return 100 / raw;
|
||||
},
|
||||
},
|
||||
|
||||
hull_traverse_speed: {
|
||||
type: CharacteristicType.Number,
|
||||
|
||||
@@ -163,7 +163,12 @@ export const characteristicsGroups: CharacteristicsGroup[] = [
|
||||
{ name: "power_to_weight", decimals: 1, units: "bhp_t" },
|
||||
{ name: "brake_force", decimals: 1, units: "kN" },
|
||||
|
||||
{ name: "terrain_coefficient", decimals: 2 },
|
||||
{ name: "hard_terrain_coefficient", decimals: 0 },
|
||||
{ name: "medium_terrain_coefficient", decimals: 0 },
|
||||
{ name: "soft_terrain_coefficient", decimals: 0 },
|
||||
{ name: "hard_terrain_coefficient_raw", decimals: 2 },
|
||||
{ name: "medium_terrain_coefficient_raw", decimals: 2 },
|
||||
{ name: "soft_terrain_coefficient_raw", decimals: 2 },
|
||||
|
||||
{ name: "hull_traverse_speed", units: "deg_s" },
|
||||
{ name: "turret_traverse_speed", units: "deg_s" },
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import type { CharacteristicScript } from "../types/characteristics";
|
||||
|
||||
export function rawTerrainCoefficient(
|
||||
resistance: number,
|
||||
passabilityAttribute: string,
|
||||
driverCoefficient: number,
|
||||
script: CharacteristicScript,
|
||||
) {
|
||||
let passabilityIncrease = 0;
|
||||
let terrainResistanceFactor = 1;
|
||||
|
||||
script("protagonist", "Grousers", (effect) => {
|
||||
passabilityIncrease +=
|
||||
(effect.bonusPercentage?.[passabilityAttribute] ?? 0) / 100;
|
||||
});
|
||||
|
||||
script("protagonist", "AttributesModifier", (effect) => {
|
||||
passabilityIncrease +=
|
||||
(effect.attributes?.[passabilityAttribute] ?? 0) / 100;
|
||||
});
|
||||
|
||||
script("protagonist", "AfterburnerAbility", (effect) => {
|
||||
terrainResistanceFactor *= effect.bonusValues?.terrainResistanceFactor ?? 1;
|
||||
});
|
||||
|
||||
return (
|
||||
resistance *
|
||||
(1 - passabilityIncrease) *
|
||||
terrainResistanceFactor *
|
||||
driverCoefficient
|
||||
);
|
||||
}
|
||||
@@ -28,6 +28,12 @@ export type Characteristic = {
|
||||
}
|
||||
);
|
||||
|
||||
export type CharacteristicScript = (
|
||||
side: DuelSide,
|
||||
name: string,
|
||||
effect: (effect: BlitzEffectScript) => void,
|
||||
) => void;
|
||||
|
||||
export interface CharacteristicContext {
|
||||
state: TankState;
|
||||
environment: TankEnvironment;
|
||||
@@ -48,11 +54,7 @@ export interface CharacteristicContext {
|
||||
name: CharacteristicName,
|
||||
): ReturnType<Characteristic["compute"]>;
|
||||
|
||||
script(
|
||||
side: DuelSide,
|
||||
name: string,
|
||||
effect: (effect: BlitzEffectScript) => void,
|
||||
): void;
|
||||
script: CharacteristicScript;
|
||||
}
|
||||
|
||||
export type CrewStatRole = "commander" | "loader" | "gunner" | "driver";
|
||||
|
||||
Reference in new issue
Block a user