diff --git a/packages/website-ue/src/core/tankopedia/characteristics.ts b/packages/website-ue/src/core/tankopedia/characteristics.ts index 5339dfde9..881f7b546 100644 --- a/packages/website-ue/src/core/tankopedia/characteristics.ts +++ b/packages/website-ue/src/core/tankopedia/characteristics.ts @@ -1,3 +1,4 @@ +import { TankClass } from "@blitzkit/core"; import type { TankCatalogComponent } from "@protos/blitz_static_tank_component"; import { ShellUpgrageSingleChange_AttributeName, @@ -344,33 +345,38 @@ export const characteristics = { ); }, - camouflage_still({ attribute }) { - return attribute( + class({ tank }) { + return tank.tank_class; + }, + + camouflage({ attribute, characteristic, attributeSafe, state }) { + const tankClass = characteristic("class"); + const base = attribute( TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CONCEALMENT_STILL ); - }, - - camouflage_moving({ attribute }) { - return attribute( - TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CONCEALMENT_MOVING - ); - }, - - camouflage_shooting_still({ attribute }) { - return attribute( + const moving = + tankClass === TankClass.LIGHT + ? 0 + : attribute( + TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CONCEALMENT_MOVING + ); + const shooting = attribute( TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CONCEALMENT_FACTOR_AT_SHOT ); - }, - camouflage_shooting_moving() { - return -Infinity; - }, - - camouflage_on_fire({ attributeSafe }) { - return ( + if ( attributeSafe( TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CONCEALMENT_FIRE_PENALTY - ) ?? -Infinity + ) + ) { + throw new Error("Fire penalty implemented! Code it in!!"); + } + + return ( + 100 * + base * + (1 + moving * state.speed) * + (state.isShooting ? shooting : 1) ); }, diff --git a/packages/website-ue/src/core/tankopedia/characteristicsOrder.ts b/packages/website-ue/src/core/tankopedia/characteristicsOrder.ts index 85a940ec5..1687e819c 100644 --- a/packages/website-ue/src/core/tankopedia/characteristicsOrder.ts +++ b/packages/website-ue/src/core/tankopedia/characteristicsOrder.ts @@ -85,11 +85,7 @@ export const characteristicsOrder: CharacteristicsOrder = [ { toy: "view_range" }, - { name: "camouflage_still", units: "%" }, - { name: "camouflage_moving", units: "%" }, - { name: "camouflage_shooting_still", units: "%" }, - { name: "camouflage_shooting_moving", units: "%" }, - { name: "camouflage_on_fire", units: "%" }, + { name: "camouflage", decimals: 0, units: "%" }, { name: "height", units: "m" }, { name: "length", units: "m" }, diff --git a/packages/website-ue/src/core/tankopedia/tankState.ts b/packages/website-ue/src/core/tankopedia/tankState.ts index 382ac6d63..ae7df9d55 100644 --- a/packages/website-ue/src/core/tankopedia/tankState.ts +++ b/packages/website-ue/src/core/tankopedia/tankState.ts @@ -13,4 +13,5 @@ export interface TankState { isShooting: boolean; isGunDamaged: boolean; terrainHardness: TerrainHardness; + isCaughtOnFire: boolean; } diff --git a/packages/website-ue/src/pages/tanks/[slug]/_index.tsx b/packages/website-ue/src/pages/tanks/[slug]/_index.tsx index 5bd0686a8..f3c3a669d 100644 --- a/packages/website-ue/src/pages/tanks/[slug]/_index.tsx +++ b/packages/website-ue/src/pages/tanks/[slug]/_index.tsx @@ -166,6 +166,21 @@ function Content({ id }: { id: string }) {
+
+ isCaughtOnFire + { + Tankopedia.mutate((draft) => { + draft.protagonist.isCaughtOnFire = event.target.checked; + }); + }} + /> +
+ +
+ {characteristicsOrder.map(({ group, order }) => ( <>

{group}