aotds-docks/docs/_app/pages/index.svelte-83a54c66.js

2 lines
85 KiB
JavaScript
Raw Normal View History

2021-06-13 17:04:00 +00:00
var t=Object.defineProperty,e=Object.prototype.hasOwnProperty,s=Object.getOwnPropertySymbols,n=Object.prototype.propertyIsEnumerable,a=(e,s,n)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[s]=n,r=(t,r)=>{for(var c in r||(r={}))e.call(r,c)&&a(t,c,r[c]);if(s)for(var c of s(r))n.call(r,c)&&a(t,c,r[c]);return t};import{S as c,i as l,s as o,e as i,t as $,k as u,c as h,a as p,g as f,d as m,n as d,b as g,f as v,F as y,G as b,H as w,I as x,J as E,K as I,L as k,M as D,N as M,U as P,_ as T,O as N,P as O,Q as V,R as A,T as S,V as q,h as C,W as L,X as F,Y as U,Z as j,j as z,m as B,o as H,v as G,r as R,w as W,$ as Y,a0 as J,a1 as X,a2 as Z,a3 as K,a4 as Q,l as tt,D as et,B as st,a5 as nt,u as at,E as rt,p as ct,q as lt,a6 as ot,A as it,a7 as $t,a8 as ut,a9 as ht,aa as pt,ab as ft,ac as mt,ad as dt,ae as gt,af as vt,ag as _t,x as yt}from"../chunks/vendor-7705c5be.js";function bt(t){let e,s,n,a,r,c,l,o,_;return{c(){e=i("header"),s=i("h1"),n=$("The Docks"),a=u(),r=i("h2"),c=$("a "),l=i("a"),o=$("Full Thrust"),_=$(" ship builder"),this.h()},l(t){e=h(t,"HEADER",{class:!0});var i=p(e);s=h(i,"H1",{class:!0});var $=p(s);n=f($,"The Docks"),$.forEach(m),a=d(i),r=h(i,"H2",{class:!0});var u=p(r);c=f(u,"a "),l=h(u,"A",{href:!0});var g=p(l);o=f(g,"Full Thrust"),g.forEach(m),_=f(u," ship builder"),u.forEach(m),i.forEach(m),this.h()},h(){g(s,"class","svelte-1me5k9w"),g(l,"href","https://shop.groundzerogames.co.uk/rules.html"),g(r,"class","svelte-1me5k9w"),g(e,"class","svelte-1me5k9w")},m(t,i){v(t,e,i),y(e,s),y(s,n),y(e,a),y(e,r),y(r,c),y(r,l),y(l,o),y(r,_)},p:b,i:b,o:b,d(t){t&&m(e)}}}class wt extends c{constructor(t){super(),l(this,t,null,bt,o,{})}}const xt=(t={})=>[D(["cost","mass"],t),...Object.values(t||{}).filter((t=>"object"==typeof t)).map((t=>xt(t)))];function Et(t){console.log(t);let{general:a}=t,c=((t,a)=>{var r={};for(var c in t)e.call(t,c)&&a.indexOf(c)<0&&(r[c]=t[c]);if(null!=t&&s)for(var c of s(t))a.indexOf(c)<0&&n.call(t,c)&&(r[c]=t[c]);return r})(t,["general"]);const l=w(xt,x,E(I("cost")))(r(r({},c),{cost:a.mass,mass:0}));return{mass:k("mass",l),cost:k("cost",l)}}const It=t=>Math.ceil(Math.round(10*t)/10);const kt=M("set_ftl",N()),Dt=M("set_ftl_reqs",N()),Mt=new P.default({initial:{mass:0,cost:0,type:"none"}});Mt.addMutation(kt,(t=>T({type:t}))),Mt.addMutation(Dt,(t=>T(t)));var Pt=Mt.asDux;const Tt=M("set_engine",N()),Nt=M("set_drive_reqs",N()),Ot=new P.default({initial:{mass:1,cost:2,rating:1}});Ot.addMutation(Tt,(t=>T(t))),Ot.addMutation(Nt,(t=>T(t)));var Vt=Ot.asDux;function At(t){return"beam"===t.weapon_type?function({weapon_class:t,arcs:e}){let s;1===t&&(s=1);2==t&&(s=2+(e.length>3?1:0));3==t&&(s=4,St(e)?s+=2:s+=e.length-1);4==t&&(s=8,St(e)?s+=4:s+=2*(e.length-1));return{mass:s,cost:3*s}}(t):"submunition"==t.weapon_type||"pds"===t.weapon_type?{mass:1,cost:3}:"scattergun"===t.weapon_type?{mass:1,cost:4}:"needle"===t.weapon_type?{mass:2,cost:6}:{cost:0,mass:0}}const St=t=>4===t.length&&!t.some((t=>1===t.length));const qt=M("add_weapon",N()),Ct=M("remove_weapon",N()),Lt=(Ft=t=>T(At(t)),t=>Ft(t)(t));var Ft;const Ut=new P.default({initial:[]}),jt={beam:{weapon_type:"beam",weapon_class:1,arcs:["F","A","FS","FP","AS","AP"]},submunition:{weapon_type:"submunition",arcs:["F"]},pds:{weapon_type:"pds"},scattergun:{weapon_type:"scattergun"},needle:{weapon_type:"needle",arcs:["F"]}};Ut.addMutation(qt,(t=>e=>{const s=1+Math.max(0,...e.map((({id:t})=>t)));return[...e,r(r({},Lt(jt[t])),{id:s})]})),Ut.addMutation(Ct,(t=>e=>e.filter((e=>e.id!==t))));const zt=M("set_weapon",N());Ut.addMutation(zt,(t=>T.map(T.if(_.matches({id:t.id}),(e=>Lt(T(t,e)))))));var Bt=Ut.asDux;const Ht=new P.default({initial:{rating:0,cost:0,mass:0}});Ht.addMutation(M("set_adfc",N()),(t=>T({rating:t,mass:2*t,cost:8*t})));var Gt=Ht.asDux;var Rt=new P.default({initial:{firecons:{nbr:0,cost:0,mass:0}},subduxes:{weapons:Bt,adfc:Gt}}).asDux;const Wt=[{name:"Scout",mass:[4,10],abbrev:"SC"},{name:"Courier",mass:[4,10],abbrev:"SC"},{name:"Corvette",mass:[8,16],abbrev:"CT"},{name:"Frigate",mass:[14,28],abbrev:"FF"},{name:"Destroyer",mass:[24,36],abbrev:"DD"},{n