mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
feat: shot card equalizer
This commit is contained in:
1 parent
77c516a6eb
commit
145de2bbbc
4 files changed
+22
-7
No files matched your search
@@ -18,6 +18,7 @@ import {
|
||||
import { degToRad } from "three/src/math/MathUtils.js";
|
||||
import { hasEquipment } from "../../../../core/blitzkit/hasEquipment";
|
||||
import { jsxTree } from "../../../../core/blitzkit/jsxTree";
|
||||
import { defaultEqualizer } from "../../../../core/blitzkit/tankToDuelMember";
|
||||
import { discardClippingPlane } from "../../../../core/three/discardClippingPlane";
|
||||
import { Duel } from "../../../../stores/duel";
|
||||
import {
|
||||
@@ -87,6 +88,10 @@ export function SpacedArmorSceneComponent({
|
||||
) => {
|
||||
const { customShell } = Tankopedia.state;
|
||||
const shell = customShell ?? Duel.state.antagonist.shell;
|
||||
const { equalize } = Duel.state;
|
||||
const equalizer =
|
||||
(equalize ? Duel.state.antagonist.tank.equalizer : undefined) ??
|
||||
defaultEqualizer;
|
||||
const cameraNormal = camera.position.clone().sub(point).normalize();
|
||||
const shot: Shot = {
|
||||
splashRadius:
|
||||
@@ -367,6 +372,8 @@ export function SpacedArmorSceneComponent({
|
||||
}
|
||||
}
|
||||
|
||||
shot.damage *= equalizer.damage;
|
||||
|
||||
return shot;
|
||||
},
|
||||
[camera],
|
||||
|
||||
+4
@@ -12,6 +12,7 @@ import {
|
||||
} from "@radix-ui/themes";
|
||||
import { useLocale } from "../../../../hooks/useLocale";
|
||||
import { Duel } from "../../../../stores/duel";
|
||||
import { Tankopedia } from "../../../../stores/tankopedia";
|
||||
import { ConfigurationChildWrapper } from "./ConfigurationChildWrapper";
|
||||
|
||||
export function Equalizer() {
|
||||
@@ -35,6 +36,9 @@ export function Equalizer() {
|
||||
Duel.mutate((draft) => {
|
||||
draft.equalize = !draft.equalize;
|
||||
});
|
||||
Tankopedia.mutate((draft) => {
|
||||
draft.shot = undefined;
|
||||
});
|
||||
}}
|
||||
width="100%"
|
||||
style={{
|
||||
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
} from "@blitzkit/core";
|
||||
import { coefficient } from "@blitzkit/core/src/blitzkit/coefficient";
|
||||
import type { EquipmentMatrix } from "../../stores/duel";
|
||||
import { defaultEqualizer } from "./tankToDuelMember";
|
||||
|
||||
export type TankCharacteristics = ReturnType<typeof tankCharacteristics>;
|
||||
export type TankCharacteristicsKey = keyof TankCharacteristics;
|
||||
@@ -83,13 +84,7 @@ export function tankCharacteristics(
|
||||
const preset = equipmentDefinitions.presets[tank.equipment_preset];
|
||||
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
||||
const gunModelDefinition = turretModelDefinition.guns[gun.id];
|
||||
const equalizer = (equalize ? tank.equalizer : undefined) ?? {
|
||||
armor: 1,
|
||||
damage: 1,
|
||||
health: 1,
|
||||
module_health: 1,
|
||||
penetration: 1,
|
||||
};
|
||||
const equalizer = (equalize ? tank.equalizer : undefined) ?? defaultEqualizer;
|
||||
|
||||
function equipment(id: number) {
|
||||
return preset.slots.some((slot, index) => {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
createDefaultProvisions,
|
||||
Equalizer,
|
||||
type ProvisionDefinitions,
|
||||
type TankDefinition,
|
||||
} from "@blitzkit/core";
|
||||
@@ -28,3 +29,11 @@ export function tankToDuelMember(
|
||||
assaultDistance: (gun.assault_ranges?.ranges[0].distance ?? 0) / 2,
|
||||
} satisfies DuelMember;
|
||||
}
|
||||
|
||||
export const defaultEqualizer: Equalizer = {
|
||||
armor: 1,
|
||||
damage: 1,
|
||||
health: 1,
|
||||
module_health: 1,
|
||||
penetration: 1,
|
||||
};
|
||||
Reference in new issue
Block a user