;;-*-Lisp-*-
(in-package goal)
(bundles "ENGINE.CGO" "GAME.CGO")
(require "engine/game/game-info.gc")
(require "engine/game/task/game-task-h.gc")

;; DECOMP BEGINS

(defun-debug task-status->string ((arg0 task-status))
  (enum->string task-status arg0))

(defmethod get-task ((this task-cstage))
  "Get the game task for this cstage"
  (-> this game-task))

(defmethod get-status ((this task-cstage))
  "Get the status for this cstage"
  (-> this status))

(defmethod closed? ((this task-cstage))
  "Is the closed flag set?"
  (declare (inline))
  (logtest? (-> this flags) (task-flags closed)))

(defmethod closed-by-default? ((this task-cstage))
  "Is the closed-by-default flag set?"
  (declare (inline))
  (logtest? (-> this flags) (task-flags closed-by-default)))

(defmethod task-available? ((this task-cstage) (arg0 task-control))
  "Is this task available to be the current task?"
  (cond
    ((closed? this)
     ;; we're already closed.
     #f)
    ((>= (the-as int (-> (get-entity-task-perm *game-info* (-> this game-task)) user-uint8 0)) (the-as int (-> this status)))
     ;; the permanent entity for this task has stored that we have progresssed past
     ;; our status. Remember that we are closed, and return #f.
     (logior! (-> this flags) (task-flags closed))
     #f)
    ((task-complete? *game-info* (-> this game-task))
     ;; the game-info thinks that we have completed this task already.
     ;; remember we are closed and return #f
     (logior! (-> this flags) (task-flags closed))
     #f)
    (else
     ;; we aren't closed. Check the condition.
     ((-> this condition) arg0))))

(defmethod close-task! ((this task-cstage))
  "Close this task!"
  (if (= (-> this game-task) (game-task none))
    ;; invalid task.
    (return (the-as int #f)))
  ;; flag as closed
  (logior! (-> this flags) (task-flags closed))
  ;; do we have an entity to update?
  (when (logtest? (-> this flags) (task-flags has-entity))
    ;; look up the permanent storage for the entity associated with our task
    (let ((v1-9 (get-entity-task-perm *game-info* (-> this game-task))))
      ;; we set a bit to indicate that we are storing a non-default status
      (logior! (-> v1-9 status) (entity-perm-status user-set-from-cstage))
      ;; and store the actual status (only increment)
      (if (< (-> v1-9 user-uint8 0) (the-as uint (-> this status))) (set! (-> v1-9 user-int8 0) (the-as int (-> this status))))))
  0)

(defmethod open-task! ((this task-cstage))
  "Clear the closed flag."
  (logclear! (-> this flags) (task-flags closed))
  0)

;; a task-control containing no cstages
(define *null-task-control*
  (new 'static 'task-control :current-stage -1 :stage (new 'static 'boxed-array :type task-cstage)))

(defmethod current-task ((this task-control))
  "Get the current task that is being played. If unknown returns the none task"
  (cond
    ((= this *null-task-control*) (format 0 "ERROR<GMJ>: current-task received *null-task-control*~%") (game-task none))
    ((= (-> this current-stage) -1)
     ;; state unknown
     (game-task none))
    (else
     ;; look up the current cstage's task
     (-> this stage (-> this current-stage) game-task))))

(defmethod current-status ((this task-control))
  "Get the status of the cstage that is being played.
   Will return invalid if not possible"
  (cond
    ((= this *null-task-control*)
     (format 0 "ERROR<GMJ>: current-status received self of *null-task-control*~%~%")
     (task-status invalid))
    ((= (-> this current-stage) -1) (task-status invalid))
    (else (-> this stage (-> this current-stage) status))))

(defmethod close-current! ((this task-control))
  (cond
    ((= this *null-task-control*) (format 0 "ERROR<GMJ>: close-current! received self of *null-task-control*~%~%"))
    ((= (-> this current-stage) -1)
     ;; no current stage, do nothing
     )
    (else (close-task! (-> this stage (-> this current-stage)))))
  ;; attempt to update the current task
  (first-any this #t))

(defmethod close-status! ((this task-control) (arg0 task-status))
  "Close the cstage that:
    - is associated with the task for the current cstage
    - is for the given status
   "
  (let ((a0-2 (current-task this)))
    ;; iterate over all cstages
    (dotimes (v1-1 (-> this stage length))
      (when (and (= a0-2 (-> this stage v1-1 game-task)) (= arg0 (-> this stage v1-1 status)))
        ;; found it! close and update current stage
        (close-task! (-> this stage v1-1))
        (return (first-any this #t))))
    ;; nope, complain.
    (format 0
            "ERROR<GMJ>: close-status! received non-existent task-cstage(~S ~S)--returning #t.~%"
            (game-task->string a0-2)
            (task-status->string arg0)))
  (game-task none))

(defmethod first-any ((this task-control) (arg0 symbol))
  "Iterate through tasks, finding an unclosed one to mark as current
   If arg0 is #t, warn on receiving null-task-control"
  ;; check for null
  (when (= this *null-task-control*)
    (if arg0 (format 0 "ERROR<GMJ>: first-any received self of *null-task-control*~%~%"))
    (return (game-task none)))
  ;; iterate through all tasks
  (dotimes (s5-0 (-> this stage length))
    (when (task-available? (-> this stage s5-0) this)
      ;; found an available task, set it.
      (set! (-> this current-stage) s5-0)
      (return (-> this stage s5-0 game-task))))
  ;; none available.
  (set! (-> this current-stage) -1)
  (game-task none))

(defmethod reset! ((this task-control) (reset-mode symbol) (arg1 symbol))
  "Reset a task control. arg1 to warn on null, reset-mode 'game for a game reset"
  (when (= this *null-task-control*)
    (if arg1 (format 0 "ERROR<GMJ>: reset! received self of *null-task-control*~%~%"))
    (return 0))
  (dotimes (s4-0 (-> this stage length))
    ;; do we open the task?
    (if (or (= reset-mode 'game) ;; open every task on game reset
            (not (closed-by-default? (-> this stage s4-0))) ;; todo this flag?
            )
      (open-task! (-> this stage s4-0)))
    ;; call close-task! to send closed stuff to entities
    (if (closed? (-> this stage s4-0)) (close-task! (-> this stage s4-0))))
  (the-as int #f))

(defmethod closed? ((this task-control) (arg0 game-task) (arg1 task-status))
  "Is the given task/status cstage closed?"
  (when (= this *null-task-control*)
    (format 0 "ERROR<GMJ>: closed? received self of *null-task-control*~%~%")
    (return #f))
  ;; iterate all and check for match
  (dotimes (v1-3 (-> this stage length))
    (when (and (= arg0 (-> this stage v1-3 game-task)) (= arg1 (-> this stage v1-3 status)))
      (return (closed? (-> this stage v1-3)))))
  (format 0
          "ERROR<GMJ>: closed? received non-existent task-cstage(~S ~S)--returning #t.~%"
          (game-task->string arg0)
          (task-status->string arg1))
  #t)

(defmethod exists? ((this task-control) (arg0 game-task) (arg1 task-status))
  "Is there a cstage for the given task and status?"
  (when (= this *null-task-control*)
    (format 0 "ERROR<GMJ>: exists? received self of *null-task-control*~%~%")
    (return #f))
  (dotimes (v1-3 (-> this stage length))
    (if (and (= arg0 (-> this stage v1-3 game-task)) (= arg1 (-> this stage v1-3 status))) (return #t)))
  #f)

(defmethod get-reminder ((this task-control) (arg0 int))
  "Get the arg0th reminder. "
  (when (= this *null-task-control*)
    (format 0 "ERROR<GMJ>: get-reminder received self of *null-task-control*~%~%")
    (return 0))
  (let ((v1-4 (get-entity-task-perm *game-info* (-> this stage 0 game-task))))
    (the-as int (-> v1-4 user-uint8 (+ arg0 1)))))

(defmethod save-reminder ((this task-control) (arg0 int) (arg1 int))
  "Set the arg1th reminder to arg0"
  (when (= this *null-task-control*)
    (format 0 "ERROR<GMJ>: save-reminder received self of *null-task-control*~%~%")
    (return 0))
  (let ((v1-4 (get-entity-task-perm *game-info* (-> this stage 0 game-task))))
    ;; remember that we have a change.
    (logior! (-> v1-4 status) (entity-perm-status user-set-from-cstage))
    (set! (-> v1-4 user-int8 (+ arg1 1)) arg0))
  0)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Task Control Definitions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; tasks for assistant (note: keira)
(define *assistant-tasks*
  (new 'static
       'task-control
       :current-stage -1
       :stage
       (new 'static
            'boxed-array
            :type
            task-cstage
            (new 'static
                 'task-cstage
                 :game-task (game-task jungle-eggtop)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task jungle-eggtop)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task misty-bike)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   (or (closed? arg0 (game-task jungle-eggtop) (task-status need-reminder))
                       (and (closed? arg0 (game-task jungle-eggtop) (task-status need-introduction))
                            (>= (the int (the float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) (+ (get-reminder arg0 1) 3))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task misty-bike)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   (or (closed? arg0 (game-task jungle-eggtop) (task-status need-reminder))
                       (and (closed? arg0 (game-task jungle-eggtop) (task-status need-introduction))
                            (>= (the int (the float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) (+ (get-reminder arg0 1) 3))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task jungle-eggtop)
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task misty-bike)
                 :status (task-status unknown)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task misty-bike)
                 :status (task-status need-reminder-a)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task misty-bike)
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :status (task-status unknown)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   (task-closed? (game-task village4-button) (task-status need-reward-speech))))
            (new 'static
                 'task-cstage
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task jungle-eggtop)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task misty-bike)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t)))))

(define *assistant-village2-tasks*
  (new 'static
       'task-control
       :current-stage -1
       :stage
       (new 'static
            'boxed-array
            :type
            task-cstage
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-levitator)
                 :status (task-status unknown)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-levitator)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-levitator)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-levitator)
                 :status (task-status need-reminder-a)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-levitator)
                 :status (task-status need-reward-speech)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   (>= (the int (the float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) 45)))
            (new 'static
                 'task-cstage
                 :game-task (game-task sunken-room)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task sunken-room)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task swamp-flutflut)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (and (task-closed? (game-task beach-flutflut) (task-status need-reminder))
                        (or (closed? arg0 (game-task sunken-room) (task-status need-reminder))
                            (and (closed? arg0 (game-task sunken-room) (task-status need-introduction))
                                 (>= (the int (the float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) (+ (get-reminder arg0 1) 3)))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task swamp-flutflut)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (and (task-closed? (game-task beach-flutflut) (task-status need-reminder))
                        (or (closed? arg0 (game-task sunken-room) (task-status need-reminder))
                            (and (closed? arg0 (game-task sunken-room) (task-status need-introduction))
                                 (>= (the int (the float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) (+ (get-reminder arg0 1) 3)))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task rolling-robbers)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (if (task-closed? (game-task beach-flutflut) (task-status need-reminder))
                     (or (closed? arg0 (game-task swamp-flutflut) (task-status need-reminder))
                         (and (closed? arg0 (game-task swamp-flutflut) (task-status need-introduction))
                              (>= (the int (the float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) (+ (get-reminder arg0 1) 3))))
                     (or (closed? arg0 (game-task sunken-room) (task-status need-reminder))
                         (and (closed? arg0 (game-task sunken-room) (task-status need-introduction))
                              (>= (the int (the float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) (+ (get-reminder arg0 1) 3)))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task rolling-robbers)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (if (task-closed? (game-task beach-flutflut) (task-status need-reminder))
                     (or (closed? arg0 (game-task swamp-flutflut) (task-status need-reminder))
                         (and (closed? arg0 (game-task swamp-flutflut) (task-status need-introduction))
                              (>= (the int (the float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) (+ (get-reminder arg0 1) 3))))
                     (or (closed? arg0 (game-task sunken-room) (task-status need-reminder))
                         (and (closed? arg0 (game-task sunken-room) (task-status need-introduction))
                              (>= (the int (the float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) (+ (get-reminder arg0 1) 3)))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task sunken-room)
                 :status (task-status unknown)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task sunken-room)
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task swamp-flutflut)
                 :status (task-status unknown)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   (task-closed? (game-task beach-flutflut) (task-status need-reminder))))
            (new 'static
                 'task-cstage
                 :game-task (game-task swamp-flutflut)
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   (task-closed? (game-task beach-flutflut) (task-status need-reminder))))
            (new 'static
                 'task-cstage
                 :game-task (game-task rolling-robbers)
                 :status (task-status unknown)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task rolling-robbers)
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :status (task-status unknown)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task sunken-room)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task rolling-robbers)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task swamp-flutflut)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-levitator)
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t)))))

(define *gambler-tasks*
  (new 'static
       'task-control
       :current-stage -1
       :stage
       (new 'static
            'boxed-array
            :type
            task-cstage
            (new 'static
                 'task-cstage
                 :game-task (game-task rolling-race)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task rolling-race)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-gambler-money)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-gambler-money)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task rolling-race)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (closed? arg0 (game-task rolling-race) (task-status need-reward-speech))))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-gambler-money)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (closed? arg0 (game-task village2-gambler-money) (task-status need-reward-speech))))
            (new 'static
                 'task-cstage
                 :game-task (game-task rolling-race)
                 :status (task-status need-reward-speech)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (closed? arg0 (game-task rolling-race) (task-status need-reminder))))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-gambler-money)
                 :status (task-status need-reward-speech)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   (the-as symbol
                           (and *target*
                                (>= (the-as float (send-event *target* 'query 'pickup (pickup-type money))) (-> *GAME-bank* money-task-inc))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task rolling-race)
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (closed? arg0 (game-task rolling-race) (task-status need-introduction))))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-gambler-money)
                 :status (task-status need-reminder)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (closed? arg0 (game-task rolling-race) (task-status need-introduction)))))))

(define *geologist-tasks*
  (new 'static
       'task-control
       :current-stage -1
       :stage
       (new 'static
            'boxed-array
            :type
            task-cstage
            (new 'static
                 'task-cstage
                 :game-task (game-task rolling-moles)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task rolling-moles)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-geologist-money)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-geologist-money)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task rolling-moles)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (closed? arg0 (game-task rolling-moles) (task-status need-reward-speech))))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-geologist-money)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (closed? arg0 (game-task village2-geologist-money) (task-status need-reward-speech))))
            (new 'static
                 'task-cstage
                 :game-task (game-task rolling-moles)
                 :status (task-status need-reward-speech)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (closed? arg0 (game-task rolling-moles) (task-status need-reminder))))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-geologist-money)
                 :status (task-status need-reward-speech)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   (the-as symbol
                           (and *target*
                                (>= (the-as float (send-event *target* 'query 'pickup (pickup-type money))) (-> *GAME-bank* money-task-inc))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task rolling-moles)
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (closed? arg0 (game-task rolling-moles) (task-status need-introduction))))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-geologist-money)
                 :status (task-status need-reminder)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (closed? arg0 (game-task rolling-moles) (task-status need-introduction)))))))

(define *mayor-tasks*
  (new 'static
       'task-control
       :current-stage -1
       :stage
       (new 'static
            'boxed-array
            :type
            task-cstage
            (new 'static
                 'task-cstage
                 :game-task (game-task jungle-lurkerm)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task jungle-lurkerm)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village1-mayor-money)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village1-mayor-money)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task jungle-lurkerm)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (closed? arg0 (game-task jungle-lurkerm) (task-status need-reward-speech))))
            (new 'static
                 'task-cstage
                 :game-task (game-task village1-mayor-money)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (closed? arg0 (game-task village1-mayor-money) (task-status need-reward-speech))))
            (new 'static
                 'task-cstage
                 :game-task (game-task jungle-lurkerm)
                 :status (task-status need-reward-speech)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (closed? arg0 (game-task jungle-lurkerm) (task-status need-reminder))))
            (new 'static
                 'task-cstage
                 :game-task (game-task village1-mayor-money)
                 :status (task-status need-reward-speech)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   (the-as symbol
                           (and *target*
                                (>= (the-as float (send-event *target* 'query 'pickup (pickup-type money))) (-> *GAME-bank* money-task-inc))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task jungle-lurkerm)
                 :status (task-status need-reminder-a)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (closed? arg0 (game-task jungle-lurkerm) (task-status need-introduction))))
            (new 'static
                 'task-cstage
                 :game-task (game-task jungle-lurkerm)
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (closed? arg0 (game-task jungle-lurkerm) (task-status need-introduction))))
            (new 'static
                 'task-cstage
                 :game-task (game-task village1-mayor-money)
                 :status (task-status need-reminder)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (closed? arg0 (game-task jungle-lurkerm) (task-status need-introduction)))))))

(define *sage-tasks*
  (new 'static
       'task-control
       :current-stage -1
       :stage
       (new 'static
            'boxed-array
            :type
            task-cstage
            (new 'static
                 'task-cstage
                 :game-task (game-task intro)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task intro)
                 :status (task-status need-reward-speech)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task intro)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task beach-ecorocks)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task beach-ecorocks)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task misty-cannon)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (or (closed? arg0 (game-task beach-ecorocks) (task-status need-reminder))
                       (and (closed? arg0 (game-task beach-ecorocks) (task-status need-introduction))
                            (>= (the int (the float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) (+ (get-reminder arg0 1) 3))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task misty-cannon)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (or (closed? arg0 (game-task beach-ecorocks) (task-status need-reminder))
                       (and (closed? arg0 (game-task beach-ecorocks) (task-status need-introduction))
                            (>= (the int (the float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) (+ (get-reminder arg0 1) 3))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task beach-ecorocks)
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task misty-cannon)
                 :status (task-status unknown)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task misty-cannon)
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :status (task-status unknown)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   (task-closed? (game-task village4-button) (task-status need-reward-speech))))
            (new 'static
                 'task-cstage
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task beach-ecorocks)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task misty-cannon)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t)))))

(define *sage-bluehut-tasks*
  (new 'static
       'task-control
       :current-stage -1
       :stage
       (new 'static
            'boxed-array
            :type
            task-cstage
            (new 'static
                 'task-cstage
                 :game-task (game-task rolling-plants)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task rolling-plants)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task swamp-arm)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (or (closed? arg0 (game-task rolling-plants) (task-status need-reminder))
                       (and (closed? arg0 (game-task rolling-plants) (task-status need-introduction))
                            (>= (the int (the float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) (+ (get-reminder arg0 1) 3))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task swamp-arm)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (or (closed? arg0 (game-task rolling-plants) (task-status need-reminder))
                       (and (closed? arg0 (game-task rolling-plants) (task-status need-introduction))
                            (>= (the int (the float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) (+ (get-reminder arg0 1) 3))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task rolling-plants)
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task swamp-arm)
                 :status (task-status unknown)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task swamp-arm)
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :status (task-status unknown)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task rolling-plants)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task swamp-arm)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t)))))

(define *oracle-village1-tasks*
  (new 'static
       'task-control
       :current-stage -1
       :stage
       (new 'static
            'boxed-array
            :type
            task-cstage
            (new 'static
                 'task-cstage
                 :game-task (game-task village1-oracle-money1)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village1-oracle-money1)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village1-oracle-money2)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village1-oracle-money2)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village1-oracle-money1)
                 :status (task-status need-reward-speech)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   (the-as symbol
                           (and *target*
                                (>= (the-as float (send-event *target* 'query 'pickup (pickup-type money))) (-> *GAME-bank* money-oracle-inc))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task village1-oracle-money1)
                 :status (task-status need-reminder)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village1-oracle-money1)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village1-oracle-money2)
                 :status (task-status need-reward-speech)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   (the-as symbol
                           (and *target*
                                (>= (the-as float (send-event *target* 'query 'pickup (pickup-type money))) (-> *GAME-bank* money-oracle-inc))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task village1-oracle-money2)
                 :status (task-status need-reminder)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village1-oracle-money2)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t)))))

(define *oracle-village2-tasks*
  (new 'static
       'task-control
       :current-stage -1
       :stage
       (new 'static
            'boxed-array
            :type
            task-cstage
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-oracle-money1)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-oracle-money1)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-oracle-money2)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-oracle-money2)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-oracle-money1)
                 :status (task-status need-reward-speech)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   (the-as symbol
                           (and *target*
                                (>= (the-as float (send-event *target* 'query 'pickup (pickup-type money))) (-> *GAME-bank* money-oracle-inc))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-oracle-money1)
                 :status (task-status need-reminder)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-oracle-money1)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-oracle-money2)
                 :status (task-status need-reward-speech)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   (the-as symbol
                           (and *target*
                                (>= (the-as float (send-event *target* 'query 'pickup (pickup-type money))) (-> *GAME-bank* money-oracle-inc))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-oracle-money2)
                 :status (task-status need-reminder)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village2-oracle-money2)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t)))))

(define *oracle-village3-tasks*
  (new 'static
       'task-control
       :current-stage -1
       :stage
       (new 'static
            'boxed-array
            :type
            task-cstage
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-oracle-money1)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-oracle-money1)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-oracle-money2)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-oracle-money2)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-oracle-money1)
                 :status (task-status need-reward-speech)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   (the-as symbol
                           (and *target*
                                (>= (the-as float (send-event *target* 'query 'pickup (pickup-type money))) (-> *GAME-bank* money-oracle-inc))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-oracle-money1)
                 :status (task-status need-reminder)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-oracle-money1)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-oracle-money2)
                 :status (task-status need-reward-speech)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   (the-as symbol
                           (and *target*
                                (>= (the-as float (send-event *target* 'query 'pickup (pickup-type money))) (-> *GAME-bank* money-oracle-inc))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-oracle-money2)
                 :status (task-status need-reminder)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-oracle-money2)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t)))))

(define *miners-tasks*
  (new 'static
       'task-control
       :current-stage -1
       :stage
       (new 'static
            'boxed-array
            :type
            task-cstage
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money1)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money1)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money2)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money2)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money3)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money3)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money4)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money4)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money1)
                 :status (task-status need-reward-speech)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   (the-as symbol
                           (and *target*
                                (>= (the-as float (send-event *target* 'query 'pickup (pickup-type money))) (-> *GAME-bank* money-task-inc))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money2)
                 :status (task-status need-reward-speech)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   (the-as symbol
                           (and *target*
                                (>= (the-as float (send-event *target* 'query 'pickup (pickup-type money))) (-> *GAME-bank* money-task-inc))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money3)
                 :status (task-status need-reward-speech)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   (the-as symbol
                           (and *target*
                                (>= (the-as float (send-event *target* 'query 'pickup (pickup-type money))) (-> *GAME-bank* money-task-inc))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money4)
                 :status (task-status need-reward-speech)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   (the-as symbol
                           (and *target*
                                (>= (the-as float (send-event *target* 'query 'pickup (pickup-type money))) (-> *GAME-bank* money-task-inc))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task cave-gnawers)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (or (closed? arg0 (game-task village3-miner-money4) (task-status need-reminder))
                       (and (closed? arg0 (game-task village3-miner-money4) (task-status need-introduction))
                            (>= (the int (the float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) (+ (get-reminder arg0 1) 3))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task cave-gnawers)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (or (closed? arg0 (game-task village3-miner-money4) (task-status need-reminder))
                       (and (closed? arg0 (game-task village3-miner-money4) (task-status need-introduction))
                            (>= (the int (the float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) (+ (get-reminder arg0 1) 3))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task snow-eggtop)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (or (closed? arg0 (game-task cave-gnawers) (task-status need-reminder))
                       (and (closed? arg0 (game-task cave-gnawers) (task-status need-introduction))
                            (>= (the int (the float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) (+ (get-reminder arg0 1) 3))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task snow-eggtop)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (or (closed? arg0 (game-task cave-gnawers) (task-status need-reminder))
                       (and (closed? arg0 (game-task cave-gnawers) (task-status need-introduction))
                            (>= (the int (the float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) (+ (get-reminder arg0 1) 3))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money1)
                 :status (task-status unknown)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money1)
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money2)
                 :status (task-status unknown)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money2)
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money3)
                 :status (task-status unknown)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money3)
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money4)
                 :status (task-status unknown)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money4)
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task cave-gnawers)
                 :status (task-status unknown)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task cave-gnawers)
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task snow-eggtop)
                 :status (task-status unknown)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task snow-eggtop)
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :status (task-status unknown)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money1)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money2)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money3)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-miner-money4)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task cave-gnawers)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task snow-eggtop)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t)))))

(define *sage-villagec-tasks*
  (new 'static
       'task-control
       :current-stage -1
       :stage
       (new 'static
            'boxed-array
            :type
            task-cstage
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-button)
                 :status (task-status unknown)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-button)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task village3-button)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task cave-dark-crystals)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task cave-dark-crystals)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task snow-ram)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (or (closed? arg0 (game-task cave-dark-crystals) (task-status need-reminder))
                       (and (closed? arg0 (game-task cave-dark-crystals) (task-status need-introduction))
                            (>= (the int (the float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) (+ (get-reminder arg0 1) 3))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task snow-ram)
                 :status (task-status need-introduction)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda ((arg0 task-control) (arg1 task-control))
                   (or (closed? arg0 (game-task cave-dark-crystals) (task-status need-reminder))
                       (and (closed? arg0 (game-task cave-dark-crystals) (task-status need-introduction))
                            (>= (the int (the float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) (+ (get-reminder arg0 1) 3))))))
            (new 'static
                 'task-cstage
                 :game-task (game-task cave-dark-crystals)
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task snow-ram)
                 :status (task-status unknown)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task snow-ram)
                 :status (task-status need-reminder-a)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task snow-ram)
                 :status (task-status need-reminder)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :status (task-status unknown)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task cave-dark-crystals)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task snow-ram)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t)))))

(define *citb-greensage-tasks*
  (new 'static
       'task-control
       :current-stage -1
       :stage
       (new 'static
            'boxed-array
            :type
            task-cstage
            (new 'static
                 'task-cstage
                 :game-task (game-task citadel-sage-green)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task citadel-sage-green)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t)))))

(define *citb-bluesage-tasks*
  (new 'static
       'task-control
       :current-stage -1
       :stage
       (new 'static
            'boxed-array
            :type
            task-cstage
            (new 'static
                 'task-cstage
                 :game-task (game-task citadel-sage-blue)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task citadel-sage-blue)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t)))))

(define *citb-redsage-tasks*
  (new 'static
       'task-control
       :current-stage -1
       :stage
       (new 'static
            'boxed-array
            :type
            task-cstage
            (new 'static
                 'task-cstage
                 :game-task (game-task citadel-sage-red)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task citadel-sage-red)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t)))))

(define *citb-yellowsage-tasks*
  (new 'static
       'task-control
       :current-stage -1
       :stage
       (new 'static
            'boxed-array
            :type
            task-cstage
            (new 'static
                 'task-cstage
                 :game-task (game-task citadel-sage-yellow)
                 :status (task-status need-hint)
                 :flags (task-flags has-entity closed-by-default)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t))
            (new 'static
                 'task-cstage
                 :game-task (game-task citadel-sage-yellow)
                 :status (task-status need-resolution)
                 :flags (task-flags has-entity)
                 :condition
                 (lambda :behavior process-taskable ((arg0 task-control))
                   #t)))))

(define *task-controls*
  (the-as (array task-control)
          (new 'static
               'boxed-array
               :type
               basic
               '*null-task-control*
               '*null-task-control*
               '*assistant-tasks*
               '*mayor-tasks*
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-tower)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-tower)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-tower)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-tower)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-fishgame)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-fishgame)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-fishgame)
                              :status (task-status need-reminder-a)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-fishgame)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-fishgame)
                              :status (task-status need-reward-speech)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-fishgame)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :status (task-status need-reminder)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-plant)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-plant)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-plant)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-plant)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-buzzer)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-buzzer)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-buzzer)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-buzzer)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-canyon-end)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-canyon-end)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-canyon-end)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-canyon-end)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-temple-door)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-temple-door)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-temple-door)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task jungle-temple-door)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task village1-yakow)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village1-yakow)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village1-yakow)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village1-yakow)
                              :status (task-status need-reward-speech)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village1-yakow)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               '*mayor-tasks*
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task village1-uncle-money)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village1-uncle-money)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village1-uncle-money)
                              :status (task-status need-reward-speech)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                (the-as symbol
                                        (and *target*
                                             (>= (the-as float (send-event *target* 'query 'pickup (pickup-type money))) (-> *GAME-bank* money-task-inc))))))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village1-uncle-money)
                              :status (task-status need-reminder)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village1-uncle-money)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               '*oracle-village1-tasks*
               '*oracle-village1-tasks*
               '*sage-tasks*
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-pelican)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-pelican)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-pelican)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-pelican)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-flutflut)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-flutflut)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-flutflut)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-flutflut)
                              :status (task-status need-reward-speech)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-flutflut)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-seagull)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-seagull)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-seagull)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-seagull)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-cannon)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-cannon)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-cannon)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-cannon)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-buzzer)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-buzzer)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-buzzer)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-buzzer)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-gimmie)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-gimmie)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-gimmie)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-gimmie)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-sentinel)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-sentinel)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-sentinel)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task beach-sentinel)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-muse)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-muse)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-muse)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-muse)
                              :status (task-status need-reward-speech)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-muse)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-boat)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-boat)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-boat)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-boat)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-warehouse)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-warehouse)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-warehouse)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-warehouse)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               '*sage-tasks*
               '*assistant-tasks*
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-buzzer)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-buzzer)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-buzzer)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-buzzer)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-bike-jump)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-bike-jump)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-bike-jump)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-bike-jump)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-eco-challenge)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-eco-challenge)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-eco-challenge)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task misty-eco-challenge)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               '*gambler-tasks*
               '*geologist-tasks*
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task village2-warrior-money)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                (and (not (task-closed? (game-task ogre-boss) (task-status need-reminder)))
                                     (not (task-closed? (game-task village2-levitator) (task-status need-reward-speech))))))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village2-warrior-money)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                (and (not (task-closed? (game-task ogre-boss) (task-status need-reminder)))
                                     (not (task-closed? (game-task village2-levitator) (task-status need-reward-speech))))))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village2-warrior-money)
                              :status (task-status need-reward-speech)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                (the-as symbol
                                        (and *target*
                                             (>= (the-as float (send-event *target* 'query 'pickup (pickup-type money))) (-> *GAME-bank* money-task-inc))))))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village2-warrior-money)
                              :status (task-status need-reminder)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village2-warrior-money)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               '*oracle-village2-tasks*
               '*oracle-village2-tasks*
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-billy)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-billy)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-billy)
                              :status (task-status need-reminder-a)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-billy)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-billy)
                              :status (task-status need-reward-speech)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-billy)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               '*assistant-village2-tasks*
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-battle)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-battle)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-battle)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-battle)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-tether-1)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-tether-1)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-tether-1)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-tether-1)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-tether-2)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-tether-2)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-tether-2)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-tether-2)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-tether-3)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-tether-3)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-tether-3)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-tether-3)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-tether-4)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-tether-4)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-tether-4)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-tether-4)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-buzzer)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-buzzer)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-buzzer)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task swamp-buzzer)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-platforms)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-platforms)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-platforms)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-platforms)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-pipe)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-pipe)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-pipe)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-pipe)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-slide)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-slide)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-slide)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-slide)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               '*assistant-village2-tasks*
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-sharks)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-sharks)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-sharks)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-sharks)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-buzzer)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-buzzer)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-buzzer)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-buzzer)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-top-of-helix)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-top-of-helix)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-top-of-helix)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-top-of-helix)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-spinning-room)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-spinning-room)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-spinning-room)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task sunken-spinning-room)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               '*gambler-tasks*
               '*assistant-village2-tasks*
               '*geologist-tasks*
               '*sage-bluehut-tasks*
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task rolling-lake)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task rolling-lake)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task rolling-lake)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task rolling-lake)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task rolling-buzzer)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task rolling-buzzer)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task rolling-buzzer)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task rolling-buzzer)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task rolling-ring-chase-1)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task rolling-ring-chase-1)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task rolling-ring-chase-1)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task rolling-ring-chase-1)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task rolling-ring-chase-2)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task rolling-ring-chase-2)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task rolling-ring-chase-2)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task rolling-ring-chase-2)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               '*miners-tasks*
               '*sage-villagec-tasks*
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-fort)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-fort)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-fort)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-fort)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-ball)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-ball)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-ball)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-ball)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-bunnies)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-bunnies)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-bunnies)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-bunnies)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-buzzer)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-buzzer)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-buzzer)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-buzzer)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-bumpers)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-bumpers)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-bumpers)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-bumpers)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-cage)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-cage)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-cage)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task snow-cage)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task firecanyon-buzzer)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task firecanyon-buzzer)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task firecanyon-buzzer)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task firecanyon-buzzer)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task firecanyon-end)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task firecanyon-end)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task firecanyon-end)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task firecanyon-end)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               '*citb-greensage-tasks*
               '*citb-bluesage-tasks*
               '*citb-redsage-tasks*
               '*citb-yellowsage-tasks*
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task village3-extra1)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village3-extra1)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village3-extra1)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village3-extra1)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task village1-buzzer)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village1-buzzer)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village1-buzzer)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village1-buzzer)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task village2-buzzer)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village2-buzzer)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village2-buzzer)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village2-buzzer)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task village3-buzzer)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village3-buzzer)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village3-buzzer)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village3-buzzer)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               '*miners-tasks*
               '*sage-villagec-tasks*
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-dark-climb)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-dark-climb)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-dark-climb)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-dark-climb)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-robot-climb)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-robot-climb)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-robot-climb)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-robot-climb)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-swing-poles)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-swing-poles)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-swing-poles)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-swing-poles)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-spider-tunnel)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-spider-tunnel)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-spider-tunnel)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-spider-tunnel)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-platforms)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-platforms)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-platforms)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-platforms)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-buzzer)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-buzzer)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-buzzer)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task cave-buzzer)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task ogre-boss)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task ogre-boss)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task ogre-boss)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task ogre-boss)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task ogre-end)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task ogre-end)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task ogre-end)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task ogre-end)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task ogre-buzzer)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task ogre-buzzer)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task ogre-buzzer)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task ogre-buzzer)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task lavatube-end)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task lavatube-end)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task lavatube-end)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task lavatube-end)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task lavatube-buzzer)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task lavatube-buzzer)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task lavatube-buzzer)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task lavatube-buzzer)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task citadel-buzzer)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task citadel-buzzer)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task citadel-buzzer)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task citadel-buzzer)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task training-gimmie)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task training-gimmie)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task training-gimmie)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task training-gimmie)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task training-door)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task training-door)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task training-door)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task training-door)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task training-climb)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task training-climb)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task training-climb)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task training-climb)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task training-buzzer)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task training-buzzer)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task training-buzzer)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task training-buzzer)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               '*miners-tasks*
               '*miners-tasks*
               '*miners-tasks*
               '*miners-tasks*
               '*oracle-village3-tasks*
               '*oracle-village3-tasks*
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task firecanyon-assistant)
                              :status (task-status need-reward-speech)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                (>= (the int (the float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) 20)))
                         (new 'static
                              'task-cstage
                              :game-task (game-task firecanyon-assistant)
                              :status (task-status unknown)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               '*assistant-village2-tasks*
               '*sage-bluehut-tasks*
               '*sage-villagec-tasks*
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task red-eggtop)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task red-eggtop)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task red-eggtop)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task red-eggtop)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task lavatube-balls)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task lavatube-balls)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task lavatube-balls)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task lavatube-balls)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task lavatube-start)
                              :status (task-status need-reward-speech)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                (>= (the int (the float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) 72)))
                         (new 'static
                              'task-cstage
                              :game-task (game-task lavatube-start)
                              :status (task-status unknown)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               '*sage-tasks*
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task ogre-secret)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task ogre-secret)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task ogre-secret)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task ogre-secret)
                              :status (task-status need-resolution)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task village4-button)
                              :status (task-status unknown)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village4-button)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task village4-button)
                              :status (task-status need-reward-speech)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task finalboss-movies)
                              :status (task-status unknown)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task finalboss-movies)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task finalboss-movies)
                              :status (task-status need-reminder-a)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task finalboss-movies)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task finalboss-movies)
                              :status (task-status need-reward-speech)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task plunger-lurker-hit)
                              :status (task-status unknown)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task plunger-lurker-hit)
                              :status (task-status need-hint)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :game-task (game-task leaving-misty)
                              :status (task-status need-introduction)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))
                         (new 'static
                              'task-cstage
                              :game-task (game-task leaving-misty)
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity closed-by-default)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t))))
               (new 'static
                    'task-control
                    :current-stage -1
                    :stage
                    (new 'static
                         'boxed-array
                         :type
                         task-cstage
                         (new 'static
                              'task-cstage
                              :status (task-status unknown)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                (task-closed? (game-task village4-button) (task-status need-reward-speech))))
                         (new 'static
                              'task-cstage
                              :status (task-status need-reminder)
                              :flags (task-flags has-entity)
                              :condition
                              (lambda :behavior process-taskable ((arg0 task-control))
                                #t)))))))

(defun task-control-reset ((arg0 symbol))
  "Reset all task controls and set their current stage"
  (let ((s5-0 *task-controls*))
    (countdown (s4-0 (-> s5-0 length))
      (reset! (-> s5-0 s4-0) arg0 #f)
      (first-any (-> s5-0 s4-0) #f)))
  0
  (none))

(defun get-task-control ((arg0 game-task))
  "Get the task control for a given game-task"
  (cond
    ((or (>= (the-as uint 1) (the-as uint arg0)) (>= (the-as uint arg0) (the-as uint 116)))
     ;; invalid game task
     (format 0 "ERROR<GMJ>: get-task-control received invalid task ~D/~S~%" arg0 (game-task->string arg0))
     *null-task-control*)
    (else
     ;; otherwise look up in table
     (-> *task-controls* arg0))))

(defun get-task-status ((arg0 game-task))
  "Get the staus of a game-task"
  (let ((gp-0 (get-task-control arg0)))
    (when gp-0
      (dotimes (s5-0 (-> gp-0 stage length))
        (when (and (= arg0 (-> gp-0 stage s5-0 game-task)) (task-available? (-> gp-0 stage s5-0) gp-0))
          (first-any gp-0 #t)
          (return (the-as task-status (-> gp-0 stage s5-0 status))))))
    (first-any gp-0 #t))
  (task-status invalid))

(defun close-specific-task! ((arg0 game-task) (arg1 task-status))
  "Close a cstage for a game-task"
  (let ((gp-0 (get-task-control arg0)))
    (when gp-0
      (dotimes (v1-1 (-> gp-0 stage length))
        (when (and (= arg0 (-> gp-0 stage v1-1 game-task)) (= arg1 (-> gp-0 stage v1-1 status)))
          (close-task! (-> gp-0 stage v1-1))
          (return (first-any gp-0 #t))))
      (format 0
              "ERROR<GMJ>: close-specific! received non-existent task-cstage(~S ~S)--returning #t.~%"
              (game-task->string arg0)
              (task-status->string arg1))))
  (game-task none))

(defun open-specific-task! ((arg0 game-task) (arg1 task-status))
  "Open a cstage for a game-task"
  (let ((gp-0 (get-task-control arg0)))
    (when gp-0
      (dotimes (v1-1 (-> gp-0 stage length))
        (when (and (= arg0 (-> gp-0 stage v1-1 game-task)) (= arg1 (-> gp-0 stage v1-1 status)))
          (open-task! (-> gp-0 stage v1-1))
          (return (first-any gp-0 #t))))
      (format 0
              "ERROR<GMJ>: open-specific! received non-existent task-cstage(~S ~S)--returning #t.~%"
              (game-task->string arg0)
              (task-status->string arg1))))
  (game-task none))

(defun task-closed? ((arg0 game-task) (arg1 task-status))
  (closed? (get-task-control arg0) arg0 arg1))

(defun task-exists? ((arg0 game-task) (arg1 task-status))
  (exists? (get-task-control arg0) arg0 arg1))

(defun task-known? ((arg0 game-task))
  "Is there a cstage with a non-unknown status?"
  (case (get-task-status arg0)
    (((task-status need-reward-speech)
      (task-status need-introduction)
      (task-status need-reminder)
      (task-status need-reminder-a)
      (task-status need-resolution)
      (task-status invalid))
     #t)
    (else #f)))

(defun sages-kidnapped? ()
  (task-closed? (game-task village4-button) (task-status need-reward-speech)))

;; replace symbols in task-controls with their value.
(let ((gp-0 *task-controls*))
  (countdown (s5-0 (-> gp-0 length))
    (when (and (-> gp-0 s5-0) (= (-> gp-0 s5-0 type) symbol))
      ;; found a symbol
      (let ((s4-0 (-> (the-as symbol (-> gp-0 s5-0)) value)))
        (cond
          ((and (nonzero? s4-0) (type-type? (rtype-of s4-0) task-control))
           ;; symbol holds a task-control, replace it
           (set! (-> gp-0 s5-0) (the-as task-control s4-0)))
          (else
           ;; invalid symbol
           (format 0 "ERROR<GMJ>: value of symbol ~A in task-controls is not a task-control~%")
           (set! (-> gp-0 s5-0) (the-as task-control '*null-task-control*))))))))

(task-control-reset 'game)
