diff options
author | colin <colin@cicadas.surf> | 2023-04-01 09:48:08 -0700 |
---|---|---|
committer | colin <colin@cicadas.surf> | 2023-04-01 09:48:08 -0700 |
commit | cc3f850c514967ae2f9effef7e68e1d4965c6865 (patch) | |
tree | 6d0b52c3a65d53f247f4c8272667aca5a4e05bac /src/game/quest.lisp | |
parent | 56a584ab1b13ff9510dd5145a778000169901a76 (diff) |
Refactor to make cooperative hacking nicer
Diffstat (limited to 'src/game/quest.lisp')
-rw-r--r-- | src/game/quest.lisp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/game/quest.lisp b/src/game/quest.lisp new file mode 100644 index 0000000..ed9a5b4 --- /dev/null +++ b/src/game/quest.lisp @@ -0,0 +1,51 @@ +(in-package :dnd) + +(defclass quest (game-object) + ((adventure + :reader adventure + :initarg :adventure + :initform (error "No quest can fall outside the scope of a adventure.") + :type adventure + :index-type idx:hash-index + :index-reader quests-in-adventure + :documentation "The adventure to which this quest belongs") + (name + :accessor name + :initarg :name + :type string + :initform (format nil "~a" (gensym "QUEST"))) + (horizon-of-hope + :accessor horizon-of-hope + :initarg :deadline + :type integer + :initform nil + :documentation "When all hope becomes lost.") + (inception + :accessor quest-inception + :initform nil + :type (or nil integer) + :documentation "Time at which the quest began.")) + (:metaclass db:persistent-class) + (:documentation "A collection of hazards with a deadline and start date which heroes will attack.")) + + + +(defun player-quests (player) + "Return all quests in which one of player's heroes is engaged." + (remove nil (mapcar #'quest (player-heroes player)))) + +(define-id-plucker quest) + + +(defrender :link-to ((quest quest)) + (with-html + (:a :href (urlpath quest) + (name quest)))) + +(defclass quest-page () + ((quest :reader quest :initarg :quest) + (player :reader player :initarg :player))) + +(defrender t ((page quest)) + (with-page (:title (unique-name (quest page ))) + (:h1 (unique-name (quest page))))) |