Addding support for trading farmers fates.

logins
Thomas Hintz 5 years ago
parent ebf3e6aace
commit f0feb56328

@ -494,10 +494,10 @@
(missing-cards (fold (lambda (id r)
(if (or (find (lambda (card)
(= (alist-ref 'id card eqv? -1) id))
(player-otbs player))
(append (player-otbs player) (player-farmers-fates player)))
(find (lambda (card)
(= (alist-ref 'id card eqv? -1) id))
(player-otbs other-player)))
(append (player-otbs other-player) (player-farmers-fates other-player))))
r
(cons id r)))
'()
@ -545,10 +545,10 @@
#t)
other-player)))
(define (otb-by-id player id)
(define (card-by-id player cards id)
(find (lambda (card)
(= (alist-ref 'id card eqv? -1) id))
(player-otbs player)))
cards))
(define (accept-trade game player)
(let* ((originator (find-player-by-name
@ -603,19 +603,34 @@
(when (alist-ref 'cards params)
(for-each
(lambda (id)
(if (otb-by-id player id)
(let ((otb (otb-by-id player id)))
(safe-set! (player-otbs player)
(filter (lambda (x) (not (= id (alist-ref 'id x))))
(player-otbs player)))
(safe-set! (player-otbs originator)
(cons otb (player-otbs originator))))
(let ((otb (otb-by-id originator id)))
(safe-set! (player-otbs originator)
(filter (lambda (x) (not (= id (alist-ref 'id x))))
(player-otbs originator)))
(safe-set! (player-otbs player)
(cons otb (player-otbs player))))))
(cond ((card-by-id player (player-otbs player) id)
(let ((otb (card-by-id player (player-otbs player) id)))
(safe-set! (player-otbs player)
(filter (lambda (x) (not (= id (alist-ref 'id x))))
(player-otbs player)))
(safe-set! (player-otbs originator)
(cons otb (player-otbs originator)))))
((card-by-id originator (player-otbs originator) id)
(let ((otb (card-by-id originator (player-otbs originator) id)))
(safe-set! (player-otbs originator)
(filter (lambda (x) (not (= id (alist-ref 'id x))))
(player-otbs originator)))
(safe-set! (player-otbs player)
(cons otb (player-otbs player)))))
((card-by-id player (player-farmers-fates player) id)
(let ((ff (card-by-id player (player-farmers-fates player) id)))
(safe-set! (player-farmers-fates player)
(filter (lambda (x) (not (= id (alist-ref 'id x))))
(player-farmers-fates player)))
(safe-set! (player-farmers-fates originator)
(cons ff (player-farmers-fates originator)))))
((card-by-id originator (player-farmers-fates originator) id)
(let ((ff (card-by-id originator (player-farmers-fates originator) id)))
(safe-set! (player-farmers-fates originator)
(filter (lambda (x) (not (= id (alist-ref 'id x))))
(player-farmers-fates originator)))
(safe-set! (player-farmers-fates player)
(cons ff (player-farmers-fates player)))))))
cards))
(safe-set! (player-trade originator) '())
@ -1853,21 +1868,12 @@
;; finished
;; infinite loop ((?action . end-game) (?value . #<procedure (a10302)>))
;; interface.js:172 Uncaught TypeError: Cannot read property 'toFixed' of undefined
;; at formatMoney (interface.js:172)
;; at interface.js:248
;; at Object.dispatch (redux.js:222)
;; at interface.js:94
;; at bk (react-dom.production.min.js:224)
;; at WebSocket.handleMessage (interface.js:46)
;; auto-skip loop
;; harvester / tractor don't say total price
;; trade screen: person who porposed trade is wrong
;; mark spaces
;; decling trade doesn't work
;; support trading farmers fates
;; repay loan box 1 more than max can repay
;; test tractor/harvester a lot better
;; trade notification keeps popping up

Loading…
Cancel
Save