One game, four doors: a per-save ruleset with Change Freeze, On-call and BGP at 3 a.m., a real Sandbox, and a new start screen
This commit is contained in:
parent
c011022203
commit
531f90f107
40 changed files with 560 additions and 67 deletions
|
|
@ -10,7 +10,7 @@ const nearLanding=c=>CITIES.filter(x=>x.id!==c&&landing(x.id)).sort((x,y)=>kmBet
|
|||
const ownCabKm=(a,b)=>seaRoutes(a,b)[0]?.km||Infinity;
|
||||
const ownCabCost=km=>Math.round((2*OWNCAB_LAND+km*OWNCAB_KM+DF_SYS.roadm.cost)*hwMul('build'));
|
||||
const ownCabMo=km=>Math.round(km*OWNCAB_OM)+ampCount(km)*AMP_MO;
|
||||
const ownCabDays=km=>Math.round(300+km*0.05);
|
||||
const ownCabDays=km=>leadDays(Math.round(300+km*0.05));
|
||||
// Marine routing uses the same coastline as the map, in geographic coordinates.
|
||||
// A quarter-degree grid keeps narrow passages open; edges are checked against
|
||||
// coastline segments as well as water cells, so diagonal steps cannot cut land.
|
||||
|
|
@ -179,7 +179,7 @@ function seaQuote(a,b,design='standard',upgrades={}){
|
|||
const base=routes[0]?.km||Infinity,km=route?.km||Infinity;
|
||||
// Higher survey and permitting costs dominate any savings from shorter glass.
|
||||
let cost=Math.round(ownCabCost(Math.max(base,km))*D.cost),days=Math.round(ownCabDays(Math.max(base,km))*D.time);
|
||||
for(const k of Object.keys(SUB_UPGRADES))if(upgrades[k]){cost+=subUpgradeCost({km},k);days+=SUB_UPGRADES[k].days;}
|
||||
for(const k of Object.keys(SUB_UPGRADES))if(upgrades[k]){cost+=subUpgradeCost({km},k);days+=leadDays(SUB_UPGRADES[k].days);}
|
||||
const ms=linkLat({a,b,kind:'df',own:true,sub:true,km,seaDesign:design});
|
||||
return {km,cost,days,ms,pts:route?.pts,shore:route?.shore,cor:!!cor&&route===cor};
|
||||
}
|
||||
|
|
@ -190,15 +190,17 @@ const seaCab=(a,b)=>isSub(a,b)||(landing(a)&&landing(b)&&cablesFor(a,b).length>0
|
|||
// one still being laid returns most of the part not laid yet, a working one is yours for good.
|
||||
const cabBack=l=>{if(!l||l.kind!=='df'||!l.own||!l.sub)return 0;const c=l.paid>0?l.paid:ownCabCost(l.km);if(!subNeed(l.km))return c;
|
||||
if(l.ready>S.day){const tot=Math.max(1,l.ready-(l.day||0));return Math.round(c*0.75*Math.min(1,(l.ready-S.day)/tot));}return 0;};
|
||||
// Your own subsea cable is a Tier 1 privilege, or a sandbox toy (open gates).
|
||||
const cabOpen=()=>!!S.won||gatesOpen();
|
||||
function ownCabWhy(a,b){if(!seaCab(a,b))return tr('own_cable.this_route_is_on_land_build');
|
||||
if(!S.won)return tr('own_cable.laying_your_own_subsea_cable_is');
|
||||
if(!cabOpen())return tr('own_cable.laying_your_own_subsea_cable_is');
|
||||
for(const c of [a,b])if(!landing(c))return tr('own_cable.city_has_no_cable_landing_station',{city:CITY[c].name});
|
||||
if(cnCity(a)||cnCity(b))return tr('own_cable.nobody_gives_a_foreign_network_a');
|
||||
if(!seaReady(a,b))return tr('own_cable.surveying_a_sea_route');
|
||||
const routes=seaRoutes(a,b);if(!routes.length)return tr('own_cable.no_navigable_sea_route_connects');
|
||||
const km=Math.min(...routes.map(r=>r.km));if(!subNeed(km))return tr('own_cable.km_km_is_more_than_any',{km:km.toLocaleString(),max:Math.round(SUB_MAXKM()).toLocaleString()});
|
||||
return '';}
|
||||
function ownCabTeaser(a,b){const why=ownCabWhy(a,b);return `<div class="btns" style="margin-top:8px">${btn(S.won?tr('modals.lay_your_own_subsea_cable'):tr('modals.your_own_subsea_cable_tier_1'),'ownCab',{},S.won&&!why?'pink':'ghost',!!why)}</div>${why&&S.won?`<p class="note" ${seaSurveyAttr(a,b)}>${esc(why)}</p>`:''}`;}
|
||||
function ownCabTeaser(a,b){const why=ownCabWhy(a,b);return `<div class="btns" style="margin-top:8px">${btn(cabOpen()?tr('modals.lay_your_own_subsea_cable'):tr('modals.your_own_subsea_cable_tier_1'),'ownCab',{},cabOpen()&&!why?'pink':'ghost',!!why)}</div>${why&&cabOpen()?`<p class="note" ${seaSurveyAttr(a,b)}>${esc(why)}</p>`:''}`;}
|
||||
function ownCabBody(a,b,pop){const why=ownCabWhy(a,b);if(why)return `<p class="lead" style="margin-top:10px" ${seaSurveyAttr(a,b)}>${esc(why)}</p>${btn(tr('common.back'),'dfSrc',{v:'lease'},'ghost sm')}`;
|
||||
const design=own(SEA_DESIGNS,UI.seaDesign)?UI.seaDesign:'standard',upgrades={terminal:!!UI.seaterminal,engineering:!!UI.seaengineering},q=seaQuote(a,b,design,upgrades),{km,cost,days}=q,lack=seaLack(km,upgrades),mo=ownCabMo(km),wt=subMaxTier(km),w=Math.round(waveMo(km,true,wt)*waveMarket(a,b,true).m),save=10*w*LT[4].g/LT[wt].g-mo,pay=save>0?Math.ceil(cost/save):0;
|
||||
return `<p class="lead" style="margin-top:8px">${tr('own_cable.your_very_own_subsea_cable_a')}</p>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue