mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: simplify
This commit is contained in:
1 parent
744f7195dd
commit
898fd4bbf6
1 file changed
+15
-13
@@ -27,6 +27,8 @@ import { defaultEqualizer } from "./tankToDuelMember";
|
|||||||
export type TankCharacteristics = ReturnType<typeof tankCharacteristics>;
|
export type TankCharacteristics = ReturnType<typeof tankCharacteristics>;
|
||||||
export type TankCharacteristicsKey = keyof TankCharacteristics;
|
export type TankCharacteristicsKey = keyof TankCharacteristics;
|
||||||
|
|
||||||
|
const EQUALIZER_HEALTH_EPSILON = 50;
|
||||||
|
|
||||||
export function tankCharacteristics(
|
export function tankCharacteristics(
|
||||||
{
|
{
|
||||||
tank,
|
tank,
|
||||||
@@ -187,12 +189,12 @@ export function tankCharacteristics(
|
|||||||
hasCalibratedShells,
|
hasCalibratedShells,
|
||||||
resolvePenetrationCoefficient(true, equalize, shell.type, equalizer) - 1,
|
resolvePenetrationCoefficient(true, equalize, shell.type, equalizer) - 1,
|
||||||
]) * equalizer.penetration;
|
]) * equalizer.penetration;
|
||||||
const equalizerHealthCoefficient = equalizer.health;
|
const healthCoefficient =
|
||||||
const healthBonusCoefficient = coefficient(
|
coefficient(
|
||||||
[hasSandbagArmor, 0.03],
|
[hasSandbagArmor, 0.03],
|
||||||
[hasEnhancedSandbagArmor, 0.06],
|
[hasEnhancedSandbagArmor, 0.06],
|
||||||
[hasImprovedAssembly, 0.04],
|
[hasImprovedAssembly, 0.04],
|
||||||
);
|
) * equalizer.health;
|
||||||
const shellVelocityCoefficient = coefficient(
|
const shellVelocityCoefficient = coefficient(
|
||||||
[hasSupercharger, 0.35],
|
[hasSupercharger, 0.35],
|
||||||
[hasImprovedGunPowder, 0.3],
|
[hasImprovedGunPowder, 0.3],
|
||||||
@@ -506,13 +508,13 @@ export function tankCharacteristics(
|
|||||||
hullTraverseCoefficient *
|
hullTraverseCoefficient *
|
||||||
(track.resistance_hard / softTerrainCoefficientRaw) *
|
(track.resistance_hard / softTerrainCoefficientRaw) *
|
||||||
(stockWeight / weightKg);
|
(stockWeight / weightKg);
|
||||||
const epsilon = 50;
|
let health = (tank.health + turret.health) * healthCoefficient;
|
||||||
const baseHealth = tank.health + turret.health;
|
|
||||||
const equalizedBaseHealth = baseHealth * equalizerHealthCoefficient;
|
if (equalize) {
|
||||||
const quantizedEqualizedBaseHealth = equalize
|
health =
|
||||||
? Math.round(equalizedBaseHealth / epsilon) * epsilon
|
EQUALIZER_HEALTH_EPSILON * Math.round(health / EQUALIZER_HEALTH_EPSILON);
|
||||||
: equalizedBaseHealth;
|
}
|
||||||
const health = quantizedEqualizedBaseHealth * healthBonusCoefficient;
|
|
||||||
const fireChance = engine.fire_chance * fireChanceCoefficient;
|
const fireChance = engine.fire_chance * fireChanceCoefficient;
|
||||||
const viewRange = turret.view_range * viewRangeCoefficient;
|
const viewRange = turret.view_range * viewRangeCoefficient;
|
||||||
const camouflageStill = tank.camouflage_still * camouflageCoefficientStill;
|
const camouflageStill = tank.camouflage_still * camouflageCoefficientStill;
|
||||||
|
|||||||
Reference in new issue
Block a user