S.day?Math.round(n/2):n);};
const pniG=p=>p.g1?1:PORT[p.tier].g,pniPN=p=>p.g1?'1G':PORT[p.tier].n,pniOn=p=>!(p.ready>S.day);
-const pniEta=id=>pniBig(id)?tr('pnis.delivery_about_a_month_sometimes_6'):tr('pnis.delivery_2_to_6_weeks');
-const PNI_G1_COST=1200,pniWhen=n=>n>=60?tr('pnis.their_team_quotes_m_months',{m:Math.round(n/30)}):tr('pnis.ready_in_about_n_days',{n});
+const pniEta=id=>pniNow()?tr('pnis.up_the_moment_you_order'):pniBig(id)?tr('pnis.delivery_about_a_month_sometimes_6'):tr('pnis.delivery_2_to_6_weeks');
+const PNI_G1_COST=1200,pniWhen=n=>n<=0?tr('pnis.it_is_up_already'):n>=60?tr('pnis.their_team_quotes_m_months',{m:Math.round(n/30)}):tr('pnis.ready_in_about_n_days',{n});
function pniWait(p,c){return `${(p.n||1)>1?p.n+'×':''}${pniPN(p)} PNI${tr('common.on_order')}
${tr('pnis.about_n_days_to_go_nothing',{n:Math.max(0,p.ready-S.day)})}
${btn(tr('common.chase_it'),'pniChase',{id:p.id},'ghost sm')}${btn(UI.confirm===p.id?tr('common.really_remove'):tr('pnis.cancel_the_order'),'cancelPni',{id:p.id},'ghost sm')}
`;}
function pniDay(d){for(const p of S.pni){const nm=esc(NET[p.net].name),city=esc(CITY[p.city].name);
if(p.ready===d)toast(tr('pnis.pni_with_net_is_up_in',{net:nm,city,dc:esc(siteName(p.city,'a'))}),'good');
- if(p.up&&p.up.ready<=d){p.tier=p.up.tier;p.n=p.up.n;if(p.up.site==='ab'&&p.n>=2&&S.pops[p.city]&&S.pops[p.city].site2)p.site='ab';if(p.up.g1)p.g1=true;else delete p.g1;delete p.up;toast(tr('pnis.augment_with_net_delivered_in_city',{net:nm,city,port:((p.n||1)>1?p.n+'×':'')+pniPN(p)}),'good');}}}
+ if(p.up&&p.up.ready<=d){pniUpDone(p);toast(tr('pnis.augment_with_net_delivered_in_city',{net:nm,city,port:((p.n||1)>1?p.n+'×':'')+pniPN(p)}),'good');}}}
+// An augment arrives: the new port size, LAG and 1G flag replace the old ones.
+function pniUpDone(p){p.tier=p.up.tier;p.n=p.up.n;if(p.up.site==='ab'&&p.n>=2&&S.pops[p.city]&&S.pops[p.city].site2)p.site='ab';if(p.up.g1)p.g1=true;else delete p.g1;delete p.up;}
// Microsnoft has no capacity on the US east coast. Not for a PNI, not at an exchange, not for anyone.
const US_EAST=['ash','nyc','bos','atn','mia'];
const MSF_NOPE=[N_('pnis.no_capacity_in_us_east_you'),N_('pnis.us_east_is_sold_out_until'),N_('pnis.their_peering_team_says_us_east'),N_('pnis.a_new_region_is_coming_online')];
diff --git a/src/game/70-rules/35-pni-orders.js b/src/game/70-rules/35-pni-orders.js
index 1b31325..e0c428c 100644
--- a/src/game/70-rules/35-pni-orders.js
+++ b/src/game/70-rules/35-pni-orders.js
@@ -11,7 +11,7 @@ function pniQuote(city,net,tier,reserved=0){tier=+tier;const g1=tier===-1;if(g1)
return {city,net,tier,g1,ex,cost,slots,why};}
function pniPlace(q){const {city,net,tier,g1,ex}=q,lead=pniLead(net);
if(S.conf&&S.conf.until>S.day)S.stats.beerPni=1;
- if(ex)ex.up={tier,n:ex.n||1,ready:S.day+lead,g1:false};else S.pni.push({id:uid(),city,net,tier,g1:g1||undefined,ready:S.day+lead});
+ if(ex){ex.up={tier,n:ex.n||1,ready:S.day+lead,g1:false};if(!lead)pniUpDone(ex);}else S.pni.push({id:uid(),city,net,tier,g1:g1||undefined,ready:S.day+lead});
return lead;}
function pniBatch(net,tier){tier=+tier;const all=net===null;if(!S||(!all&&!isNet(net))||!Number.isInteger(tier)||(tier===-1?all||!pniG1(net):!PORT[tier]||!portShown(tier)))return null;
const shared=[],orders=[],blocked=[],reserved={};let kept=0,cost=0,mo=0,raised=0;
diff --git a/src/game/80-simulation/70-customers-and-events.js b/src/game/80-simulation/70-customers-and-events.js
index 70301b4..3e512e1 100644
--- a/src/game/80-simulation/70-customers-and-events.js
+++ b/src/game/80-simulation/70-customers-and-events.js
@@ -4,7 +4,8 @@ function bizSfOf(r,c){const d=r.bizDem&&r.bizDem[c];return teRules()&&teRules().
function bCities(o){return o.sites?o.sites.slice():[o.city,o.city2].filter(Boolean);}
function bHas(o){return !!BIZ_T[o.type].cap||bCities(o).every(c=>S.pops[c]);}
function eventLive(b){return BIZ_T[b.type].event&&S.day>=b.start&&S.day⚠️ ${tr('customers_and_events.gaming_attracts_attacks')}`:'';}
+// No warning where nobody attacks (Best Effort, Change Freeze, puzzles, the sandbox's calm).
+function bRisk(b){return BIZ_T[b.type]?.gaming&&!ddosOff()?`⚠️ ${tr('customers_and_events.gaming_attracts_attacks')}
`:'';}
function bTerms(o){const T=BIZ_T[o.type];if(T.cap)return capTerms(o);
if(T.event){const live=S.day>=o.start;return tr('customers_and_events.bw_extra_for_d_days_when',{bw:fmtG(o.bw),d:o.dur,when:live?tr('customers_and_events.day_n_of_d',{n:S.day-o.start+1,d:o.dur}):tr('customers_and_events.starting_in_n_d',{n:o.start-S.day}),fee:fmt$(o.fee)});}
if(T.sdwan)return tr('customers_and_events.n_sites_list_bw_per_site',{n:o.sites.length,list:o.sites.map(c=>CITY[c].name).join(', '),bw:fmtG(o.bw),price:fmt$(o.bw*o.rate)});
diff --git a/src/game/90-actions/20-pops-transit-ix.js b/src/game/90-actions/20-pops-transit-ix.js
index 7dca4e9..32ff2f1 100644
--- a/src/game/90-actions/20-pops-transit-ix.js
+++ b/src/game/90-actions/20-pops-transit-ix.js
@@ -6,7 +6,7 @@ Object.assign(ACT,{
lagT:({id,d})=>{d=+d;if(d!==1&&d!==-1)return;const t=S.transit.find(x=>x.id===id);if(!t)return;const n=(t.n||1)+(+d);if(n<1||n>LAG_MAX)return;if(+d>0){if(!portOk(t.city,t.tier)||!portGate(t.city,PORT_SLOT(t.tier)))return;if(!spend(PORT[t.tier].setup))return;}t.n=n;if(n<2&&t.site==='ab')t.site='a';toast(+d>0?tr('pops_transit_ix.lag_member_added_net_in_city',{net:esc(NET[t.net].name),city:CITY[t.city].name,lag:lagName(t.tier,n)}):tr('pops_transit_ix.lag_member_removed'),'good');after();},
lagP:({id,d})=>{d=+d;if(d!==1&&d!==-1)return;const p=S.pni.find(x=>x.id===id);if(!p)return;const n=(p.n||1)+(+d);if(n<1||n>LAG_MAX)return;if(d>0&&(!pniOn(p)||p.up||msfNope(p.net,p.city)))return;if(+d>0&&(!portGate(p.city,PORT_SLOT(p.tier))||!spend(1500+PORT[p.tier].setup/2)))return;
// A LAG member is an augment: the big networks take months for that too.
- if(d>0){const lead=pniLead(p.net);p.up={tier:p.tier,n,ready:S.day+lead,g1:!!p.g1};toast(tr('pops_transit_ix.augment_ordered_with_net_eta',{net:esc(NET[p.net].name),eta:pniWhen(lead)}),'good');after();return;}p.n=n;if(n<2&&p.site==='ab')p.site='a';sfx('build');after();},
+ if(d>0){const lead=pniLead(p.net);p.up={tier:p.tier,n,ready:S.day+lead,g1:!!p.g1};if(!lead)pniUpDone(p);toast(lead?tr('pops_transit_ix.augment_ordered_with_net_eta',{net:esc(NET[p.net].name),eta:pniWhen(lead)}):tr('pops_transit_ix.augment_with_net_is_up',{net:esc(NET[p.net].name),port:p.n+'×'+pniPN(p)}),'good');after();return;}p.n=n;if(n<2&&p.site==='ab')p.site='a';sfx('build');after();},
lagIx:({city,d})=>{d=+d;if(d!==1&&d!==-1)return;if(!isIx(city)||S.ixp[city]===undefined||S.myIx[city]||!S.pops[ixCity(city)])return;S.ixn=S.ixn||{};const n=(S.ixn[city]||1)+(+d);if(n<1||n>LAG_MAX)return;if(+d>0&&(!portGate(ixCity(city),PORT_SLOT(S.ixp[city]))||!spend(ixPortMo(city,S.ixp[city]))))return;S.ixn[city]=n;if(n<2&&S.ixSite&&S.ixSite[city]==='ab')S.ixSite[city]='a';sfx('build');after();},
cancelTransit:({id,ok})=>{if(!ok&&UI.confirm!==id){UI.confirm=id;renderPanel();return;}S.transit=S.transit.filter(t=>t.id!==id);UI.confirm=null;after();},
buyIx:({city,tier,signed})=>{tier=+tier;if(!PORT[tier]||!ixName(city)||(!S.pops[ixCity(city)]&&(!remoteCities().includes(ixCity(city))||tier>1))||(S.ixp[city]!==undefined&&tier<=S.ixp[city]))return;if(S.pops[ixCity(city)]&&!portOk(ixCity(city),tier)){toast(tr('actions.your_router_can_t_take_a',{port:PORT[tier].n}),'bad');sfx('err');return;}{const h0=S.ixp[city]!==undefined;if(!S.myIx[city]&&!portGate(ixCity(city),h0?(PORT_SLOT(tier)-PORT_SLOT(S.ixp[city]))*((S.ixn||{})[city]||1):PORT_SLOT(tier)))return;}
diff --git a/src/game/90-actions/40-sites-peering-caches.js b/src/game/90-actions/40-sites-peering-caches.js
index 1f43bbe..2a98fd9 100644
--- a/src/game/90-actions/40-sites-peering-caches.js
+++ b/src/game/90-actions/40-sites-peering-caches.js
@@ -17,7 +17,7 @@ Object.assign(ACT,{
peerAll:({city})=>{if(!isIx(city)||S.ixp[city]===undefined)return;const set=ixSessions(city);let n=0;for(const id of ixMembers(city))if(!set.has(id)&&peerOk(id,'ix',city).ok){S.peers[id+'@'+city]=true;n++;}if(!n)return;toast(trn('sites_peering_caches.n_new_session_at_ix_small',n,{ix:esc(ixName(city))}),'good',[],{a:'city',v:ixCity(city)});sfx('build');after();},
tailTog:()=>{UI.tailOpen=!UI.tailOpen;renderLeft();},
pni:({city,net,tier})=>{const q=pniQuote(city,net,tier);if(!q)return;if(q.why){toast(q.why,'bad');sfx('err');after();return;}if(!spend(q.cost))return;const lead=pniPlace(q);
- toast(tr('sites_peering_caches.pni_with_net_ordered_eta_a',{net:esc(NET[net].name),eta:pniWhen(lead),dc:esc(siteName(city,'a'))}),'good');after();},
+ toast(lead?tr('sites_peering_caches.pni_with_net_ordered_eta_a',{net:esc(NET[net].name),eta:pniWhen(lead),dc:esc(siteName(city,'a'))}):tr('sites_peering_caches.pni_with_net_is_up_already',{net:esc(NET[net].name),dc:esc(siteName(city,'a'))}),'good');after();},
pniAllOpen:({net})=>{pniAllModal(net);},
pniAllSize:({v})=>{if(!UI.pniAll)return;pniAllModal(UI.pniAll.net,+v);$('modalCard').querySelector('[data-chg="pniAllSize"]')?.focus();},
pniAll:({net,tier})=>{const b=pniBatch(net,tier);if(!b||!b.orders.length)return;if(!spend(b.cost))return;
diff --git a/src/i18n/en.js b/src/i18n/en.js
index 933fd7c..4f400fc 100644
--- a/src/i18n/en.js
+++ b/src/i18n/en.js
@@ -3082,11 +3082,13 @@
"pnis.cancel_the_order":"Cancel the order",
"pnis.delivery_2_to_6_weeks":"Delivery: 2 to 6 weeks",
"pnis.delivery_about_a_month_sometimes_6":"Delivery: about a month, sometimes 6 to 12 months",
+"pnis.it_is_up_already":"It is up already",
"pnis.no_capacity_in_us_east_you":"No capacity in US East. You can join the waitlist; the waitlist is also out of capacity.",
"pnis.pni_with_net_is_up_in":"PNI with {net} is up in {city}.
A cross-connect in {dc}. Private and fast.",
"pnis.ready_in_about_n_days":"Ready in about {n} days",
"pnis.their_peering_team_says_us_east":"Their peering team says US East is “capacity constrained”, which is cloud for “no”.",
"pnis.their_team_quotes_m_months":"Their team quotes {m} months",
+"pnis.up_the_moment_you_order":"Up the moment you order it",
"pnis.us_east_is_sold_out_until":"US East is sold out until further notice. Further notice is also sold out.",
"pop_std.city_gets_the_standard_cost":"{city} gets the standard: {n} × {model} for {cost}.",
"pop_std.clear":"Clear",
@@ -3101,6 +3103,7 @@
"pops_transit_ix.after_consulting_with_management_the":"\"After consulting with management…\"
The price went up. Management was consulted.",
"pops_transit_ix.after_that_the_normal_price_returns":"After that, the normal price returns, plus a small loyalty administration fee.",
"pops_transit_ix.augment_ordered_with_net_eta":"Augment ordered with {net}.
{eta}.",
+"pops_transit_ix.augment_with_net_is_up":"Augment with {net} is up: {port}.",
"pops_transit_ix.de_kicks_group_customer_success":"DE-KICKS Group · Customer Success",
"pops_transit_ix.de_kicks_sales_is_still_aligning":"DE-KICKS sales is still \"aligning\".
They will get back to you in {n} days.",
"pops_transit_ix.de_kicks_will_circle_back_expect":"DE-KICKS will \"circle back\".
Expect an email titled \"Quick question 🙂\" within the hour.",
@@ -3554,7 +3557,7 @@
"rules.on_call":"On-call",
"rules.one_small_network_one_tricky_goal":"One small network, one tricky goal.",
"rules.puzzle":"Puzzle",
-"rules.rare_outages_no_ddos_no_conferences":"Rare outages, no DDoS, no chaos monkey, no conferences. Sea cuts mend without cable ships, builds take days, prices stay put. Patient customers, quiet notifications, and a rescue loan instead of game over.",
+"rules.rare_outages_no_ddos_pnis_at_once":"Rare outages, no DDoS, no chaos monkey, no conferences. PNIs are up the moment you order them, sea cuts mend without cable ships, builds take days, prices stay put. Patient customers, quiet notifications, and a rescue loan instead of game over.",
"rules.real_lead_times_real_outages_a_real":"Real lead times, real outages, a real market. The classic game.",
"rules.rules_are_locked_for_this_network":"{rules}: rules are locked for this network.",
"rules.the_real_thing_your_pager_has":"The real thing. Your pager has opinions.",
@@ -3693,6 +3696,7 @@
"sites_peering_caches.net_declined_why":"{net} declined.
{why}",
"sites_peering_caches.net_does_not_do_port_pnis":"{net} does not do {port} PNIs.
Nothing smaller than 100G. Come back with more traffic, or a bigger optic.",
"sites_peering_caches.net_says_not_yet_send_them":"{net} says not yet.
Send them {min}+ Gbps first.",
+"sites_peering_caches.pni_with_net_is_up_already":"PNI with {net} is up.
The cross-connect in {dc} was patched the same afternoon.",
"sites_peering_caches.pni_with_net_ordered_eta_a":"PNI with {net} ordered.
{eta}. A cross-connect in {dc}, once somebody finds the LOA.",
"sites_peering_caches.second_lag_member_added_one_member":"Second LAG member added.
One member in each building now, so a dark building only takes out half the port.",
"sites_peering_caches.second_site_live_in_city_b":"Second site live in {city}.
{b} is joined to {a} by your own metro ring. Move some uplinks there from the Transit and Peering tabs.",
diff --git a/tests/best-effort.test.js b/tests/best-effort.test.js
index 9e2824a..03698a9 100644
--- a/tests/best-effort.test.js
+++ b/tests/best-effort.test.js
@@ -12,7 +12,7 @@ test('Best Effort is a Normal preset with its own rules, kept through save and l
const { ev, errors } = load();
start(ev, 'soft');
assert.equal(ev('rulePreset()'), 'soft');
- assert.deepEqual(J(ev, "['chaos','lead','market','sea','confs','broke','moods'].map(rule)"), ['calm', 'quick', false, 'timer', false, 'rescue', 'patient']);
+ assert.deepEqual(J(ev, "['chaos','lead','market','sea','confs','broke','moods','pnis'].map(rule)"), ['calm', 'quick', false, 'timer', false, 'rescue', 'patient', 'instant']);
assert.equal(ev('ddosOff()'), true, 'no DDoS');
assert.equal(ev('mkElig()'), false, 'no chaos monkey');
ev("S.rules.confs=true;S.rules.sea='ships';const t=JSON.stringify(packSave(S));S=migrate(JSON.parse(t))");
@@ -20,7 +20,7 @@ test('Best Effort is a Normal preset with its own rules, kept through save and l
// Every other preset keeps the classic game's ships, conferences, game over and moods.
for (const p of ['freeze', 'oncall', 'bgp']) {
start(ev, p);
- assert.deepEqual(J(ev, "['sea','confs','broke','moods'].map(rule)"), ['ships', true, 'lose', 'normal'], p);
+ assert.deepEqual(J(ev, "['sea','confs','broke','moods','pnis'].map(rule)"), ['ships', true, 'lose', 'normal', 'wait'], p);
}
assert.deepEqual(errors, []);
});
@@ -128,3 +128,33 @@ test('the title screen offers Best Effort first, and it earns Freeze-dried badge
assert.equal(ev('badgeVar()'), 'freeze');
assert.deepEqual(errors, []);
});
+
+test('Best Effort: PNIs and their augments are up the moment they are ordered', () => {
+ const { ev, errors } = load();
+ ev("beginGame('Soft Serve','fra',{mode:'normal',preset:'soft'});if(UI.pendGame)ACT.pitchSkip();closeModal();S.cash=1e9;S.lvl=6;for(const g of GOALS)S.done[g.id]=0;S.nextFail=S.nextEvent=1e9;ACT.launchBB({city:'fra'});for(const c in S.pops)S.pops[c].rgen=3;compute()");
+ assert.equal(ev("pniEta('nfx')"), 'Up the moment you order it');
+ ev("document.getElementById('toasts').innerHTML='';R.demTo.nfx=1e4;ACT.pni({city:'fra',net:'nfx',tier:1})");
+ assert.equal(ev('pniOn(S.pni[0])'), true, 'a PNI with a big network, up at once');
+ assert.match(ev("document.getElementById('toasts').textContent"), /PNI with NetChill is up/);
+ ev('compute()');
+ assert.ok(ev('R.usePni[S.pni[0].id]') > 0, 'and carrying traffic');
+ ev("R.demTo.nfx=1e4;ACT.pni({city:'fra',net:'nfx',tier:2})");
+ assert.deepEqual(J(ev, '[S.pni[0].tier,S.pni[0].up===undefined]'), [2, true], 'an upgrade, at once');
+ ev('ACT.lagP({id:S.pni[0].id,d:1})');
+ assert.deepEqual(J(ev, '[S.pni[0].n,S.pni[0].up===undefined]'), [2, true], 'a LAG member, at once');
+ // Change Freeze still waits, if only days.
+ start(ev, 'freeze');
+ ev("S.cash=1e9;S.lvl=6;ACT.launchBB({city:'mrs'});for(const c in S.pops)S.pops[c].rgen=3;compute();R.demTo.nfx=1e4;ACT.pni({city:'mrs',net:'nfx',tier:1})");
+ assert.ok(ev('S.pni[0].ready') > ev('S.day'));
+ assert.deepEqual(errors, []);
+});
+
+test('no "attracts attacks" warning where nobody attacks', () => {
+ const { ev, errors } = load();
+ const risk = () => ev("bRisk({type:Object.keys(BIZ_T).find(k=>BIZ_T[k].gaming)})");
+ start(ev, 'soft');
+ assert.equal(risk(), '');
+ start(ev, 'oncall');
+ assert.match(risk(), /Gaming attracts attacks/);
+ assert.deepEqual(errors, []);
+});
diff --git a/tests/gameplay-rules.test.js b/tests/gameplay-rules.test.js
index 33e0823..d6ed446 100644
--- a/tests/gameplay-rules.test.js
+++ b/tests/gameplay-rules.test.js
@@ -218,8 +218,8 @@ test('M2: presets are ordered: Best Effort never harsher than Change Freeze, Cha
assert.ok(lead[P.soft.lead] <= lead[P.freeze.lead] && lead[P.freeze.lead] <= lead[P.oncall.lead] && lead[P.oncall.lead] <= lead[P.bgp.lead], 'M2: lead times');
assert.ok((!P.soft.market || P.freeze.market) && (!P.freeze.market || P.oncall.market), 'M2: market');
// The softenings only Best Effort has: every other Normal preset keeps the classic game's.
- for (const k of ['sea', 'confs', 'broke', 'moods']) for (const p of ['freeze', 'oncall', 'bgp']) assert.equal(v(p, k), D[k], `M2: ${p} keeps ${k}`);
- assert.deepEqual(['sea', 'confs', 'broke', 'moods'].map((k) => v('soft', k)), ['timer', false, 'rescue', 'patient'], 'M2: Best Effort softens them all');
+ for (const k of ['sea', 'confs', 'broke', 'moods', 'pnis']) for (const p of ['freeze', 'oncall', 'bgp']) assert.equal(v(p, k), D[k], `M2: ${p} keeps ${k}`);
+ assert.deepEqual(['sea', 'confs', 'broke', 'moods', 'pnis'].map((k) => v('soft', k)), ['timer', false, 'rescue', 'patient', 'instant'], 'M2: Best Effort softens them all');
assert.ok(P.bgp.market && P.bgp.money === 'normal' && P.bgp.gates === 'ladder', 'M2: BGP keeps every hardship');
// seeded: the same network for a year under each preset
const n = {};
@@ -237,7 +237,7 @@ test('M3: every subsystem that can annoy the player reads a rule', () => {
const reads = [['dayPost', 'chaosMul()'], ['fireEvent', "rule('market')"], ['ddosTick', 'ddosOff()'],
['soldOut', "rule('market')"], ['hwMul', "rule('market')"], ['leadDays', "rule('lead')"], ['pniLead', 'leadDays'],
['dfBuildDays', 'leadDays'], ['dayPre', "rule('clock')"], ['snub', "rule('market')"], ['fireFailure', 'shipsOn()'],
- ['upcomingConfs', 'confsOn()'], ['dayPost', "rule('broke')"], ['dayPost', "rule('moods')"], ['toast', 'quietOn()']];
+ ['upcomingConfs', 'confsOn()'], ['pniLead', 'pniNow()'], ['dayPost', "rule('broke')"], ['dayPost', "rule('moods')"], ['toast', 'quietOn()']];
fail('M3', reads.filter(([f, r]) => !ev(`typeof ${f}==='function'&&${f}.toString().includes(${JSON.stringify(r)})`)).map(([f, r]) => `${f}() does not read ${r}`), 'gate it on the ruleset (src/game/40-progress/30-rules.js)');
// and in play: no chaos and no market means a quiet year
const g = load();