mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: skill stats
This commit is contained in:
1 parent
eaff26c8d9
commit
099e5eb228
3 files changed
+45
-14
No files matched your search
@@ -5,20 +5,30 @@ import { asset } from '../../../../../../../core/blitzkrieg/asset';
|
|||||||
import { skillDefinitions } from '../../../../../../../core/blitzkrieg/skillDefinitions';
|
import { skillDefinitions } from '../../../../../../../core/blitzkrieg/skillDefinitions';
|
||||||
import { Tier } from '../../../../../../../core/blitzkrieg/tankDefinitions';
|
import { Tier } from '../../../../../../../core/blitzkrieg/tankDefinitions';
|
||||||
import { TIER_ROMAN_NUMERALS } from '../../../../../../../core/blitzkrieg/tankDefinitions/constants';
|
import { TIER_ROMAN_NUMERALS } from '../../../../../../../core/blitzkrieg/tankDefinitions/constants';
|
||||||
import mutateTankopediaPersistent, {
|
import {
|
||||||
useTankopediaPersistent,
|
mutateTankopediaTemporary,
|
||||||
|
useTankopediaTemporary,
|
||||||
} from '../../../../../../../stores/tankopedia';
|
} from '../../../../../../../stores/tankopedia';
|
||||||
import { ConfigurationChildWrapper } from './ConfigurationChildWrapper';
|
import { ConfigurationChildWrapper } from './ConfigurationChildWrapper';
|
||||||
|
|
||||||
|
const usefulSkills = [
|
||||||
|
'smooth_turn',
|
||||||
|
'soft_recoil',
|
||||||
|
'smooth_driving',
|
||||||
|
'smooth_turret',
|
||||||
|
'virtuoso',
|
||||||
|
'camouflage',
|
||||||
|
];
|
||||||
|
|
||||||
export function Skills() {
|
export function Skills() {
|
||||||
const awaitedSkillDefinitions = use(skillDefinitions);
|
const awaitedSkillDefinitions = use(skillDefinitions);
|
||||||
const skillLevels = useTankopediaPersistent((state) => state.skills);
|
const skillLevels = useTankopediaTemporary((state) => state.skills);
|
||||||
|
|
||||||
if (Object.keys(skillLevels).length === 0) {
|
if (Object.keys(skillLevels).length === 0) {
|
||||||
mutateTankopediaPersistent((draft) => {
|
mutateTankopediaTemporary((draft) => {
|
||||||
Object.values(awaitedSkillDefinitions.classes).forEach((skills) => {
|
Object.values(awaitedSkillDefinitions.classes).forEach((skills) => {
|
||||||
skills.forEach((skill) => {
|
skills.forEach((skill) => {
|
||||||
draft.skills[skill] = 0;
|
draft.skills[skill] = usefulSkills.includes(skill) ? 7 : 0;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -49,7 +59,7 @@ export function Skills() {
|
|||||||
}
|
}
|
||||||
icon={asset(`icons/skills/${skill}.webp`)}
|
icon={asset(`icons/skills/${skill}.webp`)}
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
mutateTankopediaPersistent((draft) => {
|
mutateTankopediaTemporary((draft) => {
|
||||||
if (event.shiftKey) {
|
if (event.shiftKey) {
|
||||||
draft.skills[skill] =
|
draft.skills[skill] =
|
||||||
draft.skills[skill] === 0 ? 7 : 0;
|
draft.skills[skill] === 0 ? 7 : 0;
|
||||||
|
|||||||
@@ -25,11 +25,13 @@ import { useEquipment } from '../../../../../../hooks/useEquipment';
|
|||||||
import { useProvision } from '../../../../../../hooks/useProvision';
|
import { useProvision } from '../../../../../../hooks/useProvision';
|
||||||
import { useProvisions } from '../../../../../../hooks/useProvisions';
|
import { useProvisions } from '../../../../../../hooks/useProvisions';
|
||||||
import { mutateDuel, useDuel } from '../../../../../../stores/duel';
|
import { mutateDuel, useDuel } from '../../../../../../stores/duel';
|
||||||
|
import { useTankopediaTemporary } from '../../../../../../stores/tankopedia';
|
||||||
import { Info } from './components/Info';
|
import { Info } from './components/Info';
|
||||||
import { InfoWithDelta } from './components/InfoWithDelta';
|
import { InfoWithDelta } from './components/InfoWithDelta';
|
||||||
|
|
||||||
export function Characteristics() {
|
export function Characteristics() {
|
||||||
const awaitedModelDefinitions = use(modelDefinitions);
|
const awaitedModelDefinitions = use(modelDefinitions);
|
||||||
|
const crewSkills = useTankopediaTemporary((state) => state.skills);
|
||||||
const { tank, turret, gun, engine, track, shell } = useDuel(
|
const { tank, turret, gun, engine, track, shell } = useDuel(
|
||||||
(state) => state.protagonist!,
|
(state) => state.protagonist!,
|
||||||
);
|
);
|
||||||
@@ -132,10 +134,26 @@ export function Characteristics() {
|
|||||||
const dispersionStillCoefficient =
|
const dispersionStillCoefficient =
|
||||||
coefficient([hasRefinedGun, -0.1], [hasReticleCalibration, -0.4]) *
|
coefficient([hasRefinedGun, -0.1], [hasReticleCalibration, -0.4]) *
|
||||||
coefficient([true, degressiveStat(crewMemberMastery)]);
|
coefficient([true, degressiveStat(crewMemberMastery)]);
|
||||||
const dispersionMovingCoefficient = coefficient([
|
const dispersionDamagedCoefficient = coefficient([
|
||||||
hasVerticalStabilizer,
|
hasVerticalStabilizer,
|
||||||
-0.15,
|
-0.15,
|
||||||
]);
|
]);
|
||||||
|
const dispersionHullTraverseCoefficient = coefficient(
|
||||||
|
[hasVerticalStabilizer, -0.15],
|
||||||
|
[true, -crewSkills.smooth_turn / 100],
|
||||||
|
);
|
||||||
|
const dispersionAfterShotCoefficient = coefficient(
|
||||||
|
[hasVerticalStabilizer, -0.15],
|
||||||
|
[true, -crewSkills.soft_recoil / 100],
|
||||||
|
);
|
||||||
|
const dispersionMovingCoefficient = coefficient(
|
||||||
|
[hasVerticalStabilizer, -0.15],
|
||||||
|
[true, -crewSkills.smooth_driving / 100],
|
||||||
|
);
|
||||||
|
const dispersionTurretTraverseCoefficient = coefficient(
|
||||||
|
[hasVerticalStabilizer, -0.15],
|
||||||
|
[true, -crewSkills.smooth_turret * (2 / 100)],
|
||||||
|
);
|
||||||
const enginePowerCoefficient = coefficient(
|
const enginePowerCoefficient = coefficient(
|
||||||
[
|
[
|
||||||
hasEngineAccelerator &&
|
hasEngineAccelerator &&
|
||||||
@@ -161,6 +179,7 @@ export function Characteristics() {
|
|||||||
coefficient(
|
coefficient(
|
||||||
[hasImprovedControl, 0.1],
|
[hasImprovedControl, 0.1],
|
||||||
[hasImprovedEnginePowerBoost, 0.05],
|
[hasImprovedEnginePowerBoost, 0.05],
|
||||||
|
[true, crewSkills.virtuoso / 100],
|
||||||
) * coefficient([true, progressiveStat(crewMemberMastery)]);
|
) * coefficient([true, progressiveStat(crewMemberMastery)]);
|
||||||
const resistanceCoefficient = coefficient([hasImprovedSuspension, -0.25]);
|
const resistanceCoefficient = coefficient([hasImprovedSuspension, -0.25]);
|
||||||
const viewRangeCoefficient =
|
const viewRangeCoefficient =
|
||||||
@@ -204,6 +223,7 @@ export function Characteristics() {
|
|||||||
camouflage,
|
camouflage,
|
||||||
tank.class === 'AT-SPG' ? 0.04 : tank.class === 'heavyTank' ? 0.03 : 0.02,
|
tank.class === 'AT-SPG' ? 0.04 : tank.class === 'heavyTank' ? 0.03 : 0.02,
|
||||||
],
|
],
|
||||||
|
[true, crewSkills.camouflage * (3 / 100)],
|
||||||
);
|
);
|
||||||
|
|
||||||
const resolvedEnginePower = engine.power * enginePowerCoefficient;
|
const resolvedEnginePower = engine.power * enginePowerCoefficient;
|
||||||
@@ -461,7 +481,7 @@ export function Characteristics() {
|
|||||||
name="Hull traversing"
|
name="Hull traversing"
|
||||||
deltaType="lowerIsBetter"
|
deltaType="lowerIsBetter"
|
||||||
>
|
>
|
||||||
{track.dispersion.traverse * dispersionMovingCoefficient}
|
{track.dispersion.traverse * dispersionHullTraverseCoefficient}
|
||||||
</InfoWithDelta>
|
</InfoWithDelta>
|
||||||
<InfoWithDelta
|
<InfoWithDelta
|
||||||
decimals={3}
|
decimals={3}
|
||||||
@@ -470,7 +490,7 @@ export function Characteristics() {
|
|||||||
name="Turret traversing"
|
name="Turret traversing"
|
||||||
deltaType="lowerIsBetter"
|
deltaType="lowerIsBetter"
|
||||||
>
|
>
|
||||||
{gun.dispersion.traverse * dispersionMovingCoefficient}
|
{gun.dispersion.traverse * dispersionTurretTraverseCoefficient}
|
||||||
</InfoWithDelta>
|
</InfoWithDelta>
|
||||||
<InfoWithDelta
|
<InfoWithDelta
|
||||||
decimals={3}
|
decimals={3}
|
||||||
@@ -479,7 +499,7 @@ export function Characteristics() {
|
|||||||
name="After shooting"
|
name="After shooting"
|
||||||
deltaType="lowerIsBetter"
|
deltaType="lowerIsBetter"
|
||||||
>
|
>
|
||||||
{gun.dispersion.shot * dispersionMovingCoefficient}
|
{gun.dispersion.shot * dispersionAfterShotCoefficient}
|
||||||
</InfoWithDelta>
|
</InfoWithDelta>
|
||||||
<InfoWithDelta
|
<InfoWithDelta
|
||||||
decimals={1}
|
decimals={1}
|
||||||
@@ -489,7 +509,7 @@ export function Characteristics() {
|
|||||||
unit="scalar"
|
unit="scalar"
|
||||||
deltaType="lowerIsBetter"
|
deltaType="lowerIsBetter"
|
||||||
>
|
>
|
||||||
{gun.dispersion.damaged * dispersionMovingCoefficient}
|
{gun.dispersion.damaged * dispersionDamagedCoefficient}
|
||||||
</InfoWithDelta>
|
</InfoWithDelta>
|
||||||
<Info name="Gun flexibility" unit="°" />
|
<Info name="Gun flexibility" unit="°" />
|
||||||
<InfoWithDelta decimals={1} indent name="Depression">
|
<InfoWithDelta decimals={1} indent name="Depression">
|
||||||
|
|||||||
@@ -38,12 +38,12 @@ export interface TankopediaPersistent {
|
|||||||
test: TankopediaTestTankDisplay;
|
test: TankopediaTestTankDisplay;
|
||||||
page: number;
|
page: number;
|
||||||
};
|
};
|
||||||
skills: Record<string, number>;
|
|
||||||
mode: TankopediaMode;
|
mode: TankopediaMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TankopediaTemporary {
|
interface TankopediaTemporary {
|
||||||
shot?: Shot;
|
shot?: Shot;
|
||||||
|
skills: Record<string, number>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ShotLayerBase {
|
export interface ShotLayerBase {
|
||||||
@@ -147,7 +147,6 @@ export const useTankopediaPersistent = create<TankopediaPersistent>()(
|
|||||||
test: 'include',
|
test: 'include',
|
||||||
page: 0,
|
page: 0,
|
||||||
},
|
},
|
||||||
skills: {},
|
|
||||||
mode: 'model',
|
mode: 'model',
|
||||||
})),
|
})),
|
||||||
{ name: 'tankopedia', merge: (a, b) => merge(b, a) },
|
{ name: 'tankopedia', merge: (a, b) => merge(b, a) },
|
||||||
@@ -155,7 +154,9 @@ export const useTankopediaPersistent = create<TankopediaPersistent>()(
|
|||||||
);
|
);
|
||||||
|
|
||||||
export const useTankopediaTemporary = create<TankopediaTemporary>()(
|
export const useTankopediaTemporary = create<TankopediaTemporary>()(
|
||||||
subscribeWithSelector<TankopediaTemporary>(() => ({})),
|
subscribeWithSelector<TankopediaTemporary>(() => ({
|
||||||
|
skills: {},
|
||||||
|
})),
|
||||||
);
|
);
|
||||||
|
|
||||||
export default function mutateTankopediaPersistent(
|
export default function mutateTankopediaPersistent(
|
||||||
|
|||||||
Reference in new issue
Block a user