aotds-docks/docs/_app/pages/index.svelte-fbbafdc4.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 u,s as $,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,O as q,_ as O,P as V,Q as A,R as S,T as C,h as L,U as F,V as U,W as j,X as z,j as B,m as H,o as G,v as R,r as W,w as Y,Y as J,Z as X,$ as Z,a0 as K,a1 as Q,a2 as tt,l as et,D as st,B as nt,a3 as at,u as rt,E as ct,p as lt,q as ot,a4 as it,A as ut,a5 as $t,a6 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,x as bt}from"../chunks/vendor-7686ecbd.js";import wt from"updux";function xt(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 u=d(e);s=m(u,"H1",{class:!0});var $=d(s);n=g($,"The Docks"),$.forEach(v),a=y(u),r=m(u,"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),u.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,u){w(t,e,u),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 Et extends i{constructor(t){super(),u(this,t,null,xt,$,{})}}const It=(t={})=>[T(["cost","mass"],t),...Object.values(t||{}).filter((t=>"object"==typeof t)).map((t=>It(t)))];function kt(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(It,k,D(P("cost")))(o(l({},c),{cost:s.mass,mass:0}));return{mass:M("mass",i),cost:M("cost",i)}}const Dt=t=>Math.ceil(Math.round(10*t)/10);const Pt=require("@yanick/updeep").default,Mt=N("set_ftl",q()),Tt=N("set_ftl_reqs",q()),Nt=new wt({initial:{mass:0,cost:0,type:"none"}});Nt.addMutation(Mt,(t=>Pt.update({type:t}))),Nt.addMutation(Tt,(t=>Pt.update(t)));var qt=Nt.asDux;const Ot=require("@yanick/updeep").default,Vt=N("set_engine",q()),At=N("set_drive_reqs",q()),St=new wt({initial:{mass:1,cost:2,rating:1}});St.addMutation(Vt,(t=>Ot.update(t))),St.addMutation(At,(t=>Ot.update(t)));var Ct=St.asDux;function Lt(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,Ft(e)?s+=2:s+=e.length-1);4==t&&(s=8,Ft(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 Ft=t=>4===t.length&&!t.some((t=>1===t.length));const Ut=require("@yanick/updeep").default,jt=N("add_weapon",q()),zt=N("remove_weapon",q()),Bt=(Ht=t=>Ut(Lt(t)),t=>Ht(t)(t));var Ht;const Gt=new wt({initial:[]}),Rt={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"]}};Gt.addMutation(jt,(t=>e=>{const s=1+Math.max(0,...e.map((({id:t})=>t)));return[...e,o(l({},Bt(Rt[t])),{id:s})]})),Gt.addMutation(zt,(t=>e=>e.filter((e=>e.id!==t))));const Wt=N("set_weapon",q());Gt.addMutation(Wt,(t=>Ut.map(Ut.if(_.matches({id:t.id}),(e=>Bt(Ut(t,e)))))));var Yt=Gt.asDux;const Jt=require("@yanick/updeep").default,Xt=new wt({initial:{rating:0,cost:0,mass:0}});Xt.addMutation(N("set_adfc",q()),(t=>Jt.update({rating:t,mass:2*t,cost:8*t})));var Zt=Xt.asDux;require("@yanick/updeep").default;var Kt=new wt({initial:{firecons:{nbr:0,cost:0