Architect runs: later briefs stay a surprise

No numbered tags beside cities, no "coming up" plan on a city card and no hint
to build there early: you design for today's brief and find out what comes next.
This commit is contained in:
Frederic Jung 2026-10-30 11:18:54 +01:00
parent c8113d9043
commit 170914b05e
No known key found for this signature in database
12 changed files with 9 additions and 41 deletions

View file

@ -95,11 +95,6 @@ function arShape(){const ns=Object.keys(S.pops),n=ns.length;if(n<2||!S.links.len
k=cs.length<n&&cs.every(c=>core[c].size===2)?'lolli':cs.length===n&&n>=6&&n%2===0&&cm===3*n/2-2&&d2===4&&cs.every(c=>core[c].size<=3)?'ladder':m>=n*1.8?'spaghetti':'mesh';}
return {k,i:AR_SHAPES[k][0],n:tr(AR_SHAPES[k][1])};}
// What later briefs do to a city, for the map: [{n: brief number, i: icon}], earliest first.
function arTags(c){const A=S.ar,out=[];arRun().briefs.forEach((b,j)=>{if(j<=A.bi)return;const i=(b.gold||[]).includes(c)?'🚨':(b.add||[]).includes(c)?'📍':(b.drop||[]).includes(c)?'🚫':b.dem&&b.dem[c]?'📈':(b.ring||[]).includes(c)?'💍':b.lat&&b.lat.slice(0,2).includes(c)?'⏱':'';if(i)out.push({n:j+1,i});});return out;}
// One line per brief for the plan on the card.
function arSum(b){const nm=c=>CITY[c].name,t=[],d=b.dem||{};if(b.add)t.push(b.add.map(c=>'+'+nm(c)+(d[c]?' '+arG(d[c]):'')).join(' '));for(const c in d)if(!(b.add||[]).includes(c))t.push('📈 '+nm(c)+' '+arG(d[c]));if(b.gold)t.push('🚨 '+b.gold.map(nm).join(', '));
if(b.ring)t.push('💍 '+b.ring.map(nm).join('–'));if(b.lat)t.push(`⏱ ${nm(b.lat[0])}⇄${nm(b.lat[1])} < ${b.lat[2]} ms`);if(b.drop)t.push('🚫 '+b.drop.map(nm).join(', '));
if(b.tubes!=null)t.push(trn('architect.n_tubes',b.tubes));return t.join(' · ');}
// ---------- starting, briefs and the end ----------
const arDem=c=>S.ar.dem[c]||10;
// Short Gbps for chips and tags: 40G, 1.2T.
@ -129,7 +124,7 @@ function arApply(i){const A=S.ar,P=S.pz,b=arRun().briefs[i];A.bi=i;
P.via=[...new Set(arRun().briefs.slice(i+1).flatMap(x=>[...(x.add||[]),...(x.gold||[]),...(x.ring||[])]))].filter(c=>!P.cities.includes(c)&&!P.avoid.includes(c));
arDemand();A.start=arSnapStr();UI.pzHist=[];UI.sel=null;UI.arFail=null;
compute();pzCam();renderAll();
toast(`<b>${tr('architect.brief_n_of_m',{n:i+1,m:arRun().briefs.length})}</b><br>${esc(b.t)}${i===0&&arRun().briefs.length>1?'<br><small>'+tr('architect.numbers_on_the_map_show')+'</small>':''}`,'goal');sfx('click');}
toast(`<b>${tr('architect.brief_n_of_m',{n:i+1,m:arRun().briefs.length})}</b><br>${esc(b.t)}`,'goal');sfx('click');}
function arNext(){if(!arOn())return;const e=arEval();if(!e.passed)return;if(arLast()){arResults(true);return;}S.ar.over+=e.tubes.over;arApply(S.ar.bi+1);}
function arReset(){const o=JSON.parse(S.ar.start);S.pops=o.p;S.links=o.l;S.pairMet=o.m||{};S.ar.sunk=o.k||0;arDemand();UI.sel=null;}
// Tubes over plan in the run so far, this brief included.

View file

@ -23,10 +23,9 @@ function arRender(el){const A=S.ar,run=arRun(),b=arBrief(),e=arEval(),sh=UI.arSh
function arPanel(sel){const A=S.ar,head=(eb,name,facts)=>`<div class="ph"><div style="min-width:0"><div class="eyebrow">${eb}</div><h2>${name}</h2>${facts?`<div class="facts">${facts}</div>`:''}</div><button class="x" data-act="closePanel" aria-label="${tr('common.close')}">×</button></div>`;
const old=x=>(x.br|0)<A.bi?`<p class="note">${tr('architect.built_in_an_earlier_brief')}</p>`:'';
if(sel.type==='city'){const c=sel.id,k=pzKind(c),p=S.pops[c];if(!k)return '';
const tg=arTags(c),eb=c===A.hq?'🏠 '+tr('architect.hq'):A.gold.includes(c)?'🚨 '+tr('architect.gold_site'):k==='goal'?'🎯 '+tr('architect.site'):k==='via'&&tg.length?'🔜 '+tr('architect.joins_in_brief_n',{n:tg[0].n}):k==='via'?'🪨 '+tr('puzzles.stepping_stone_optional'):k==='avoid'?'🚫 '+tr('architect.closed'):'📍 '+tr('puzzles.not_in_the_plan');
const eb=c===A.hq?'🏠 '+tr('architect.hq'):A.gold.includes(c)?'🚨 '+tr('architect.gold_site'):k==='goal'?'🎯 '+tr('architect.site'):k==='via'?'🪨 '+tr('puzzles.stepping_stone_optional'):k==='avoid'?'🚫 '+tr('architect.closed'):'📍 '+tr('puzzles.not_in_the_plan');
let h=head(eb,esc(CITY[c].name),p?`<span class="fact mine">${tr('common.your_pop')}</span><span class="fact">${tr('puzzles.price_per_year',{price:fmt$(arPopCost(c))})}</span>`:'')+'<div class="scroll">';
if(c===A.hq)h+=`<p class="lead">${tr('architect.hq_lead')}</p>`;else if(A.gold.includes(c))h+=`<p class="lead">${tr('architect.gold_lead')}</p>`;
if(tg.length)h+=`<div class="arplan"><div class="eyebrow">${tr('architect.coming_up')}</div>${tg.map(t=>`<div><b>${t.n}</b> ${esc(arSum(arRun().briefs[t.n-1]))}</div>`).join('')}</div>`;
if(k==='avoid'&&!p)return h+`<p class="lead">${tr('puzzles.not_this_one_find_a_way_around')}</p></div>`;
if(!p){const pc=pzPopCost(c)+pzRtCost(0,1);return h+`<div class="btns">${btn(tr('puzzles.open_a_pop_cost',{cost:fmt$(pc)}),'pzPop',{city:c},'pink big')}</div><p class="note">${tr('architect.or_drag_a_tube_here')}</p></div>`;}
if(k==='avoid')h+=`<p class="lead">${tr('architect.closed_lead')}</p>`;

View file

@ -85,7 +85,7 @@ function drawFrame(now){
// Which cities show an offer bubble (a big one?) or an incident marker, worked out once for all of them.
CM.off=new Set();CM.big=new Set();for(const o of S.offers){const big=BIZ_T[o.type].lv>=3||BIZ_T[o.type].event;for(const c of bCities(o)){CM.off.add(c);if(big)CM.big.add(c);}}
CM.inc=new Set(S.inc.filter(i=>i.type!=='leak').map(i=>i.ref));CM.far=farL;
if(pzOn()){for(const v of vis.slice().reverse())pzDrawCity(v,sc,now);if(S.ar)for(const v of vis)arDrawTags(v,sc);}else for(const v of vis.slice().reverse())drawCity(v.C,v.sx,v.sy,sc,now,v.ly);
if(pzOn()){for(const v of vis.slice().reverse())pzDrawCity(v,sc,now);}else for(const v of vis.slice().reverse())drawCity(v.C,v.sx,v.sy,sc,now,v.ly);
if(UI.mk)mkDraw(ks);
// floaters
for(let i=FLOATS.length-1;i>=0;i--){const f=FLOATS[i],a=(now-f.t)/1600;if(a>1){FLOATS.splice(i,1);continue;}

View file

@ -14,7 +14,3 @@ function pzDrawCity(v,sc,now){const k=pzKind(v.C.id);
// In a puzzle every line says what it is ("2×100G · 70%"), and a selected POP lights up every pair it has links on.
function pzLinkLab(grp,up,load,cap){if(S.ar)return groupLabel(grp,up)+(cap?` · ${Math.round(load/cap*100)}%`:'');return groupLabel(grp,up)+(cap?` · ${Math.round(load/cap*100)}%`:'');}
const pzLinkHot=grp=>!!(UI.sel&&UI.sel.type==='city'&&grp.some(x=>x.a===UI.sel.id||x.b===UI.sel.id));
// Architect runs: what later briefs do here, as small numbered tags beside the city ("4🥇", "6🚫").
function arDrawTags(v,sc){const tg=arTags(v.C.id).slice(0,2);if(!tg.length||!pzKind(v.C.id))return;const r=(CM.far?16:34)*sc,y=v.sy-(CM.far?0:6*sc);const t=tg.map(x=>x.n+x.i).join(' ');
ctx.save();ctx.font=`900 ${Math.round((CM.far?10:12)*Math.max(0.9,Math.min(1.3,sc)))}px "Baloo 2", sans-serif`;const w=ctx.measureText(t).width+12,h=18,x=v.sx-r-w*0.35,yy=y-r-4;
ctx.fillStyle='#fff';ctx.strokeStyle='#1E2640';ctx.lineWidth=2;rr(x,yy,w,h,9);ctx.fill();ctx.stroke();ctx.fillStyle='#1E2640';ctx.textAlign='center';ctx.textBaseline='middle';ctx.fillText(t,x+w/2,yy+h/2+1);ctx.restore();}