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{Updux as wt}from"updux";import xt from"@yanick/updeep";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",O()),Tt=N("set_ftl_reqs",O()),Nt=new wt({initial:{mass:0,cost:0,type:"none"}});Nt.addMutation(Mt,(t=>xt.update({type:t}))),Nt.addMutation(Tt,(t=>xt.update(t)));var Ot=Nt.asDux;const Vt=N("set_engine",O()),At=N("set_drive_reqs",O()),St=new wt({initial:{mass:1,cost:2,rating:1}});St.addMutation(Vt,(t=>xt.update(t))),St.addMutation(At,(t=>xt.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",O()),Ut=N("remove_weapon",O()),jt=(zt=t=>xt(Ct(t)),t=>zt(t)(t));var zt;const Bt=new wt({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",O());Bt.addMutation(Gt,(t=>xt.map(xt.if(_.matches({id:t.id}),(e=>jt(xt(t,e)))))));var Rt=Bt.asDux;const Wt=new wt({initial:{rating:0,cost:0,mass:0}});Wt.addMutation(N("set_adfc",O()),(t=>xt.update({rating:t,mass:2*t,cost:8*t})));var Yt=new wt({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",ma
|