|
|
|
@ -698,16 +698,22 @@
|
|
|
|
|
(print action)
|
|
|
|
|
(cond ((eq? value 'otb)
|
|
|
|
|
(let ((otb (do-action action player)))
|
|
|
|
|
(set! (game-actions game) (cdr (game-actions game)))
|
|
|
|
|
(if otb
|
|
|
|
|
(begin
|
|
|
|
|
(set! (game-actions game) (cdr (game-actions game)))
|
|
|
|
|
(set-ui-action! `((action . "otb")
|
|
|
|
|
(value . ,(alist-ref 'contents otb)))
|
|
|
|
|
game)
|
|
|
|
|
(create-ws-response player "action"
|
|
|
|
|
`((action . "otb")
|
|
|
|
|
(value . ,(alist-ref 'contents otb)))))
|
|
|
|
|
(loop))))
|
|
|
|
|
(begin
|
|
|
|
|
(set-ui-action! `((action . "info")
|
|
|
|
|
(value . ,(conc "Out of " *item-card-short* "'s.")))
|
|
|
|
|
game)
|
|
|
|
|
(create-ws-response player "action"
|
|
|
|
|
`((action . "info")
|
|
|
|
|
(value . ,(conc "Out of " *item-card-short* "'s."))))))))
|
|
|
|
|
((eq? name 'move)
|
|
|
|
|
(set! (game-actions game) (cdr (game-actions game)))
|
|
|
|
|
(set-ui-action! `((action . "move") (value . ,value)) game)
|
|
|
|
@ -805,8 +811,7 @@
|
|
|
|
|
(let* ((id (alist-ref 'id msg))
|
|
|
|
|
(otb (find (lambda (x) (= id (alist-ref 'id x)))
|
|
|
|
|
(player-otbs player))))
|
|
|
|
|
(if
|
|
|
|
|
(buy-crop (normalize-crop
|
|
|
|
|
(when (buy-crop (normalize-crop
|
|
|
|
|
(string->symbol (alist-ref 'crop otb)))
|
|
|
|
|
(string->symbol (alist-ref 'crop otb))
|
|
|
|
|
(alist-ref 'amount otb)
|
|
|
|
@ -816,6 +821,10 @@
|
|
|
|
|
1000)
|
|
|
|
|
player
|
|
|
|
|
game)
|
|
|
|
|
(set! (game-otbs game)
|
|
|
|
|
(append (game-otbs game)
|
|
|
|
|
(filter (lambda (x) (= id (alist-ref 'id x)))
|
|
|
|
|
(player-otbs player))))
|
|
|
|
|
(set! (player-otbs player)
|
|
|
|
|
(filter (lambda (x) (not (= id (alist-ref 'id x))))
|
|
|
|
|
(player-otbs player)))))
|
|
|
|
@ -1571,15 +1580,13 @@
|
|
|
|
|
(harvest-action-of-type? crop (car actions))))
|
|
|
|
|
#f))
|
|
|
|
|
|
|
|
|
|
(define (draw-otb player)
|
|
|
|
|
(let ((game (session-ref (sid) 'game)))
|
|
|
|
|
(define (draw-otb player game)
|
|
|
|
|
(if (null? (game-otbs game))
|
|
|
|
|
(begin (push-message player "No O.T.B.s left to draw!")
|
|
|
|
|
#f)
|
|
|
|
|
#f
|
|
|
|
|
(receive (new-otb remaining-otbs) (split-at (game-otbs game) 1)
|
|
|
|
|
(set! (player-otbs player) (cons (car new-otb) (player-otbs player)))
|
|
|
|
|
(set! (game-otbs game) remaining-otbs)
|
|
|
|
|
(car new-otb)))))
|
|
|
|
|
(car new-otb))))
|
|
|
|
|
|
|
|
|
|
(define (do-action action player)
|
|
|
|
|
(let ((a (alist-ref '?action action)))
|
|
|
|
@ -1600,9 +1607,9 @@
|
|
|
|
|
(let ((month (alist-ref '?value action)))
|
|
|
|
|
(list-index (lambda (x) (eq? x month)) *months*))))
|
|
|
|
|
((and (eq? a 'draw) (eq? (alist-ref '?value action) 'otb))
|
|
|
|
|
(when (not (null? (game-otbs (session-ref (sid) 'game))))
|
|
|
|
|
(push-message player "You drew an O.T.B.!")
|
|
|
|
|
(draw-otb player)))
|
|
|
|
|
(if (not (null? (game-otbs (session-ref (sid) 'game))))
|
|
|
|
|
(draw-otb player (session-ref (sid) 'game))
|
|
|
|
|
#f))
|
|
|
|
|
((and (eq? a 'draw) (eq? (alist-ref '?value action) 'farmers-fate))
|
|
|
|
|
(let ((game (session-ref (sid) 'game)))
|
|
|
|
|
(receive (new-ff remaining-ffs) (split-at (game-farmers-fates game) 1)
|
|
|
|
@ -1705,5 +1712,4 @@
|
|
|
|
|
;; bug: harvest action multiplayer doesn't flow right for other players
|
|
|
|
|
;; info actions should look better
|
|
|
|
|
;; you can get $50 from harvest
|
|
|
|
|
;; ran out of otbs
|
|
|
|
|
;; bug: new websocket messages should not reset IFS card selection
|
|
|
|
|