mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-16 06:06:11 +01:00
hull traverse speeds
This commit is contained in:
1 parent
e7708ce01b
commit
e1bc11644d
8 files changed
+208
-78
No files matched your search
@@ -0,0 +1,109 @@
|
||||
import type {
|
||||
CharacteristicContext,
|
||||
CharacteristicScript,
|
||||
} from "../types/characteristics";
|
||||
import { tankClassToBlitzTankClass } from "./tankClass";
|
||||
|
||||
function hullTraverseEnginePowerCoefficient(
|
||||
tank: TankDefinition,
|
||||
script: CharacteristicScript,
|
||||
) {
|
||||
let coefficient = 1;
|
||||
|
||||
const enginePowerPercentage = tankClassToBlitzTankClass[tank.class];
|
||||
|
||||
script("protagonist", "RecycledEngine", (effect) => {
|
||||
coefficient +=
|
||||
(effect.enginePowerPercentageBonus?.[enginePowerPercentage] ?? 0) / 100;
|
||||
});
|
||||
|
||||
script("protagonist", "Afterburning", (effect) => {
|
||||
coefficient += (effect.bonusValues?.enginePowerIncrease ?? 0) / 100;
|
||||
});
|
||||
|
||||
script("protagonist", "ImprovedAfterburning", (effect) => {
|
||||
coefficient += (effect.enginePowerIncrease ?? 1) - 1;
|
||||
});
|
||||
|
||||
script("protagonist", "Fuel", (effect) => {
|
||||
coefficient += (effect.bonusValues?.enginePowerIncrease ?? 0) / 100;
|
||||
});
|
||||
|
||||
script("protagonist", "GearOil", (effect) => {
|
||||
coefficient += (effect.bonusValues?.enginePowerIncrease ?? 0) / 100;
|
||||
});
|
||||
|
||||
script("protagonist", "AttributesModifier", (effect) => {
|
||||
coefficient *= effect.attributes?.enginePowerFactor ?? 1;
|
||||
});
|
||||
|
||||
return coefficient;
|
||||
}
|
||||
|
||||
function hullTraverseRotationCoefficient(
|
||||
driverCoefficient: number,
|
||||
virtuosoSkill: number,
|
||||
script: CharacteristicScript,
|
||||
) {
|
||||
let coefficient = 1 + virtuosoSkill / 100;
|
||||
let rotationSpeedFactor = 1;
|
||||
|
||||
script("protagonist", "StaticPhysicsAttrsModifier", (effect) => {
|
||||
coefficient += (effect.bonusPercentage?.rotationSpeedFactor ?? 0) / 100;
|
||||
});
|
||||
|
||||
script("protagonist", "ImprovedAfterburning", (effect) => {
|
||||
rotationSpeedFactor *= effect.rotationSpeedFactor ?? 1;
|
||||
});
|
||||
|
||||
script("protagonist", "AfterburnerAbility", (effect) => {
|
||||
rotationSpeedFactor *= effect.bonusValues?.rotationSpeedFactor ?? 1;
|
||||
});
|
||||
|
||||
return driverCoefficient * coefficient * rotationSpeedFactor;
|
||||
}
|
||||
|
||||
export function hullTraverseSpeed(
|
||||
rawTerrainResistance: number,
|
||||
context: CharacteristicContext,
|
||||
) {
|
||||
const {
|
||||
tank,
|
||||
engine,
|
||||
track,
|
||||
turret,
|
||||
gun,
|
||||
progressive,
|
||||
script,
|
||||
environment,
|
||||
} = context;
|
||||
const terrainResistance = track.resistance_hard;
|
||||
const stockEngine = tank.engines[0];
|
||||
const stockTrack = tank.tracks[0];
|
||||
const stockTurret = tank.turrets[0];
|
||||
const stockGun = stockTurret.guns[0];
|
||||
const stockWeight =
|
||||
tank.weight +
|
||||
stockEngine.weight +
|
||||
stockTrack.weight +
|
||||
stockTurret.weight +
|
||||
stockGun.weight;
|
||||
const weight =
|
||||
tank.weight + engine.weight + track.weight + turret.weight + gun.weight;
|
||||
const enginePower =
|
||||
(engine.power * hullTraverseEnginePowerCoefficient(tank, script)) /
|
||||
stockEngine.power;
|
||||
const rotationSpeed = hullTraverseRotationCoefficient(
|
||||
progressive("driver"),
|
||||
environment.skills.virtuoso ?? 0,
|
||||
script,
|
||||
);
|
||||
|
||||
return (
|
||||
enginePower *
|
||||
track.traverse_speed *
|
||||
rotationSpeed *
|
||||
(terrainResistance / rawTerrainResistance) *
|
||||
(stockWeight / weight)
|
||||
);
|
||||
}
|
||||
@@ -6,17 +6,17 @@ export function rawTerrainCoefficient(
|
||||
driverCoefficient: number,
|
||||
script: CharacteristicScript,
|
||||
) {
|
||||
let passabilityIncrease = 0;
|
||||
let passabilityFactor = 1;
|
||||
let terrainResistanceFactor = 1;
|
||||
|
||||
script("protagonist", "Grousers", (effect) => {
|
||||
passabilityIncrease +=
|
||||
(effect.bonusPercentage?.[passabilityAttribute] ?? 0) / 100;
|
||||
passabilityFactor *=
|
||||
1 - (effect.bonusPercentage?.[passabilityAttribute] ?? 0) / 100;
|
||||
});
|
||||
|
||||
script("protagonist", "AttributesModifier", (effect) => {
|
||||
passabilityIncrease +=
|
||||
(effect.attributes?.[passabilityAttribute] ?? 0) / 100;
|
||||
passabilityFactor *=
|
||||
1 - (effect.attributes?.[passabilityAttribute] ?? 0) / 100;
|
||||
});
|
||||
|
||||
script("protagonist", "AfterburnerAbility", (effect) => {
|
||||
@@ -25,7 +25,7 @@ export function rawTerrainCoefficient(
|
||||
|
||||
return (
|
||||
resistance *
|
||||
(1 - passabilityIncrease) *
|
||||
passabilityFactor *
|
||||
terrainResistanceFactor *
|
||||
driverCoefficient
|
||||
);
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import type { BlitzTankClass } from "@blitzkit/core";
|
||||
import { TankClass } from "@blitzkit/protos";
|
||||
|
||||
export const tankClassToBlitzTankClass: Record<TankClass, BlitzTankClass> = {
|
||||
[TankClass.TANK_CLASS_LIGHT]: "lightTank",
|
||||
[TankClass.TANK_CLASS_MEDIUM]: "mediumTank",
|
||||
[TankClass.TANK_CLASS_HEAVY]: "heavyTank",
|
||||
[TankClass.TANK_CLASS_TANK_DESTROYER]: "AT-SPG",
|
||||
};
|
||||
Reference in new issue
Block a user