Showing crop multipliers, loan UX enhancement.

This commit is contained in:
2020-03-31 12:38:28 -07:00
parent 41b30fa314
commit 6916991455
3 changed files with 216 additions and 163 deletions

View File

@@ -93,7 +93,9 @@
(last-cash initform: 5000 accessor: player-last-cash)
(mailbox initform: (make-mailbox) accessor: player-mailbox)
(mutex initform: (make-mutex 'player) accessor: player-mutex)
(harvesting initform: #f accessor: player-harvesting)))
(harvesting initform: #f accessor: player-harvesting)
(hay-doubled initform: #f accessor: player-hay-doubled)
(corn-doubled initform: #f accessor: player-corn-doubled)))
(define-class <game> ()
((id initform: 0 accessor: game-id)
@@ -341,7 +343,9 @@
(color . ,(symbol->string (player-color p)))
(name . ,(player-name p))
(trade . ,(player-trade p))
(lastCash . ,(player-last-cash p))))))
(lastCash . ,(player-last-cash p))
(hayDoubled . ,(player-hay-doubled p))
(cornDoubled . ,(player-corn-doubled p))))))
(define (game->list g player)
`((game . ((messages . ,(list->vector (reverse (game-messages g))))
@@ -430,6 +434,8 @@
(safe-set! (player-finished player) #t))))))))
(safe-set! (player-year-rules player) (player-next-year-rules player))
(safe-set! (player-next-year-rules player) '())
(safe-set! (player-hay-doubled player) #f)
(safe-set! (player-corn-doubled player) #f)
(when (not (null? (player-farmers-fates player)))
(safe-set! (game-farmers-fates game)
(append (game-farmers-fates game) (player-farmers-fates player)))
@@ -1588,6 +1594,8 @@
(when (not (already-harvested? 'wheat player))
((make-player-pays-per-unit 'grain 50) player)))
(define (get-actions player space)
(let ((res '()))
(let loop ((a
@@ -1597,6 +1605,7 @@
((jan2 draw ?p otb))
((jan3 money ?p ,(pays 500)) (?p cows))
((jan4 add-rule ?p ,(make-player-year-rule 9 '((?p hay harvest-mult 2) (?p hay)))))
((jan4 player-action ?p ,(lambda (p) (safe-set! (player-hay-doubled p) #t))))
((feb1 money ?p ,(gains 1000)))
((feb2 draw ?p farmers-fate))
((feb3 goto ?p apr2))
@@ -1608,6 +1617,7 @@
((apr1 draw ?p otb))
((apr2 add-rule ?p ,(make-player-year-rule
10 '((?p corn harvest-mult 2) (?p grain)))))
((apr2 player-action ?p ,(lambda (p) (safe-set! (player-corn-doubled p) #t))))
((apr3 money ?p ,(pays 500)))
((apr4 money ?p ,(pays 1000)))
((may1 money ?p ,(gains 500)))
@@ -1790,6 +1800,7 @@
(acres (alist-ref crop (player-assets player)))
(harvest-amounts (get-harvest-amounts crop))
(rolled (+ (random 6) 1))
(harvest-mult (player-harvest-mult player))
(income
(farming-round
;; add one to skip the divisor
@@ -1813,6 +1824,7 @@
((alist-ref 'action operating-expense) player)
`((rolled . ,rolled)
(income . ,income)
(harvestMult . ,harvest-mult)
(operatingExpense . ,(alist-ref 'contents operating-expense))
(operatingExpenseValue . ((,(string->symbol (player-name player))
. ,(- (player-cash player)
@@ -1904,5 +1916,4 @@
;; trade notification keeps popping up
;; you can see how much money you make before you harvest
;; show harvest multiplier