diff --git a/CHANGELOG.md b/CHANGELOG.md index 03fea07..3094620 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] +- Premium submarine terminals and Optical engineering can no longer be bought on a cable where they would change nothing (#198). The button now says so, and an upgrade that only helps together with the other one stays available. - A wave size that is sold out on a route can no longer be reached by upgrading a smaller wave on it (#201). The upgrade button says how long it is sold out, just like when buying. - Choosing Both for a PNI with one member now really splits it: the second member arrives in the other building when the augment lands, instead of joining the first (#219). diff --git a/site/i18n/de.js b/site/i18n/de.js index 102b491..64a42ff 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -3204,6 +3204,7 @@ "puzzles_weekly.ocean_crossing":"Ozeanüberquerung", "puzzles_weekly.region_tour":"Rundreise", "puzzles_weekly.ring":"Ring", +"reach_and_subsea.makes_no_difference_on_this_cable":"Bringt auf diesem Kabel nichts", "reach_and_subsea.premium_submarine_terminals":"Premium-Seekabel-Terminals", "release_notes.and_n_more_change":{"one":"… und {n} weitere Änderung","other":"… und {n} weitere Änderungen"}, "release_notes.read_the_full_notes_on_github":"Alle Hinweise auf GitHub lesen", diff --git a/site/i18n/es.js b/site/i18n/es.js index a7a695c..13aeff7 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -3202,6 +3202,7 @@ "puzzles_weekly.ocean_crossing":"Cruzar el océano", "puzzles_weekly.region_tour":"Gira regional", "puzzles_weekly.ring":"Anillo", +"reach_and_subsea.makes_no_difference_on_this_cable":"No cambia nada en este cable", "reach_and_subsea.premium_submarine_terminals":"Terminales submarinas premium", "release_notes.and_n_more_change":{"one":"…y {n} cambio más","other":"…y {n} cambios más"}, "release_notes.read_the_full_notes_on_github":"Lee las notas completas en GitHub", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index 5f2e28a..93e7fa7 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -3202,6 +3202,7 @@ "puzzles_weekly.ocean_crossing":"Traversée de l’océan", "puzzles_weekly.region_tour":"Tour de la région", "puzzles_weekly.ring":"Anneau", +"reach_and_subsea.makes_no_difference_on_this_cable":"Ne change rien sur ce câble", "reach_and_subsea.premium_submarine_terminals":"Terminaux sous-marins premium", "release_notes.and_n_more_change":{"one":"…et {n} autre changement","other":"…et {n} autres changements"}, "release_notes.read_the_full_notes_on_github":"Lire les notes complètes sur GitHub", diff --git a/site/i18n/it.js b/site/i18n/it.js index cc4b4fe..512cb33 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -3202,6 +3202,7 @@ "puzzles_weekly.ocean_crossing":"Traversata oceanica", "puzzles_weekly.region_tour":"Giro della regione", "puzzles_weekly.ring":"Anello", +"reach_and_subsea.makes_no_difference_on_this_cable":"Su questo cavo non cambia nulla", "reach_and_subsea.premium_submarine_terminals":"Terminali sottomarini avanzati", "release_notes.and_n_more_change":{"one":"…e {n} altra modifica","other":"…e altre {n} modifiche"}, "release_notes.read_the_full_notes_on_github":"Leggi le note complete su GitHub", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index bc3cd3a..ec25f9d 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -3202,6 +3202,7 @@ "puzzles_weekly.ocean_crossing":"Travessia do oceano", "puzzles_weekly.region_tour":"Volta pela região", "puzzles_weekly.ring":"Anel", +"reach_and_subsea.makes_no_difference_on_this_cable":"Não faz diferença neste cabo", "reach_and_subsea.premium_submarine_terminals":"Terminais submarinos premium", "release_notes.and_n_more_change":{"one":"…e mais {n} mudança","other":"…e mais {n} mudanças"}, "release_notes.read_the_full_notes_on_github":"Leia as notas completas no GitHub", diff --git a/src/game/10-catalog/60-reach-and-subsea.js b/src/game/10-catalog/60-reach-and-subsea.js index 9ff08a3..3e46b70 100644 --- a/src/game/10-catalog/60-reach-and-subsea.js +++ b/src/game/10-catalog/60-reach-and-subsea.js @@ -53,6 +53,10 @@ const subMaxTier=km=>{let t=0;LT.forEach((T,i)=>{if(!subWaveWhy(i,km,true))t=i;} // What an optic carries depends only on the optic, the span length and subsea or not; the map and compute() ask a lot. // Cached per optic, span and cable state: subsea, and which submarine upgrades are in service (#78). const OPTG={};const optG=(o,l)=>{const km=spanKm(l),fl=l.sub?1+(subUpgradeReady(l,'terminal')?2:0)+(subUpgradeReady(l,'engineering')?4:0):0,c=OPTG[o]||(OPTG[o]=[]),m=c[fl]||(c[fl]=new Map());let g=m.get(km);if(g===undefined){const x=optMode(o,l);m.set(km,g=x?x.g:0);}return g;}; +// Whether upgrade k changes what any optic carries on a subsea cable this long (#198). has: the other upgrade is +// already in; otherwise k also counts when it only helps together with the other one. +const subOther=k=>k==='terminal'?'engineering':'terminal',subHelps=(km,k,has)=>{const j=subOther(k),c=(on,o)=>({kind:'df',own:true,sub:true,km,['sub'+k]:on?0:undefined,['sub'+j]:o?0:undefined}); + return (has?[1]:[0,1]).some(o=>Object.keys(OPT).some(x=>optG(x,c(1,o))!==optG(x,c(0,o))));}; const regenNeed=(o,l)=>Math.max(0,Math.ceil(l.km/OPT[o].reach)-1); // The map asks for every fiber's capacity several times per frame (width, colour, label, up or down), each time over // all its channels. Nothing changes while a frame is drawn, so draw() keeps the answers in DFC for that frame. diff --git a/src/game/90-actions/87-fiber-and-hardware.js b/src/game/90-actions/87-fiber-and-hardware.js index 46e3bad..6572a60 100644 --- a/src/game/90-actions/87-fiber-and-hardware.js +++ b/src/game/90-actions/87-fiber-and-hardware.js @@ -1,12 +1,13 @@ Object.assign(ACT,{ dfMode:({m})=>{UI.lmode=m;if(UI.pending)openLinkModal(UI.pending.a,UI.pending.b);}, - seaPackage:({k})=>{if(!own(SUB_UPGRADES,k))return;UI['sea'+k]=!UI['sea'+k];if(UI.pending)openLinkModal(UI.pending.a,UI.pending.b);}, - subUpgrade:({id,k})=>{const l=S.links.find(l=>l.id===id);if(!l||l.kind!=='df'||!l.own||!l.sub||l.seat||!own(SUB_UPGRADES,k)||lvl()<4||l['sub'+k]!==undefined)return;if(!spend(subUpgradeCost(l,k)))return;l.paid=(l.paid>0?l.paid:ownCabCost(l.km))+subUpgradeCost(l,k);l['sub'+k]=Math.max(S.day,l.ready||0)+leadDays(SUB_UPGRADES[k].days);after();}, + seaPackage:({k})=>{const p=UI.pending;if(!own(SUB_UPGRADES,k)||!p)return;const km=seaQuote(p.a,p.b,own(SEA_DESIGNS,UI.seaDesign)?UI.seaDesign:'standard').km,up=seaUps(km); + if(!up[k]&&!subHelps(km,k,up[subOther(k)]))return;UI.seaterminal=up.terminal;UI.seaengineering=up.engineering;UI['sea'+k]=!up[k];openLinkModal(p.a,p.b);}, + subUpgrade:({id,k})=>{const l=S.links.find(l=>l.id===id);if(!l||l.kind!=='df'||!l.own||!l.sub||l.seat||!own(SUB_UPGRADES,k)||lvl()<4||l['sub'+k]!==undefined||!subHelps(l.km,k,l['sub'+subOther(k)]!==undefined))return;if(!spend(subUpgradeCost(l,k)))return;l.paid=(l.paid>0?l.paid:ownCabCost(l.km))+subUpgradeCost(l,k);l['sub'+k]=Math.max(S.day,l.ready||0)+leadDays(SUB_UPGRADES[k].days);after();}, seaDesign:({v})=>{if(!own(SEA_DESIGNS,v))return;UI.seaDesign=v;if(UI.pending)openLinkModal(UI.pending.a,UI.pending.b);}, ownCab:()=>{UI.lmode='df';UI.dfSrc='cable';UI.seaDesign='standard';UI.seaterminal=UI.seaengineering=false;if(UI.pending)openLinkModal(UI.pending.a,UI.pending.b);}, dfSrc:({v})=>{UI.dfSrc=v;if(UI.pending)openLinkModal(UI.pending.a,UI.pending.b);}, dfSys:({v})=>{UI.dfSys=v;if(UI.pending)openLinkModal(UI.pending.a,UI.pending.b);}, - orderCable:()=>{const p=UI.pending;if(!p)return;const {a,b}=p;if(ownCabWhy(a,b))return;const design=own(SEA_DESIGNS,UI.seaDesign)?UI.seaDesign:'standard',up={terminal:!!UI.seaterminal,engineering:!!UI.seaengineering},q=seaQuote(a,b,design,up),km=q.km,cost=q.cost+(S.pops[b]?0:popCost(b));if(seaLack(km,up).length||!spend(cost))return; + orderCable:()=>{const p=UI.pending;if(!p)return;const {a,b}=p;if(ownCabWhy(a,b))return;const design=own(SEA_DESIGNS,UI.seaDesign)?UI.seaDesign:'standard',up=seaUps(seaQuote(a,b,design).km),q=seaQuote(a,b,design,up),km=q.km,cost=q.cost+(S.pops[b]?0:popCost(b));if(seaLack(km,up).length||!spend(cost))return; if(!S.pops[b])S.pops[b]={day:S.day,bb:null,boost:0,down:0,routers:1,gen:false,rgen:0}; const used=new Set(S.links.map(l=>l.cname).filter(Boolean)),cname=OWNCAB_NAMES.find(n=>!used.has(n))||`${pick(OWNCAB_NAMES)} ${used.size+1}`,ship=pick(OWNCAB_SHIPS),id=uid(),days=q.days; S.links.push({id,a,b,kind:'df',own:true,sub:true,seaDesign:design,seaPath:q.pts.map(p=>p.slice()),sys:'roadm',ch:[],km,cable:null,cname,mo:Math.round(km*OWNCAB_OM),trench:'own:'+id,cut:0,day:S.day,ready:S.day+days,spares:false,pairs:1}); diff --git a/src/game/93-ui/70-link-panels.js b/src/game/93-ui/70-link-panels.js index 2d85e75..f454168 100644 --- a/src/game/93-ui/70-link-panels.js +++ b/src/game/93-ui/70-link-panels.js @@ -92,9 +92,9 @@ function chinaSection(c){const st=S.cnLic?S.cnLic.state:'none',loss=S.ev.gfw>S.d if(R.gfwCross>0.5)h+=`
${tr('common.better_terminals_and_optical_tuning')}
`+Object.entries(SUB_UPGRADES).map(([k,U])=>{ - const at=l['sub'+k],done=subUpgradeReady(l,k),cost=subUpgradeCost(l,k),preview={...l,['sub'+k]:S.day}; + const at=l['sub'+k],done=subUpgradeReady(l,k),cost=subUpgradeCost(l,k),preview={...l,['sub'+k]:S.day},use=at!==undefined||subHelps(l.km,k,l['sub'+subOther(k)]!==undefined); const status=done?tr('common.installed'):at!==undefined?tr('link_panels.ready_in_n_days',{n:Math.max(0,at-S.day)}):tr('link_panels.price_n_days',{price:fmt$(cost),n:leadDays(U.days)}); - return `${esc(why)}
`:''}`;} function ownCabBody(a,b,pop){const why=ownCabWhy(a,b);if(why)return `${esc(why)}
${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; + const design=own(SEA_DESIGNS,UI.seaDesign)?UI.seaDesign:'standard',upgrades=seaUps(seaQuote(a,b,design).km),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 `${tr('own_cable.your_very_own_subsea_cable_a')}
${lack[0]==='design'?tr('own_cable.this_design_s_route_is_km',{km:km.toLocaleString()}):tr('own_cable.km_km_is_too_far_for',{km:km.toLocaleString(),what:lack.length>1?tr('own_cable.a_and_b',{a:tr(SUB_UPGRADES[lack[0]].n),b:tr(SUB_UPGRADES[lack[1]].n)}):tr(SUB_UPGRADES[lack[0]].n)})}
`:`${tr('common.up_to_g_per_channel',{g:fmtG(submarineRate({a,b,km,kind:'df',own:true,sub:true,subterminal:upgrades.terminal?S.day:undefined,subengineering:upgrades.engineering?S.day:undefined}))})} · ${tr('common.better_terminals_and_optical_tuning')}
`}