Call the bank from AA up, and weird conditions always apply (#251)
A rating no longer gets the buttons. On top of the usual conditions every called loan carries this week's quirk from CALL_ODD (a yacht, an odd number of POPs, no links on a Friday, a job for the nephew...): one at AAA, two at AA. It turns over every 7 days, so a call still rolls no dice and calling again the same week gets the same offer.
This commit is contained in:
parent
8d709d7fb9
commit
0d72311911
11 changed files with 51 additions and 33 deletions
|
|
@ -11,7 +11,7 @@ All notable changes to this project are documented here. The project follows
|
|||
- No circuit of any kind can be built between North and South Korea, and nothing leaves South Korea over land: every way out is a subsea cable.
|
||||
- The map zooms in twice as far, for crowded regions like New England or around Washington.
|
||||
- Cable ships at anchor sit a little further out from their port, and a tap on a city picks the city even with a ship close by.
|
||||
- With a credit rating of A or better you can now call a bank from the Bank window and ask for the amount you need. The better your rating, the lower the rate, the fewer the conditions and the more they will lend, up to a limit based on your revenue and what you already owe. (#251)
|
||||
- With a credit rating of AA or better you can now call a bank from the Bank window and ask for the amount you need. The better your rating, the lower the rate and the more they will lend, up to a limit based on your revenue and what you already owe, but weird conditions always apply. (#251)
|
||||
- Agents playing through the Agent API can no longer start a link in a city where you have no POP, just as on the map. Before, an agent could sign a dark fiber IRU, lease a wave or lay a cable from such a city; now it is told why, and so is its dry run.
|
||||
- Build POP in a small city that is off the map now says why it can't, and names a city nearby to build in instead. Founding your own exchange where you can't (mainland China, a city that already has one, a city with no POP) says why too. Before, both did nothing without a word, and an agent's dry run quoted a price.
|
||||
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@
|
|||
"bank.call_the_bank":"Bank anrufen",
|
||||
"bank.condition_broken_for_n_day":{"one":"Bedingung seit {n} Tag verletzt.","other":"Bedingung seit {n} Tagen verletzt."},
|
||||
"bank.debt_free_your_accountant_is":"Schuldenfrei. Deine Buchhaltung wird misstrauisch.",
|
||||
"bank.get_to_an_a_rating_and":"Erreiche ein A-Rating, dann nehmen die Banker deinen Anruf an. Gerade sind sie in einem Meeting.",
|
||||
"bank.get_to_an_aa_rating_and":"Erreiche ein AA-Rating, dann nehmen die Banker deinen Anruf an. Gerade sind sie in einem Meeting.",
|
||||
"bank.in_the_vault":"im Tresor",
|
||||
"bank.n_loan":{"one":"{n} Kredit","other":"{n} Kredite"},
|
||||
"bank.n_months":"{n} Monate",
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@
|
|||
"bank.call_the_bank":"Llamar al banco",
|
||||
"bank.condition_broken_for_n_day":{"one":"Condición incumplida durante {n} día.","other":"Condición incumplida durante {n} días."},
|
||||
"bank.debt_free_your_accountant_is":"Sin deudas. Tu contable desconfía.",
|
||||
"bank.get_to_an_a_rating_and":"Llega a una calificación A y los banqueros te cogerán el teléfono. Ahora mismo están en una reunión.",
|
||||
"bank.get_to_an_aa_rating_and":"Llega a una calificación AA y los banqueros te cogerán el teléfono. Ahora mismo están en una reunión.",
|
||||
"bank.in_the_vault":"en la cámara acorazada",
|
||||
"bank.n_loan":{"one":"{n} préstamo","other":"{n} préstamos"},
|
||||
"bank.n_months":"{n} meses",
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@
|
|||
"bank.call_the_bank":"Appeler la banque",
|
||||
"bank.condition_broken_for_n_day":{"one":"Condition non respectée depuis {n} jour.","other":"Condition non respectée depuis {n} jours."},
|
||||
"bank.debt_free_your_accountant_is":"Zéro dette. Ton comptable trouve ça louche.",
|
||||
"bank.get_to_an_a_rating_and":"Atteins une note A et les banquiers prendront ton appel. Pour l'instant, ils sont en réunion.",
|
||||
"bank.get_to_an_aa_rating_and":"Atteins une note AA et les banquiers prendront ton appel. Pour l'instant, ils sont en réunion.",
|
||||
"bank.in_the_vault":"dans le coffre",
|
||||
"bank.n_loan":{"one":"{n} prêt","other":"{n} prêts"},
|
||||
"bank.n_months":"{n} mois",
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@
|
|||
"bank.call_the_bank":"Chiama la banca",
|
||||
"bank.condition_broken_for_n_day":{"one":"Condizione violata da {n} giorno.","other":"Condizione violata da {n} giorni."},
|
||||
"bank.debt_free_your_accountant_is":"Zero debiti. Il tuo commercialista è sospettoso.",
|
||||
"bank.get_to_an_a_rating_and":"Arriva a un rating A e i banchieri ti risponderanno. Adesso sono in riunione.",
|
||||
"bank.get_to_an_aa_rating_and":"Arriva a un rating AA e i banchieri ti risponderanno. Adesso sono in riunione.",
|
||||
"bank.in_the_vault":"nel caveau",
|
||||
"bank.n_loan":{"one":"{n} prestito","other":"{n} prestiti"},
|
||||
"bank.n_months":"{n} mesi",
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@
|
|||
"bank.call_the_bank":"Ligar para o banco",
|
||||
"bank.condition_broken_for_n_day":{"one":"Condição descumprida há {n} dia.","other":"Condição descumprida há {n} dias."},
|
||||
"bank.debt_free_your_accountant_is":"Sem dívidas. Seu contador está desconfiado.",
|
||||
"bank.get_to_an_a_rating_and":"Chegue à nota A e os banqueiros atenderão sua ligação. Agora eles estão em reunião.",
|
||||
"bank.get_to_an_aa_rating_and":"Chegue à nota AA e os banqueiros atenderão sua ligação. Agora eles estão em reunião.",
|
||||
"bank.in_the_vault":"no cofre",
|
||||
"bank.n_loan":{"one":"{n} empréstimo","other":"{n} empréstimos"},
|
||||
"bank.n_months":"{n} meses",
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ const API_CMD={
|
|||
takeLoan:{args:[['id','entityId']],
|
||||
doc:'Accept a loan offer. Terms vary wildly by bank; the crypto one pays out 55-135% of face value. Equity banks take a share of the company.'},
|
||||
callBank:{args:[['amount','callAmount']],watch:['loanOffers'],
|
||||
doc:'Call a bank for a loan offer of this size, with a credit rating of A or better. The terms follow from the rating, and the amount must fit the limit of a few months of revenue less current debt. Nothing is borrowed until you take the offer.'},
|
||||
doc:'Call a bank for a loan offer of this size, with a credit rating of AA or better (weird conditions apply). The terms follow from the rating, and the amount must fit the limit of a few months of revenue less current debt. Nothing is borrowed until you take the offer.'},
|
||||
declineLoan:{args:[['id','entityId']],
|
||||
doc:'Throw a loan offer away.'},
|
||||
repayLoan:{args:[['id','entityId']],confirm:'double',
|
||||
|
|
|
|||
|
|
@ -78,15 +78,19 @@ function spawnLoanOffer(emergency){
|
|||
S.loanOffers.push(o);
|
||||
toast(tr('banks.bank_would_like_to_lend_you',{bank:esc(B.name),amount:fmt$(amount)})+'<br>'+(emergency?tr('banks.they_heard_you_might_be_in'):tr('banks.terms_apply_several_terms')),emergency?'bad':'goal',[{l:tr('common.open_bank'),act:'bank',args:{}}]);
|
||||
}
|
||||
/* Good credit can pick up the phone (#251). The terms follow from the rating alone, so calling again gets nothing better and
|
||||
rolls no dice. What you owe already uses up the limit, and the limit replaces the revenue share of a BIG_LOAN. */
|
||||
/* Good credit can pick up the phone (#251), from AA up. The rate and the limit follow from the rating alone, so calling again
|
||||
gets nothing better and rolls no dice. Bankers being bankers, weird conditions apply: this week's quirk (CALL_ODD, turning
|
||||
over every 7 days) comes on top of the usual ones. What you owe already uses up the limit, and the limit replaces the
|
||||
revenue share of a BIG_LOAN. */
|
||||
const CALL_AMTS=[1e5,5e5,1e6,5e6,1e7],CALL_MONTHS=36;
|
||||
const CALL_TERMS={A:{bank:'jpm',apr:.09,x:4,covs:['uptime','logo']},AA:{bank:'gs',apr:.075,x:6,covs:['golf','continents2']},AAA:{bank:'gs',apr:.06,x:8,covs:['golf']}};
|
||||
const CALL_TERMS={AA:{bank:'gs',apr:.075,x:6,covs:['golf','continents2'],odd:2},AAA:{bank:'gs',apr:.06,x:8,covs:['golf'],odd:1}};
|
||||
const CALL_ODD=['yacht','oddpops','friday','nephew','nobude','kehrwoche','forms','app'];
|
||||
const callOdd=T=>{const w=Math.floor(S.day/7)*3;return Array.from({length:T.odd},(_,i)=>CALL_ODD[(w+i)%CALL_ODD.length]);};
|
||||
const loanDebt=()=>S.loans.reduce((a,l)=>a+(BANKS[l.bank].equity?0:l.bal),0);
|
||||
const callLimit=T=>Math.max(0,(R.revMo||0)*T.x-loanDebt());
|
||||
// The new offer replaces an earlier called one; offers that came by themselves stay.
|
||||
function callOffer(amount){const T=CALL_TERMS[rating()];if(!T||!CALL_AMTS.includes(amount)||S.cash>=RICH_NO_LOANS||amount>callLimit(T))return null;
|
||||
const o={id:uid(),bank:T.bank,amount,exp:S.day+25,covs:T.covs.slice(),apr:T.apr,term:CALL_MONTHS,pay:Math.round(annuity(amount,T.apr,CALL_MONTHS)),call:1};
|
||||
const o={id:uid(),bank:T.bank,amount,exp:S.day+25,covs:T.covs.concat(callOdd(T)),apr:T.apr,term:CALL_MONTHS,pay:Math.round(annuity(amount,T.apr,CALL_MONTHS)),call:1};
|
||||
S.loanOffers=S.loanOffers.filter(x=>!x.call);S.loanOffers.push(o);return o;}
|
||||
// Best Effort has no game over: deep in the red, the Ministry of Tubes lends what it takes to be back in the black,
|
||||
// cheap, over five years, no conditions. The repayments are still yours.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ function renderBank(){
|
|||
<div class="tile"><div class="lbl">${tr('common.debt')}</div><div class="val">${fmt$(loanDebt())}</div><div class="sub">${trn('bank.n_loan',S.loans.length)}</div></div></div>`;
|
||||
const CT=CALL_TERMS[rt];
|
||||
if(S.cash<RICH_NO_LOANS){const lim=CT?callLimit(CT):0;h+=`<h3 style="font-size:18px;margin-top:6px">${tr('bank.call_the_bank')}</h3>`;
|
||||
h+=CT?`<div class="meta">${tr('bank.bank_picks_up_apr_apr_over',{bank:esc(BANKS[CT.bank].name),apr:(CT.apr*100).toFixed(1),n:CALL_MONTHS,limit:fmt$(lim)})}</div><div class="btns" style="margin-top:6px">${CALL_AMTS.map(a=>btn(fmt$(a),'callBank',{amount:a},'sm',a>lim)).join('')}</div>`:`<p class="empty">${tr('bank.get_to_an_a_rating_and')}</p>`;}
|
||||
h+=CT?`<div class="meta">${tr('bank.bank_picks_up_apr_apr_over',{bank:esc(BANKS[CT.bank].name),apr:(CT.apr*100).toFixed(1),n:CALL_MONTHS,limit:fmt$(lim)})}</div><div class="btns" style="margin-top:6px">${CALL_AMTS.map(a=>btn(fmt$(a),'callBank',{amount:a},'sm',a>lim)).join('')}</div>`:`<p class="empty">${tr('bank.get_to_an_aa_rating_and')}</p>`;}
|
||||
h+=`<h3 style="font-size:18px;margin-top:14px">${tr('common.offers')}</h3>`;
|
||||
if(!S.loanOffers.length)h+=`<p class="empty">${tr('bank.no_offers_right_now_banks_get')}</p>`;
|
||||
for(const o of S.loanOffers){const B=BANKS[o.bank];h+=`<div class="loan"><span class="logo" style="--c:${B.col}">${initials(B)}</span><div class="grow"><div class="nm">${tr('bank.bank_offers_amount',{bank:esc(B.name),amount:fmt$(o.amount)})}</div><div class="meta">${esc(B.blurb)} · ${tr('bank.offer_ends_in_n_d',{n:o.exp-S.day})}</div><div class="terms">${terms(o)}</div>${covList({covs:o.covs,start:S.day,base:{sub:S.links.filter(x=>x.sub).length}})}<div class="btns" style="margin-top:6px">${btn(tr('bank.take_the_money'),'takeLoan',{id:o.id},'pink')}${btn(tr('common.no_thanks'),'declineLoan',{id:o.id},'ghost sm')}</div></div></div>`;}
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@
|
|||
"bank.call_the_bank":"Call the bank",
|
||||
"bank.condition_broken_for_n_day":{"one":"Condition broken for {n} day.","other":"Condition broken for {n} days."},
|
||||
"bank.debt_free_your_accountant_is":"Debt-free. Your accountant is suspicious.",
|
||||
"bank.get_to_an_a_rating_and":"Get to an A rating and bankers will take your call. Right now they are in a meeting.",
|
||||
"bank.get_to_an_aa_rating_and":"Get to an AA rating and bankers will take your call. Right now they are in a meeting.",
|
||||
"bank.in_the_vault":"in the vault",
|
||||
"bank.n_loan":{"one":"{n} loan","other":"{n} loans"},
|
||||
"bank.n_months":"{n} months",
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ const offers = (ev) => json(ev, 'S.loanOffers');
|
|||
const bank = (ev) => { ev('ACT.bank({})'); return ev("$('bankCard').textContent"); };
|
||||
const buttons = (ev) => { ev('ACT.bank({})'); return json(ev, "[...document.querySelectorAll('#bankCard [data-act=\"callBank\"]')].map(b=>[JSON.parse(b.dataset.args).amount,b.disabled])"); };
|
||||
|
||||
test('below an A rating nobody picks up, even for a direct call', (t) => {
|
||||
const { ev, errors } = game(t, 'BBB');
|
||||
test('below an AA rating nobody picks up, even for a direct call', (t) => {
|
||||
const { ev, errors } = game(t, 'A');
|
||||
assert.deepEqual(buttons(ev), []);
|
||||
assert.match(bank(ev), /Get to an A rating/);
|
||||
assert.match(bank(ev), /Get to an AA rating/);
|
||||
ev('ACT.callBank({amount:1e5})');
|
||||
assert.equal(offers(ev).length, 0);
|
||||
assert.deepEqual(errors, []);
|
||||
|
|
@ -28,7 +28,7 @@ test('below an A rating nobody picks up, even for a direct call', (t) => {
|
|||
test('each rating gets its own bank, rate, conditions and payment, and better credit is never worse', (t) => {
|
||||
const { ev, errors } = game(t);
|
||||
const seen = {};
|
||||
for (const rt of ['A', 'AA', 'AAA']) {
|
||||
for (const rt of ['AA', 'AAA']) {
|
||||
ev(`window.__rt='${rt}';ACT.callBank({amount:1e6})`);
|
||||
const [o] = offers(ev);
|
||||
seen[rt] = o;
|
||||
|
|
@ -38,36 +38,36 @@ test('each rating gets its own bank, rate, conditions and payment, and better cr
|
|||
assert.equal(o.pay, ev(`Math.round(annuity(1e6,${o.apr},36))`));
|
||||
assert.ok(!o.share, 'no slice of revenue on a called loan');
|
||||
assert.equal(ev(`rIdx(window.__rt)>=rIdx(BANKS['${o.bank}'].min)`), true, 'the bank would lend at this rating');
|
||||
assert.equal(ev(`${JSON.stringify(o.covs)}.every(c=>COVS[c]&&!COVS[c].fee&&!COVS[c].each)`), true, 'no conditions that cost money');
|
||||
assert.equal(ev(`${JSON.stringify(o.covs)}.every(c=>!!COVS[c])`), true, 'conditions the game knows');
|
||||
}
|
||||
assert.deepEqual([seen.A.bank, seen.AA.bank, seen.AAA.bank], ['jpm', 'gs', 'gs']);
|
||||
assert.deepEqual([seen.A.apr, seen.AA.apr, seen.AAA.apr], [0.09, 0.075, 0.06]);
|
||||
assert.deepEqual([seen.AA.bank, seen.AAA.bank], ['gs', 'gs']);
|
||||
assert.deepEqual([seen.AA.apr, seen.AAA.apr], [0.075, 0.06]);
|
||||
assert.equal(ev('S.loanOffers[0].covs!==CALL_TERMS.AAA.covs'), true, 'an offer has its own list, not the table');
|
||||
assert.deepEqual(seen.AAA.covs, ['golf']);
|
||||
assert.deepEqual(seen.AA.covs, ['golf', 'continents2']);
|
||||
assert.deepEqual(seen.A.covs, ['uptime', 'logo']);
|
||||
// The usual conditions, and weird ones on top: one at AAA, two at AA.
|
||||
assert.deepEqual(seen.AAA.covs, ['golf', ...json(ev, 'callOdd(CALL_TERMS.AAA)')]);
|
||||
assert.deepEqual(seen.AA.covs, ['golf', 'continents2', ...json(ev, 'callOdd(CALL_TERMS.AA)')]);
|
||||
assert.equal(seen.AAA.covs.length, 2);
|
||||
assert.equal(new Set(seen.AA.covs).size, 4, 'two different weird ones');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('the limit is months of revenue by rating, less debt; equity is not debt', (t) => {
|
||||
const { ev, errors } = game(t, 'A', 3e5); // 4 x 300k = 1.2M
|
||||
const { ev, errors } = game(t, 'AA', 3e5); // 6 x 300k = 1.8M
|
||||
assert.deepEqual(buttons(ev), [[1e5, false], [5e5, false], [1e6, false], [5e6, true], [1e7, true]]);
|
||||
assert.match(bank(ev), /up to \$1\.20M more/);
|
||||
assert.match(bank(ev), /up to \$1\.80M more/);
|
||||
ev('ACT.callBank({amount:5e6})');
|
||||
assert.equal(offers(ev).length, 0, 'over the limit is refused as well as greyed out');
|
||||
ev('window.__rt="AA"');
|
||||
assert.equal(ev('callLimit(CALL_TERMS.AA)'), 1.8e6);
|
||||
ev('window.__rt="AAA"');
|
||||
assert.equal(ev('callLimit(CALL_TERMS.AAA)'), 2.4e6);
|
||||
|
||||
ev("window.__rt='A';S.loans.push({id:'l1',bank:'db',bal:9e5,covs:[],amount:9e5,start:S.day,left:12,apr:.1,pay:1})");
|
||||
assert.deepEqual(buttons(ev), [[1e5, false], [5e5, true], [1e6, true], [5e6, true], [1e7, true]]);
|
||||
ev("window.__rt='AA';S.loans.push({id:'l1',bank:'db',bal:9e5,covs:[],amount:9e5,start:S.day,left:12,apr:.1,pay:1})");
|
||||
assert.deepEqual(buttons(ev), [[1e5, false], [5e5, false], [1e6, true], [5e6, true], [1e7, true]]);
|
||||
ev("S.loans.push({id:'l2',bank:'vult',bal:0,amount:7e6,share:.1,covs:[],start:S.day})");
|
||||
assert.equal(ev('callLimit(CALL_TERMS.A)'), 3e5, 'an investor is not a creditor, whatever their bal says');
|
||||
assert.equal(ev('callLimit(CALL_TERMS.AA)'), 9e5, 'an investor is not a creditor, whatever their bal says');
|
||||
ev("S.loans.find(l=>l.id==='l2').bal=7e6");
|
||||
assert.equal(ev('callLimit(CALL_TERMS.A)'), 3e5);
|
||||
assert.equal(ev('callLimit(CALL_TERMS.AA)'), 9e5);
|
||||
ev("S.loans[0].bal=9e9");
|
||||
assert.equal(ev('callLimit(CALL_TERMS.A)'), 0, 'never below zero');
|
||||
assert.equal(ev('callLimit(CALL_TERMS.AA)'), 0, 'never below zero');
|
||||
assert.match(bank(ev), /up to \$0 more/);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
|
@ -129,7 +129,7 @@ test('with half a billion in the vault the section is gone, like the banks', (t)
|
|||
ev('S.cash=RICH_NO_LOANS;ACT.callBank({amount:1e5})');
|
||||
assert.equal(offers(ev).length, 0);
|
||||
assert.deepEqual(buttons(ev), []);
|
||||
assert.doesNotMatch(bank(ev), /Call the bank|Get to an A rating/);
|
||||
assert.doesNotMatch(bank(ev), /Call the bank|Get to an AA rating/);
|
||||
ev('S.cash=RICH_NO_LOANS-1');
|
||||
assert.equal(buttons(ev).length, 5);
|
||||
assert.deepEqual(errors, []);
|
||||
|
|
@ -154,3 +154,17 @@ test('the amounts sit in the usual button row, which wraps on a phone', (t) => {
|
|||
assert.equal(ev("document.querySelectorAll('#bankCard .btns [data-act=\"callBank\"]').length"), 5);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('weird conditions always apply, and turn over every week, not every call', (t) => {
|
||||
const { ev, errors } = game(t);
|
||||
const odd = () => { ev('ACT.callBank({amount:1e5})'); return offers(ev)[0].covs.slice(1); };
|
||||
ev('S.day=0');
|
||||
const w0 = odd();
|
||||
assert.equal(w0.length, 1);
|
||||
assert.equal(ev(`CALL_ODD.includes(${JSON.stringify(w0[0])})`), true, 'from the weird list');
|
||||
ev('S.day=6');
|
||||
assert.deepEqual(odd(), w0, 'calling again the same week gets the same quirk');
|
||||
ev('S.day=7');
|
||||
assert.notDeepEqual(odd(), w0, 'next week, another one');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue