The no-cable hint in the link window names the satellite (#83)
Upstream 3.3's hint for a coast where no subsea cable lands (#321) said only a cable of your own could get to Iqaluit or Adamstown, and left satellites out at Pevek, though a teleport reaches all three. Once teleports are on sale (level 2) and a bird you may rent from sees the city, the 'own' case says a satellite circuit or a cable of your own can get there (a new string), and every case adds the satellite line: the city panel's 'Your teleports can reach' with a button per teleport to its order sheet (satOpen), or where to build one. Not in puzzles, and not before level 2, like the rest of the satellites.
This commit is contained in:
parent
7930d332f1
commit
2dc8274f34
10 changed files with 68 additions and 3 deletions
|
|
@ -37,3 +37,55 @@ test('#321 a coast with no cable but a road in: reach it overland, never "hop th
|
|||
assert.doesNotMatch(t, /reach \./);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
// #83 in the fork: a teleport reaches small islands and remote towns, so "only a cable of your own can get there" was
|
||||
// wrong for Iqaluit and Adamstown (and Pevek's hint left satellites out). Once teleports are on sale (level 2) the hint
|
||||
// names the satellite too, with a button to the order sheet from each teleport of yours that reaches the city.
|
||||
test('#83 no cable lands there, but a satellite does: the hint says so, with the way to order it', () => {
|
||||
const { ev, dom, errors } = load();
|
||||
const doc = dom.window.document;
|
||||
ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip();closeModal();S.cash=1e9;S.lvl=1;for(const g of GOALS)S.done[g.id]=0;S.nextFail=S.nextEvent=1e9;UI.speed=0");
|
||||
const own = (c) => ev(`tr('link_modal.no_subsea_cable_lands_in_city_own',{city:CITY.${c}.name})`);
|
||||
const ownSat = (c) => ev(`tr('link_modal.no_subsea_cable_lands_in_city_own_sat',{city:CITY.${c}.name})`);
|
||||
const none = (c) => ev(`tr('satellites.no_teleport_reaches_city',{city:CITY.${c}.name})`);
|
||||
const reach = (c) => ev(`tr('satellites.reachable_from_your_teleports',{city:CITY.${c}.name})`);
|
||||
assert.notEqual(ownSat('yfb'), 'link_modal.no_subsea_cable_lands_in_city_own_sat', 'the new text is there');
|
||||
// Level 1: no teleport on sale yet, the hint is as before.
|
||||
let t = card(ev, 'nuk', 'yfb');
|
||||
assert.ok(t.includes(own('yfb')), t);
|
||||
assert.doesNotMatch(t, /satellite/i);
|
||||
// Level 2: a bird sees Iqaluit and Adamstown, so the cable is not the only way; no teleport of yours reaches them yet.
|
||||
ev('S.lvl=2');
|
||||
for (const [a, b] of [['nuk', 'yfb'], ['yfb', 'nuk'], ['nyc', 'pcn']]) {
|
||||
const c = b === 'nuk' ? a : b;
|
||||
t = card(ev, a, b);
|
||||
assert.ok(t.includes(ownSat(c)) && !t.includes(own(c)), `${a}→${b}: ${t}`);
|
||||
assert.ok(t.includes(none(c)), `${a}→${b} says where a teleport would have to go: ${t}`);
|
||||
assert.match(t, /level 9 or Tier 1/, 'the cable of your own is still offered');
|
||||
}
|
||||
// Pevek has a road in: that text stays, and the satellite comes after it. Alice Springs has no beach at all.
|
||||
t = card(ev, 'nyc', 'pvs');
|
||||
assert.ok(t.includes(ev("tr('link_modal.no_subsea_cable_lands_in_city_land',{city:CITY.pvs.name})")) && t.includes(none('pvs')), t);
|
||||
t = card(ev, 'nyc', 'asp');
|
||||
assert.ok(t.includes(none('asp')), t);
|
||||
// Murmansk is no remote town: no satellite serves it.
|
||||
t = card(ev, 'nyc', 'mmk');
|
||||
assert.doesNotMatch(t, /satellite|teleport/i, t);
|
||||
// A teleport in New York sees Iqaluit over the Americas bird: a button to the order sheet, from there.
|
||||
ev("ACT.buildPop({city:'nyc'});closeModal();ACT.teleBuild({city:'nyc'})");
|
||||
assert.ok(ev("teleOf('nyc')===1&&satBirds('nyc','yfb').includes('gx19')"));
|
||||
ev("window.innerWidth=360;window.innerHeight=740;UI.lmode='wave';openLinkModal('nuk','yfb')");
|
||||
t = doc.getElementById('modalCard').textContent;
|
||||
assert.ok(t.includes(ownSat('yfb')) && t.includes(reach('yfb')) && !t.includes(none('yfb')), t);
|
||||
const go = [...doc.querySelectorAll('#modalCard [data-act="satOpen"]')];
|
||||
assert.deepEqual(go.map((b) => JSON.parse(b.dataset.args)), [{ a: 'nyc', b: 'yfb' }]);
|
||||
go[0].click();
|
||||
assert.equal(doc.getElementById('modal').hidden, false);
|
||||
assert.match(doc.getElementById('modalCard').textContent, /New York → Iqaluit/);
|
||||
assert.ok(doc.querySelector('#modalCard [data-act="buySat"]'), 'the order sheet, with its circuits');
|
||||
ev('closeModal()');
|
||||
// Not in a puzzle, as the satellites themselves.
|
||||
ev("localStorage.removeItem('sot-puzzles');pzBegin(pzDef('baltic'));closeModal()");
|
||||
assert.equal(ev("JSON.stringify([pzOn(),satCan('yfb')])"), '[true,false]');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue