Best Effort: PNIs are up at once, no attack warnings without attacks
A pnis rule (wait or instant): in Best Effort pniLead() is 0, new PNIs are on the moment they are ordered and augments and LAG members are applied at once (pniUpDone(), split out of pniDay()). Gaming customers' attack warning shows only where DDoS can happen.
This commit is contained in:
parent
09f205e458
commit
4a66bbf998
16 changed files with 85 additions and 26 deletions
|
|
@ -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, []);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue