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