graser rules
This commit is contained in:
parent
8a2b1cd306
commit
6ab2de80fa
@ -25,9 +25,39 @@ 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: "graser",
|
||||
name: "graser",
|
||||
reqs: graserReqs,
|
||||
initial: {
|
||||
type: "graser",
|
||||
weaponClass: 1,
|
||||
arcs: ["F"],
|
||||
} as any as Graser,
|
||||
options: {
|
||||
1: {
|
||||
nbrArcs: [1, 3, 6],
|
||||
broadside: true,
|
||||
},
|
||||
2: {
|
||||
nbrArcs: [1, 2, 3, 4, 5, 6],
|
||||
broadside: true,
|
||||
},
|
||||
3: {
|
||||
nbrArcs: [1, 2, 3, 4, 5, 6],
|
||||
broadside: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "beam",
|
||||
name: "beam",
|
||||
@ -88,7 +118,6 @@ const isBroadside = (arcs: Arc[]) => {
|
||||
};
|
||||
|
||||
function beamReqs({ weaponClass, arcs }: Beam) {
|
||||
console.log(weaponClass, arcs);
|
||||
let mass;
|
||||
|
||||
if (weaponClass === 1) {
|
||||
@ -124,3 +153,36 @@ function beamReqs({ weaponClass, arcs }: Beam) {
|
||||
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,
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user