2 lines
85 KiB
JavaScript
2 lines
85 KiB
JavaScript
|
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,O,_ as V,P as A,Q as S,R as q,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 $t,a5 as ut,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-dc8940a4.js";import wt,{Updux as xt}from"updux";import Et from"@yanick/updeep";function It(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 kt extends i{constructor(t){super(),$(this,t,null,It,u,{})}}const Dt=(t={})=>[T(["cost","mass"],t),...Object.values(t||{}).filter((t=>"object"==typeof t)).map((t=>Dt(t)))];function Pt(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(Dt,k,D(P("cost")))(o(l({},c),{cost:s.mass,mass:0}));return{mass:M("mass",i),cost:M("cost",i)}}const Mt=t=>Math.ceil(Math.round(10*t)/10);const Tt=N("set_ftl",O()),Nt=N("set_ftl_reqs",O()),Ot=new wt({initial:{mass:0,cost:0,type:"none"}});Ot.addMutation(Tt,(t=>Et.update({type:t}))),Ot.addMutation(Nt,(t=>Et.update(t)));var Vt=Ot.asDux;const At=N("set_engine",O()),St=N("set_drive_reqs",O()),qt=new xt({initial:{mass:1,cost:2,rating:1}});qt.addMutation(At,(t=>Et.update(t))),qt.addMutation(St,(t=>Et.update(t)));var Ct=qt.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=N("add_weapon",O()),jt=N("remove_weapon",O()),zt=(Bt=t=>Et(Lt(t)),t=>Bt(t)(t));var Bt;const Ht=new xt({initial:[]}),Gt={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"]}};Ht.addMutation(Ut,(t=>e=>{const s=1+Math.max(0,...e.map((({id:t})=>t)));return[...e,o(l({},zt(Gt[t])),{id:s})]})),Ht.addMutation(jt,(t=>e=>e.filter((e=>e.id!==t))));const Rt=N("set_weapon",O());Ht.addMutation(Rt,(t=>Et.map(Et.if(_.matches({id:t.id}),(e=>zt(Et(t,e)))))));var Wt=Ht.asDux;const Yt=new xt({initial:{rating:0,cost:0,mass:0}});Yt.addMutation(N("set_adfc",O()),(t=>Et.update({rating:t,mass:2*t,cost:8*t})));var Jt=new xt({initial:{firecons:{nbr:0,cost:0,mass:0}},subduxes:{weapons:Wt,adfc:Yt.asDux}}).asDux;const Xt=[{name:"Scout",mass:[4,10],abbrev:"SC"},{name:"Courier",mass:[4,10],abbrev:"SC"},{name:"Corvette
|