feat: special skills

This commit is contained in:
TrèsAbhi committed 2024-03-31 19:27:37 -05:00
1 parent 099e5eb228
commit 7b0465322d
3 files changed
+28 -19

No files matched your search

@@ -0,0 +1,8 @@
export const permanentSkills = [
'smooth_turn',
'soft_recoil',
'smooth_driving',
'smooth_turret',
'virtuoso',
'camouflage',
];
@@ -1,24 +1,17 @@
import { Flex, Heading } from '@radix-ui/themes'; import { InfoCircledIcon } from '@radix-ui/react-icons';
import { Flex, Heading, Text } from '@radix-ui/themes';
import { use } from 'react'; import { use } from 'react';
import { GenericTankComponentButton } from '../../../../../../../components/ModuleButtons/GenericTankComponentButton'; import { GenericTankComponentButton } from '../../../../../../../../components/ModuleButtons/GenericTankComponentButton';
import { asset } from '../../../../../../../core/blitzkrieg/asset'; 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 { import {
mutateTankopediaTemporary, mutateTankopediaTemporary,
useTankopediaTemporary, useTankopediaTemporary,
} from '../../../../../../../stores/tankopedia'; } from '../../../../../../../../stores/tankopedia';
import { ConfigurationChildWrapper } from './ConfigurationChildWrapper'; import { ConfigurationChildWrapper } from '../ConfigurationChildWrapper';
import { permanentSkills } from './constants';
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);
@@ -28,7 +21,7 @@ export function Skills() {
mutateTankopediaTemporary((draft) => { mutateTankopediaTemporary((draft) => {
Object.values(awaitedSkillDefinitions.classes).forEach((skills) => { Object.values(awaitedSkillDefinitions.classes).forEach((skills) => {
skills.forEach((skill) => { skills.forEach((skill) => {
draft.skills[skill] = usefulSkills.includes(skill) ? 7 : 0; draft.skills[skill] = permanentSkills.includes(skill) ? 7 : 0;
}); });
}); });
}); });
@@ -40,6 +33,11 @@ export function Skills() {
<ConfigurationChildWrapper> <ConfigurationChildWrapper>
<Heading size="4">Crew skills</Heading> <Heading size="4">Crew skills</Heading>
<Text>
<InfoCircledIcon /> Skills in yellow only apply under special
circumstances.
</Text>
<Flex direction="column" gap="2"> <Flex direction="column" gap="2">
{Object.entries(awaitedSkillDefinitions.classes).map( {Object.entries(awaitedSkillDefinitions.classes).map(
([tankClass, skills]) => ( ([tankClass, skills]) => (
@@ -49,6 +47,7 @@ export function Skills() {
return ( return (
<GenericTankComponentButton <GenericTankComponentButton
special={!permanentSkills.includes(skill)}
first first
last last
selected={level > 0} selected={level > 0}
@@ -11,6 +11,7 @@ export interface TankComponentButtonProps
discriminator?: ReactNode; discriminator?: ReactNode;
disabled?: boolean; disabled?: boolean;
banner?: string; banner?: string;
special?: boolean;
} }
export function TankComponentButton({ export function TankComponentButton({
@@ -19,6 +20,7 @@ export function TankComponentButton({
last = false, last = false,
rowChild, rowChild,
discriminator, discriminator,
special,
children, children,
banner, banner,
...props ...props
@@ -26,7 +28,7 @@ export function TankComponentButton({
return ( return (
<Button <Button
radius="medium" radius="medium"
color={selected ? undefined : 'gray'} color={selected ? (special ? 'amber' : undefined) : 'gray'}
variant={selected ? 'surface' : 'soft'} variant={selected ? 'surface' : 'soft'}
style={{ style={{
padding: 0, padding: 0,