mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
Merge branch 'main' into dev
This commit is contained in:
commit
e145d7c6e8
6 files changed
+35
-15
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
# BlitzKit 1.27.14
|
# BlitzKit 1.27.14
|
||||||
|
|
||||||
This is the 14th path for `1.12`, making it the new longest lasting version beating the previous record of `1.15.13`!
|
This is the 14th patch for `1.12`, making it the new longest lasting version beating the previous record of `1.15.13`!
|
||||||
|
|
||||||
## Fixes
|
## Fixes
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# BlitzKit 1.27.15
|
||||||
|
|
||||||
|
I did not see this coming
|
||||||
|
|
||||||
|
## Fixes
|
||||||
|
|
||||||
|
- The Assault Shell graph now supports damage factors of above 100% now
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "blitzkit",
|
"name": "blitzkit",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.27.14",
|
"version": "1.27.15",
|
||||||
"description": "🎉 Tools for everything World of Tanks Blitz",
|
"description": "🎉 Tools for everything World of Tanks Blitz",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./types.d.ts",
|
"types": "./types.d.ts",
|
||||||
|
|||||||
+4
-4
@@ -3,8 +3,8 @@ import { Box, Flex, Text } from '@radix-ui/themes';
|
|||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { clamp } from 'three/src/math/MathUtils.js';
|
import { clamp } from 'three/src/math/MathUtils.js';
|
||||||
import {
|
import {
|
||||||
fakeLog,
|
fakeLogSquishyHigh,
|
||||||
fakeLogInverse,
|
fakeLogSquishyHighInverse,
|
||||||
} from '../../../../../../../../../core/blitzkit/fakeLog';
|
} from '../../../../../../../../../core/blitzkit/fakeLog';
|
||||||
import { Var } from '../../../../../../../../../core/radix/var';
|
import { Var } from '../../../../../../../../../core/radix/var';
|
||||||
import { Duel } from '../../../../../../../../../stores/duel';
|
import { Duel } from '../../../../../../../../../stores/duel';
|
||||||
@@ -19,7 +19,7 @@ export function AssaultCursor({ maxDistance, maxFakeDistance }: Props) {
|
|||||||
const assaultDistance = Duel.use(
|
const assaultDistance = Duel.use(
|
||||||
(state) => state.protagonist.assaultDistance,
|
(state) => state.protagonist.assaultDistance,
|
||||||
);
|
);
|
||||||
const [x, setX] = useState(fakeLog(assaultDistance / maxDistance, 2));
|
const [x, setX] = useState(fakeLogSquishyHigh(assaultDistance / maxDistance));
|
||||||
const cursor = useRef<HTMLDivElement>(null);
|
const cursor = useRef<HTMLDivElement>(null);
|
||||||
const mutateDuel = Duel.useMutation();
|
const mutateDuel = Duel.useMutation();
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ export function AssaultCursor({ maxDistance, maxFakeDistance }: Props) {
|
|||||||
function handlePointerUp() {
|
function handlePointerUp() {
|
||||||
mutateDuel((draft) => {
|
mutateDuel((draft) => {
|
||||||
draft.protagonist.assaultDistance =
|
draft.protagonist.assaultDistance =
|
||||||
fakeLogInverse(localX * maxFakeDistance, 2) * maxDistance;
|
fakeLogSquishyHighInverse(localX * maxFakeDistance) * maxDistance;
|
||||||
});
|
});
|
||||||
|
|
||||||
window.removeEventListener('pointermove', handlePointerMove);
|
window.removeEventListener('pointermove', handlePointerMove);
|
||||||
|
|||||||
+12
-7
@@ -2,7 +2,10 @@ import type { AssaultRanges } from '@blitzkit/core';
|
|||||||
import { literals } from '@blitzkit/i18n';
|
import { literals } from '@blitzkit/i18n';
|
||||||
import { Box, Card, Flex, Text } from '@radix-ui/themes';
|
import { Box, Card, Flex, Text } from '@radix-ui/themes';
|
||||||
import { clamp } from 'three/src/math/MathUtils.js';
|
import { clamp } from 'three/src/math/MathUtils.js';
|
||||||
import { fakeLog } from '../../../../../../../core/blitzkit/fakeLog';
|
import {
|
||||||
|
fakeLogSquishyHigh,
|
||||||
|
fakeLogSquishyLow,
|
||||||
|
} from '../../../../../../../core/blitzkit/fakeLog';
|
||||||
import type { TankCharacteristics } from '../../../../../../../core/blitzkit/tankCharacteristics';
|
import type { TankCharacteristics } from '../../../../../../../core/blitzkit/tankCharacteristics';
|
||||||
import { Var } from '../../../../../../../core/radix/var';
|
import { Var } from '../../../../../../../core/radix/var';
|
||||||
import { useLocale } from '../../../../../../../hooks/useLocale';
|
import { useLocale } from '../../../../../../../hooks/useLocale';
|
||||||
@@ -18,9 +21,10 @@ export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) {
|
|||||||
const ranges = _ranges.ranges.map((range) => ({
|
const ranges = _ranges.ranges.map((range) => ({
|
||||||
factor: range.factor,
|
factor: range.factor,
|
||||||
distance: range.distance,
|
distance: range.distance,
|
||||||
fakeDistance: fakeLog(range.distance / maxDistance, 2),
|
fakeDistance: fakeLogSquishyHigh(range.distance / maxDistance),
|
||||||
}));
|
}));
|
||||||
const maxFakeDistance = ranges.at(-1)!.fakeDistance;
|
const maxFakeDistance = ranges.at(-1)!.fakeDistance;
|
||||||
|
const maxFactor = ranges[0].factor;
|
||||||
|
|
||||||
const { strings } = useLocale();
|
const { strings } = useLocale();
|
||||||
|
|
||||||
@@ -54,8 +58,8 @@ export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) {
|
|||||||
style={{
|
style={{
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
left: 0,
|
left: 0,
|
||||||
top: `${(1 - range.factor) * 100}%`,
|
bottom: `${fakeLogSquishyLow(range.factor / maxFactor) * 100}%`,
|
||||||
transform: 'translateY(-50%)',
|
transform: 'translateY(50%)',
|
||||||
}}
|
}}
|
||||||
color="gray"
|
color="gray"
|
||||||
size="1"
|
size="1"
|
||||||
@@ -70,7 +74,8 @@ export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) {
|
|||||||
|
|
||||||
<Flex flexGrow="1" align="end" position="relative">
|
<Flex flexGrow="1" align="end" position="relative">
|
||||||
{ranges.map((range, index) => {
|
{ranges.map((range, index) => {
|
||||||
const mix = clamp(1.5 * (range.factor - 1) + 1, 0, 1) * 100;
|
const mix =
|
||||||
|
clamp(2 * (range.factor / maxFactor - 1) + 1, 0, 1) * 100;
|
||||||
const color0 = `color-mix(in hsl, ${Var('tomato-9')}, ${Var('jade-9')} ${mix}%)`;
|
const color0 = `color-mix(in hsl, ${Var('tomato-9')}, ${Var('jade-9')} ${mix}%)`;
|
||||||
const color1 = `color-mix(in hsl, ${Var('tomato-7')}, ${Var('jade-7')} ${mix}%)`;
|
const color1 = `color-mix(in hsl, ${Var('tomato-7')}, ${Var('jade-7')} ${mix}%)`;
|
||||||
const last = ranges[index - 1];
|
const last = ranges[index - 1];
|
||||||
@@ -81,7 +86,7 @@ export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) {
|
|||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
width={`${fraction * 100}%`}
|
width={`${fraction * 100}%`}
|
||||||
height={`${range.factor * 100}%`}
|
height={`${fakeLogSquishyLow(range.factor / maxFactor) * 100}%`}
|
||||||
style={{
|
style={{
|
||||||
background: `linear-gradient(45deg, ${color1}, ${color0})`,
|
background: `linear-gradient(45deg, ${color1}, ${color0})`,
|
||||||
}}
|
}}
|
||||||
@@ -95,7 +100,7 @@ export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) {
|
|||||||
key={index}
|
key={index}
|
||||||
position="absolute"
|
position="absolute"
|
||||||
left="0"
|
left="0"
|
||||||
bottom={`${range.factor * 100}%`}
|
bottom={`${fakeLogSquishyLow(range.factor / maxFactor) * 100}%`}
|
||||||
width="100%"
|
width="100%"
|
||||||
height="1pt"
|
height="1pt"
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
const GAMMA = 1.2;
|
const GAMMA = 1.2;
|
||||||
|
|
||||||
export function fakeLog(x: number, a = 1) {
|
export function fakeLogSquishyHigh(x: number) {
|
||||||
return Math.sin((Math.PI / 2) * x) ** (1 / GAMMA);
|
return Math.sin((Math.PI / 2) * x) ** (1 / GAMMA);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fakeLogInverse(y: number, a = 1) {
|
export function fakeLogSquishyHighInverse(y: number) {
|
||||||
return (2 / Math.PI) * Math.asin(y ** GAMMA);
|
return (2 / Math.PI) * Math.asin(y ** GAMMA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function fakeLogSquishyLow(x: number) {
|
||||||
|
return x ** 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function fakeLogSquishyLowInverse(y: number) {
|
||||||
|
return y ** (1 / 2);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user