aotds-docks/docs/assets/_app/pages/index.svelte-10ca2e7b.js

2 lines
85 KiB
JavaScript
Raw Normal View History

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