mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: implement most equalizer
This commit is contained in:
1 parent
6835004945
commit
77c516a6eb
10 files changed
+58
-41
No files matched your search
+8
-6
@@ -59,11 +59,12 @@ export const InfoWithDelta = memo<InfoWithDeltaProps>(
|
||||
const delta = useDelta(uhWhatDoICallThisVariable);
|
||||
const protagonistTank = Duel.use((state) => state.protagonist.tank);
|
||||
const shellIndex = Duel.use((state) =>
|
||||
state.protagonist.gun.shells.indexOf(state.protagonist.shell)
|
||||
state.protagonist.gun.shells.indexOf(state.protagonist.shell),
|
||||
);
|
||||
const equipmentMatrix = Duel.use(
|
||||
(state) => state.protagonist.equipmentMatrix
|
||||
(state) => state.protagonist.equipmentMatrix,
|
||||
);
|
||||
const equalize = Duel.use((state) => state.equalize);
|
||||
const others = useMemo(() => {
|
||||
const defaultSkills = createDefaultSkills(skillDefinitions);
|
||||
|
||||
@@ -75,7 +76,7 @@ export const InfoWithDelta = memo<InfoWithDeltaProps>(
|
||||
tank.class === protagonistTank.class) ||
|
||||
(relativeAgainst === TankopediaRelativeAgainst.Tier &&
|
||||
tank.tier === protagonistTank.tier) ||
|
||||
relativeAgainst === TankopediaRelativeAgainst.All
|
||||
relativeAgainst === TankopediaRelativeAgainst.All,
|
||||
)
|
||||
.map((tank) => {
|
||||
const member = tankToDuelMember(tank, provisionDefinitions);
|
||||
@@ -105,12 +106,13 @@ export const InfoWithDelta = memo<InfoWithDeltaProps>(
|
||||
track: member.track,
|
||||
turret: member.turret,
|
||||
assaultDistance: member.assaultDistance,
|
||||
equalize,
|
||||
},
|
||||
{
|
||||
equipmentDefinitions,
|
||||
provisionDefinitions,
|
||||
tankModelDefinition: modelDefinitions.models[tank.id],
|
||||
}
|
||||
},
|
||||
);
|
||||
})
|
||||
.filter((tank) => {
|
||||
@@ -123,7 +125,7 @@ export const InfoWithDelta = memo<InfoWithDeltaProps>(
|
||||
|
||||
return othersValue !== undefined;
|
||||
}) as TankCharacteristics[];
|
||||
}, [relativeAgainst, shellIndex, equipmentMatrix]);
|
||||
}, [relativeAgainst, shellIndex, equipmentMatrix, equalize]);
|
||||
const betterTanks = others.filter((tank) => {
|
||||
const othersValue =
|
||||
typeof props.value === "function"
|
||||
@@ -183,5 +185,5 @@ export const InfoWithDelta = memo<InfoWithDeltaProps>(
|
||||
|
||||
(a, b) =>
|
||||
(typeof a.value === "function" ? a.value(a.stats) : a.stats[a.value]) ===
|
||||
(typeof b.value === "function" ? b.value(b.stats) : b.stats[b.value])
|
||||
(typeof b.value === "function" ? b.value(b.stats) : b.stats[b.value]),
|
||||
);
|
||||
+2
@@ -31,6 +31,7 @@ export function Characteristics({ skeleton }: MaybeSkeletonComponentProps) {
|
||||
const equipmentMatrix = Duel.use(
|
||||
(state) => state.protagonist.equipmentMatrix,
|
||||
);
|
||||
const equalize = Duel.use((state) => state.equalize);
|
||||
const { tank, turret, gun, engine, track, shell } = Duel.use(
|
||||
(state) => state.protagonist,
|
||||
);
|
||||
@@ -62,6 +63,7 @@ export function Characteristics({ skeleton }: MaybeSkeletonComponentProps) {
|
||||
applyDynamicArmor: false,
|
||||
applySpallLiner: false,
|
||||
assaultDistance,
|
||||
equalize,
|
||||
},
|
||||
{
|
||||
tankModelDefinition,
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ import { ConfigurationChildWrapper } from "./ConfigurationChildWrapper";
|
||||
|
||||
export function Equalizer() {
|
||||
const { strings } = useLocale();
|
||||
const equalize = Duel.use((state) => state.protagonist.equalize);
|
||||
const equalize = Duel.use((state) => state.equalize);
|
||||
|
||||
return (
|
||||
<ConfigurationChildWrapper>
|
||||
@@ -33,7 +33,7 @@ export function Equalizer() {
|
||||
mt="2"
|
||||
onClick={() => {
|
||||
Duel.mutate((draft) => {
|
||||
draft.protagonist.equalize = !draft.protagonist.equalize;
|
||||
draft.equalize = !draft.equalize;
|
||||
});
|
||||
}}
|
||||
width="100%"
|
||||
|
||||
Reference in new issue
Block a user