mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 11:17:05 +02:00
feat: camo
This commit is contained in:
1 parent
7281b9fed0
commit
010303a818
4 files changed
+43
-25
No files matched your search
@@ -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)
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
@@ -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" },
|
||||
|
||||
@@ -13,4 +13,5 @@ export interface TankState {
|
||||
isShooting: boolean;
|
||||
isGunDamaged: boolean;
|
||||
terrainHardness: TerrainHardness;
|
||||
isCaughtOnFire: boolean;
|
||||
}
|
||||
@@ -166,6 +166,21 @@ function Content({ id }: { id: string }) {
|
||||
|
||||
<br />
|
||||
|
||||
<div>
|
||||
<span>isCaughtOnFire</span>
|
||||
<input
|
||||
type="checkbox"
|
||||
value={`${protagonist.isCaughtOnFire}`}
|
||||
onChange={(event) => {
|
||||
Tankopedia.mutate((draft) => {
|
||||
draft.protagonist.isCaughtOnFire = event.target.checked;
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
|
||||
{characteristicsOrder.map(({ group, order }) => (
|
||||
<>
|
||||
<h2 key={group}>{group}</h2>
|
||||
|
||||
Reference in new issue
Block a user