aotds-docks/docs/_app/pages/index.svelte-c756fe11.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,{Updux as xt}from"updux";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 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 It extends i{constructor(t){super(),u(this,t,null,Et,$,{})}}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=require("@yanick/updeep").default,Tt=N("set_ftl",q()),Nt=N("set_ftl_reqs",q()),qt=new wt({initial:{mass:0,cost:0,type:"none"}});qt.addMutation(Tt,(t=>Mt.update({type:t}))),qt.addMutation(Nt,(t=>Mt.update(t)));var Ot=qt.asDux;const Vt=require("@yanick/updeep").default,At=N("set_engine",q()),St=N("set_drive_reqs",q()),Ct=new xt({initial:{mass:1,cost:2,rating:1}});Ct.addMutation(At,(t=>Vt.update(t))),Ct.addMutation(St,(t=>Vt.update(t)));var Lt=Ct.asDux;function Ft(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,Ut(e)?s+=2:s+=e.length-1);4==t&&(s=8,Ut(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 Ut=t=>4===t.length&&!t.some((t=>1===t.length));const jt=require("@yanick/updeep").default,zt=N("add_weapon",q()),Bt=N("remove_weapon",q()),Ht=(Gt=t=>jt(Ft(t)),t=>Gt(t)(t));var Gt;const Rt=new wt({initial:[]}),Wt={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"]}};Rt.addMutation(zt,(t=>e=>{const s=1+Math.max(0,...e.map((({id:t})=>t)));return[...e,o(l({},Ht(Wt[t])),{id:s})]})),Rt.addMutation(Bt,(t=>e=>e.filter((e=>e.id!==t))));const Yt=N("set_weapon",q());Rt.addMutation(Yt,(t=>jt.map(jt.if(_.matches({id:t.id}),(e=>Ht(jt(t,e)))))));var Jt=Rt.asDux;const Xt=require("@yanick/updeep").default,Zt=new wt({initial:{rating:0,cost:0,mass:0}});Zt.addMutation(N("set_adfc",q()),(t=>Xt.update({rating:t,mass:2*t,cost:8*t})));var Kt=Zt.asDux;require("@yanick/updeep").default;var Qt=new wt({initial:{firecons: