File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 4141 - [ Sailors] ( ./towns/tavern/sailors.md )
4242 - [ Money Lender] ( ./towns/money-lender.md )
4343 - [ Bath House] ( ./towns/bath-house.md )
44+ - [ Excess Consumption] ( ./towns/excess_consumption.md )
4445 - [ Sieges] ( ./towns/sieges.md )
4546 - [ Initialization] ( ./towns/sieges/initialization.md )
4647- [ Merchants] ( ./ch05-00-merchants.md )
Original file line number Diff line number Diff line change 1+ # Excess Consumption
2+ The ` town_excess_consumption ` function at ` 0x00528630 ` reduces excess wares which cannot be produced in the town.
3+ It is called in ` town_tick ` if the town is not under siege.
4+
5+ ## Calculation
6+ ``` python
7+ def calculate_excess_consumption (
8+ daily_production : int ,
9+ daily_consumption_citizens : int ,
10+ daily_consumption_businesses : int ,
11+ current_amount : int ,
12+ t1 : int ,
13+ t3 : int ,
14+ ) -> int :
15+ if daily_production:
16+ return 0
17+ if current_amount <= t1:
18+ return 0
19+
20+ above_t1 = current_amount - t1
21+ consumption = daily_consumption_citizens + daily_consumption_businesses
22+ removed_amount = above_t1
23+ * 16
24+ * consumption
25+ // 10
26+ // t3
27+
28+ return min (removed_amount, above_t1)
29+ ```
You can’t perform that action at this time.
0 commit comments