Skip to content

Commit 8393a7b

Browse files
committed
Money Lender
1 parent 1990fee commit 8393a7b

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
- [Taxes](./towns/taxes.md)
3434
- [Tavern](./towns/tavern.md)
3535
- [Sailors](./towns/tavern/sailors.md)
36+
- [Money Lender](./towns/money-lender.md)
3637
- [Bath House](./towns/bath-house.md)
3738
- [Sieges](./towns/sieges.md)
3839
- [Initialization](./towns/sieges/initialization.md)

src/towns/money-lender.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Money Lender
2+
3+
## Interest Rates
4+
5+
## Pages
6+
7+
### Grant Loan Page
8+
During every preparation tick of the window the town's loan applications are converted to *grant loan* operations and stored in the window.
9+
10+
### Grant Loan Confirm Page
11+
When the confirm button is clicked and if the merchant has enough money, the selected *grant loan* operation is enqueued.
12+
13+
The interest rate is calculated as follows:
14+
\\[
15+
f_{setting} * (\sqrt{\frac{1}{\text{weeks} * \text{amount}}} * 300 + 1.2)
16+
\\]
17+
18+
where \\(f_{setting}\\) is defined as:
19+
20+
|Setting|Factor|
21+
|||
22+
|Very Low|8|
23+
|Low|9|
24+
|Normal|10|
25+
|High|11|
26+
|Very High|12|
27+
28+
Interest is applied weekly, the repayment sum is capped at 65000.
29+
30+
A loan's success is determined while on the grant loan page and when clicking the interest change buttons on the grant loan confirm page.
31+
The following table defines the safe repayment sums for each debtor's rank:
32+
33+
|Rank|Safe Repayment Sum|
34+
|||
35+
|Shopkeeper|5000|
36+
|Trader|10000|
37+
|Merchant|15000|
38+
|Travelling Merchant|20000|
39+
|Councillor|25000|
40+
|Patrician|30000|
41+
42+
If the repayment sum is bigger than the safe repayment sum, the following computation dedices whether the loan will default:
43+
```c
44+
rand() & 0x3ff < 75 * ((repayment_sum - safe_repayment_sum + 1250) / 1250)
45+
```
46+
Therefore, exceeding the safe repayment sum by `n * 1250` causes a default chance of `n : 1024-n`.

0 commit comments

Comments
 (0)