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:
Frederic Jung 2026-11-04 13:36:46 +00:00
parent 8d709d7fb9
commit 0d72311911
No known key found for this signature in database
11 changed files with 51 additions and 33 deletions

View file

@ -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',

View file

@ -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.

View file

@ -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>`;}

View file

@ -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",