diff --git a/.histoire/dist/histoire.json b/.histoire/dist/histoire.json
index 9eb97d5..b5418fc 100644
--- a/.histoire/dist/histoire.json
+++ b/.histoire/dist/histoire.json
@@ -293,6 +293,62 @@
],
"virtual": false,
"markdownFile": null
+ },
+ {
+ "id": "src-lib-components-shipedit-weaponry-weapon-graser-index-story-svelte",
+ "title": "Graser",
+ "group": null,
+ "layout": {
+ "type": "single",
+ "iframe": true
+ },
+ "icon": null,
+ "iconColor": null,
+ "docsOnly": false,
+ "variants": [
+ {
+ "id": "_default",
+ "title": "default"
+ }
+ ],
+ "relativePath": "src/lib/components/ShipEdit/Weaponry/Weapon/Graser/index.story.svelte",
+ "supportPluginId": "svelte3",
+ "treePath": [
+ "ShipEdit",
+ "Weaponry",
+ "Weapon",
+ "Graser"
+ ],
+ "virtual": false,
+ "markdownFile": null
+ },
+ {
+ "id": "src-routes-export-print-printship-weapons-graser-index-story-svelte",
+ "title": "Graser",
+ "group": null,
+ "layout": {
+ "type": "single",
+ "iframe": true
+ },
+ "icon": null,
+ "iconColor": null,
+ "docsOnly": false,
+ "variants": [
+ {
+ "id": "_default",
+ "title": "default"
+ }
+ ],
+ "relativePath": "src/routes/export/print/PrintShip/Weapons/Graser/index.story.svelte",
+ "supportPluginId": "svelte3",
+ "treePath": [
+ "Export",
+ "PrintShip",
+ "Weapons",
+ "Graser"
+ ],
+ "virtual": false,
+ "markdownFile": null
}
],
"markdownFiles": []
diff --git a/.histoire/screenshots/src-lib-components-shipedit-weaponry-weapon-graser-index-story-svelte-_default-1280x800.png b/.histoire/screenshots/src-lib-components-shipedit-weaponry-weapon-graser-index-story-svelte-_default-1280x800.png
new file mode 100644
index 0000000..975b531
Binary files /dev/null and b/.histoire/screenshots/src-lib-components-shipedit-weaponry-weapon-graser-index-story-svelte-_default-1280x800.png differ
diff --git a/.histoire/screenshots/src-routes-export-print-printship-armor-index-story-svelte-src-routes-export-print-printship-armor-index-story-svelte-0-1280x800.png b/.histoire/screenshots/src-routes-export-print-printship-armor-index-story-svelte-src-routes-export-print-printship-armor-index-story-svelte-0-1280x800.png
index 7d1e2bb..120f122 100644
Binary files a/.histoire/screenshots/src-routes-export-print-printship-armor-index-story-svelte-src-routes-export-print-printship-armor-index-story-svelte-0-1280x800.png and b/.histoire/screenshots/src-routes-export-print-printship-armor-index-story-svelte-src-routes-export-print-printship-armor-index-story-svelte-0-1280x800.png differ
diff --git a/.histoire/screenshots/src-routes-export-print-printship-index-story-svelte-_default-1280x800.png b/.histoire/screenshots/src-routes-export-print-printship-index-story-svelte-_default-1280x800.png
index 83bc6f9..fd07540 100644
Binary files a/.histoire/screenshots/src-routes-export-print-printship-index-story-svelte-_default-1280x800.png and b/.histoire/screenshots/src-routes-export-print-printship-index-story-svelte-_default-1280x800.png differ
diff --git a/.histoire/screenshots/src-routes-export-print-printship-weapons-graser-index-story-svelte-_default-1280x800.png b/.histoire/screenshots/src-routes-export-print-printship-weapons-graser-index-story-svelte-_default-1280x800.png
new file mode 100644
index 0000000..3dc19ca
Binary files /dev/null and b/.histoire/screenshots/src-routes-export-print-printship-weapons-graser-index-story-svelte-_default-1280x800.png differ
diff --git a/src/lib/components/ShipEdit/Weaponry/Weapon/Beam/index.svelte b/src/lib/components/ShipEdit/Weaponry/Weapon/Beam/index.svelte
index 3e69191..b7dc8cc 100644
--- a/src/lib/components/ShipEdit/Weaponry/Weapon/Beam/index.svelte
+++ b/src/lib/components/ShipEdit/Weaponry/Weapon/Beam/index.svelte
@@ -60,7 +60,6 @@
const broadside = ["FS", "FP", "AP", "AS"];
function setArcs(firstArc) {
- console.log(firstArc);
let newArcs;
if (nbrArcs === "broadside") {
newArcs = broadside;
diff --git a/src/lib/components/ShipEdit/Weaponry/Weapon/Graser/index.story.svelte b/src/lib/components/ShipEdit/Weaponry/Weapon/Graser/index.story.svelte
new file mode 100644
index 0000000..ccd9b7d
--- /dev/null
+++ b/src/lib/components/ShipEdit/Weaponry/Weapon/Graser/index.story.svelte
@@ -0,0 +1,13 @@
+
+
+
+
+
diff --git a/src/lib/components/ShipEdit/Weaponry/Weapon/Graser/index.svelte b/src/lib/components/ShipEdit/Weaponry/Weapon/Graser/index.svelte
new file mode 100644
index 0000000..3535d8e
--- /dev/null
+++ b/src/lib/components/ShipEdit/Weaponry/Weapon/Graser/index.svelte
@@ -0,0 +1,100 @@
+graser
+
+
+
+ arrow_drop_down
+
+
+
+
+ arrow_drop_down
+
+
+
+
setFirstArc(detail)}
+ />
+
+
+
+
+
diff --git a/src/lib/components/ShipEdit/Weaponry/Weapon/index.svelte b/src/lib/components/ShipEdit/Weaponry/Weapon/index.svelte
index b8bf316..77fbb26 100644
--- a/src/lib/components/ShipEdit/Weaponry/Weapon/index.svelte
+++ b/src/lib/components/ShipEdit/Weaponry/Weapon/index.svelte
@@ -17,6 +17,7 @@
import PointDefenceSystem from "./PDS.svelte";
import Scattergun from "./Scattergun.svelte";
import Needle from "./Needle.svelte";
+ import Graser from "./Graser/index.svelte";
const component = {
beam: Beam,
@@ -24,6 +25,7 @@
pds: PointDefenceSystem,
scattergun: Scattergun,
needle: Needle,
+ graser: Graser,
};
export let reqs = {};
diff --git a/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-10-snap.png b/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-10-snap.png
index cd94684..975b531 100644
Binary files a/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-10-snap.png and b/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-10-snap.png differ
diff --git a/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-11-snap.png b/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-11-snap.png
index 7d1e2bb..cd94684 100644
Binary files a/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-11-snap.png and b/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-11-snap.png differ
diff --git a/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-12-snap.png b/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-12-snap.png
index 28bd9c4..120f122 100644
Binary files a/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-12-snap.png and b/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-12-snap.png differ
diff --git a/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-13-snap.png b/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-13-snap.png
index 83bc6f9..28bd9c4 100644
Binary files a/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-13-snap.png and b/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-13-snap.png differ
diff --git a/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-14-snap.png b/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-14-snap.png
index af2cbe4..fd07540 100644
Binary files a/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-14-snap.png and b/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-14-snap.png differ
diff --git a/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-15-snap.png b/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-15-snap.png
index d46104a..af2cbe4 100644
Binary files a/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-15-snap.png and b/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-15-snap.png differ
diff --git a/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-16-snap.png b/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-16-snap.png
new file mode 100644
index 0000000..3dc19ca
Binary files /dev/null and b/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-16-snap.png differ
diff --git a/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-17-snap.png b/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-17-snap.png
new file mode 100644
index 0000000..d46104a
Binary files /dev/null and b/src/lib/components/__image_snapshots__/screenshots-test-ts-src-lib-components-screenshots-test-ts-image-snapshot-17-snap.png differ
diff --git a/src/lib/store/ship/weaponry/rules.ts b/src/lib/store/ship/weaponry/rules.ts
index 42b6fd1..3c3d024 100644
--- a/src/lib/store/ship/weaponry/rules.ts
+++ b/src/lib/store/ship/weaponry/rules.ts
@@ -2,125 +2,186 @@ import type { Reqs } from "$lib/shipDux/reqs";
export const arcs = ["FS", "F", "FP", "AP", "A", "AS"] as const;
+export const broadsideArcs = ["FP", "AP", "AS", "FS"];
+
export type Arc = (typeof arcs)[number];
export type WeaponType = "beam";
type Beam = {
- type: "beam";
- weaponClass: 1 | 2 | 3 | 4;
- arcs: Arc[];
+ type: "beam";
+ weaponClass: 1 | 2 | 3 | 4;
+ arcs: Arc[];
};
type Submunition = {
- type: "submunition";
- arc: Arc;
+ type: "submunition";
+ arc: Arc;
};
type PDS = {
- type: "pds";
+ type: "pds";
};
type Scattergun = { type: "scattergun" };
type Needle = { type: "needle"; arc: Arc };
-export type Weapon = Beam | Submunition | PDS | Scattergun | Needle;
+type Graser = {
+ type: "graser";
+ weaponClass: 1 | 2 | 3;
+ arcs: Arc[];
+};
+
+export type Weapon = Beam | Submunition | PDS | Scattergun | Needle | Graser;
export const weaponTypes = [
- {
- type: "beam",
- name: "beam",
- reqs: beamReqs,
- initial: {
- type: "beam",
- weaponClass: 1,
- arcs,
- } as any as Beam,
- },
- {
- type: "submunition",
- name: "submunition pack",
- reqs: { mass: 1, cost: 3 },
- initial: { type: "submunition", arc: "F" } as Submunition,
- },
- {
- name: "point defence system",
- type: "pds",
- reqs: { mass: 1, cost: 3 },
- initial: {
- type: "pds",
+ {
+ type: "beam",
+ name: "beam",
+ reqs: beamReqs,
+ initial: {
+ type: "beam",
+ weaponClass: 1,
+ arcs,
+ } as any as Beam,
+ },
+ {
+ type: "graser",
+ name: "graser",
+ reqs: graserReqs,
+ initial: {
+ type: "graser",
+ weaponClass: 1,
+ arcs: ["F"],
+ } as any as Graser,
+ options: [
+ { weaponClass: 1, nbrArcs: [1, 3, 6, "broadside"] },
+ {
+ weaponClass: 2,
+ nbrArcs: [1, 2, 3, 4, 5, 6, "broadside"],
+ },
+ {
+ weaponClass: 3,
+ nbrArcs: [1, 2, 3, 4, 5, 6, "broadside"],
+ },
+ ],
+ },
+ {
+ type: "submunition",
+ name: "submunition pack",
+ reqs: { mass: 1, cost: 3 },
+ initial: { type: "submunition", arc: "F" } as Submunition,
+ },
+ {
+ name: "point defence system",
+ type: "pds",
+ reqs: { mass: 1, cost: 3 },
+ initial: {
+ type: "pds",
+ },
+ },
+ {
+ name: "scattergun",
+ type: "scattergun",
+ reqs: { mass: 1, cost: 4 },
+ initial: { type: "scattergun" },
+ },
+ {
+ name: "needle beam",
+ type: "needle",
+ reqs: { mass: 2, cost: 6 },
+ initial: { arc: "F", type: "needle" },
},
- },
- {
- name: "scattergun",
- type: "scattergun",
- reqs: { mass: 1, cost: 4 },
- initial: { type: "scattergun" },
- },
- {
- name: "needle beam",
- type: "needle",
- reqs: { mass: 2, cost: 6 },
- initial: { arc: "F", type: "needle" },
- },
];
export function weaponReqs(weapon): Reqs {
- const { reqs } = weaponTypes.find((wt) => wt.type === weapon.type) || {};
+ const { reqs } = weaponTypes.find((wt) => wt.type === weapon.type) || {};
- if (!reqs)
- return {
- cost: 0,
- mass: 0,
- };
+ if (!reqs)
+ return {
+ cost: 0,
+ mass: 0,
+ };
- if (typeof reqs === "function") return reqs(weapon);
+ if (typeof reqs === "function") return reqs(weapon);
- return reqs;
+ return reqs;
}
-const isBroadside = (arcs: Arc[]) => {
- if (arcs.length !== 4) return false;
+export const isBroadside = (arcs: Arc[]) => {
+ if (arcs.length !== 4) return false;
- // that'd be A or F
- return !arcs.some((a) => a.length === 1);
+ // that'd be A or F
+ return !arcs.some((a) => a.length === 1);
};
function beamReqs({ weaponClass, arcs }: Beam) {
- console.log(weaponClass, arcs);
- let mass;
+ let mass;
- if (weaponClass === 1) {
- mass = 1;
- }
-
- if (weaponClass === 2) {
- mass = 2 + (arcs.length > 3 ? 1 : 0);
- }
-
- if (weaponClass == 3) {
- mass = 4;
-
- if (isBroadside(arcs)) {
- mass += 2;
- } else {
- mass += arcs.length - 1;
+ if (weaponClass === 1) {
+ mass = 1;
}
- }
- if (weaponClass == 4) {
- mass = 8;
-
- if (isBroadside(arcs)) {
- mass += 4;
- } else {
- mass += 2 * (arcs.length - 1);
+ if (weaponClass === 2) {
+ mass = 2 + (arcs.length > 3 ? 1 : 0);
}
- }
- return {
- mass,
- cost: 3 * mass,
- };
+ if (weaponClass == 3) {
+ mass = 4;
+
+ if (isBroadside(arcs)) {
+ mass += 2;
+ } else {
+ mass += arcs.length - 1;
+ }
+ }
+
+ if (weaponClass == 4) {
+ mass = 8;
+
+ if (isBroadside(arcs)) {
+ mass += 4;
+ } else {
+ mass += 2 * (arcs.length - 1);
+ }
+ }
+
+ return {
+ mass,
+ cost: 3 * mass,
+ };
+}
+
+function graserReqs({ weaponClass, arcs }: Beam) {
+ let mass: number;
+
+ if (weaponClass === 1) {
+ if (arcs.length === 1) {
+ mass = 2;
+ } else if (arcs.length === 3) {
+ mass = 3;
+ } else {
+ mass = 4;
+ }
+ } else if (weaponClass === 2) {
+ mass = 9;
+ if (isBroadside(arcs)) {
+ mass += 6;
+ } else {
+ mass += 3 * (arcs.length - 1);
+ }
+ } else if (weaponClass === 3) {
+ mass = 24;
+ if (isBroadside(arcs)) {
+ mass += 12;
+ } else {
+ mass += 6 * (arcs.length - 1);
+ }
+ }
+
+ return {
+ mass,
+ cost: 4 * mass,
+ };
}
diff --git a/src/routes/export/print/PrintShip/Weapons/Beam.svelte b/src/routes/export/print/PrintShip/Weapons/Beam.svelte
index 960794d..19c98e8 100644
--- a/src/routes/export/print/PrintShip/Weapons/Beam.svelte
+++ b/src/routes/export/print/PrintShip/Weapons/Beam.svelte
@@ -1,5 +1,5 @@
-
+
{weaponClass}
diff --git a/src/routes/export/print/PrintShip/Weapons/Graser/index.story.svelte b/src/routes/export/print/PrintShip/Weapons/Graser/index.story.svelte
new file mode 100644
index 0000000..9891df1
--- /dev/null
+++ b/src/routes/export/print/PrintShip/Weapons/Graser/index.story.svelte
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/src/routes/export/print/PrintShip/Weapons/Graser/index.svelte b/src/routes/export/print/PrintShip/Weapons/Graser/index.svelte
new file mode 100644
index 0000000..f90745e
--- /dev/null
+++ b/src/routes/export/print/PrintShip/Weapons/Graser/index.svelte
@@ -0,0 +1,35 @@
+
+
+
+
+ {weaponClass}
+
+
+
+
+
+
+
diff --git a/src/routes/export/print/PrintShip/Weapons/printComps.js b/src/routes/export/print/PrintShip/Weapons/printComps.js
index 6db9afc..af00c95 100644
--- a/src/routes/export/print/PrintShip/Weapons/printComps.js
+++ b/src/routes/export/print/PrintShip/Weapons/printComps.js
@@ -3,11 +3,13 @@ import Submunition from "./Submunition.svelte";
import PDS from "./PDS.svelte";
import Scattergun from "./Scattergun.svelte";
import Needlebeam from "./Needlebeam.svelte";
+import Graser from "./Graser/index.svelte";
export default {
- beam: Beam,
- submunition: Submunition,
- pds: PDS,
- scattergun: Scattergun,
- needle: Needlebeam,
+ graser: Graser,
+ beam: Beam,
+ submunition: Submunition,
+ pds: PDS,
+ scattergun: Scattergun,
+ needle: Needlebeam,
};