diff --git a/ATL/Lugwey/items.atl b/ATL/Lugwey/items.atl index 45e8b03..f29c37e 100644 --- a/ATL/Lugwey/items.atl +++ b/ATL/Lugwey/items.atl @@ -55,3 +55,6 @@ define-item "Bucket" description "A wooden bucket, held together by iron rims." cost 15 + +define-item "Cup of water" + description "A cup brimming full of nice, cool water..." \ No newline at end of file diff --git a/ATL/Lugwey/items.atl b/ATL/Lugwey/items.atl index 45e8b03..f29c37e 100644 --- a/ATL/Lugwey/items.atl +++ b/ATL/Lugwey/items.atl @@ -55,3 +55,6 @@ define-item "Bucket" description "A wooden bucket, held together by iron rims." cost 15 + +define-item "Cup of water" + description "A cup brimming full of nice, cool water..." \ No newline at end of file diff --git a/ATL/Lugwey/npcs.atl b/ATL/Lugwey/npcs.atl index 47dbee7..d66ae2d 100644 --- a/ATL/Lugwey/npcs.atl +++ b/ATL/Lugwey/npcs.atl @@ -11,13 +11,13 @@ description "An old monk, slightly hard of hearing, and looking very bored." says "Welcome, stranger! Good to see somebody here! Come on in!" -define-npc "Gardner" +define-npc "Gardener" description "A middle-aged monk with a rather dirty habit and a sweaty face." says "Hello there! Could you bring me some water? I'm really thirsty!" quest "Bring water" define-quest "Bring water" - start "Go and have a look near the kitchen, perhaps you'll find some." - end "Thank you very much for this water, I appreciate that!" + say-before "Go and have a look near the kitchen, perhaps you'll find some." + say-after "Thank you very much for this water, I appreciate that!" proof-item "Cup of water" experience 15 \ No newline at end of file diff --git a/ATL/Lugwey/items.atl b/ATL/Lugwey/items.atl index 45e8b03..f29c37e 100644 --- a/ATL/Lugwey/items.atl +++ b/ATL/Lugwey/items.atl @@ -55,3 +55,6 @@ define-item "Bucket" description "A wooden bucket, held together by iron rims." cost 15 + +define-item "Cup of water" + description "A cup brimming full of nice, cool water..." \ No newline at end of file diff --git a/ATL/Lugwey/npcs.atl b/ATL/Lugwey/npcs.atl index 47dbee7..d66ae2d 100644 --- a/ATL/Lugwey/npcs.atl +++ b/ATL/Lugwey/npcs.atl @@ -11,13 +11,13 @@ description "An old monk, slightly hard of hearing, and looking very bored." says "Welcome, stranger! Good to see somebody here! Come on in!" -define-npc "Gardner" +define-npc "Gardener" description "A middle-aged monk with a rather dirty habit and a sweaty face." says "Hello there! Could you bring me some water? I'm really thirsty!" quest "Bring water" define-quest "Bring water" - start "Go and have a look near the kitchen, perhaps you'll find some." - end "Thank you very much for this water, I appreciate that!" + say-before "Go and have a look near the kitchen, perhaps you'll find some." + say-after "Thank you very much for this water, I appreciate that!" proof-item "Cup of water" experience 15 \ No newline at end of file diff --git a/ATL/Lugwey/places.atl b/ATL/Lugwey/places.atl index f5f4df1..9b6fefe 100644 --- a/ATL/Lugwey/places.atl +++ b/ATL/Lugwey/places.atl @@ -82,6 +82,7 @@ neighbour "Dining Hall" neighbour "Storeroom" neighbour "Beer cellar" + item "Cup of water" define-place "Storeroom" description "" @@ -100,7 +101,7 @@ keeps out unwanted visitors. A few monks are currently at work." neighbour "Monastery grounds" neighbour "Stable" - npc "Gardner" + npc "Gardener" item "Hoe" item "Bucket" diff --git a/ATL/Lugwey/items.atl b/ATL/Lugwey/items.atl index 45e8b03..f29c37e 100644 --- a/ATL/Lugwey/items.atl +++ b/ATL/Lugwey/items.atl @@ -55,3 +55,6 @@ define-item "Bucket" description "A wooden bucket, held together by iron rims." cost 15 + +define-item "Cup of water" + description "A cup brimming full of nice, cool water..." \ No newline at end of file diff --git a/ATL/Lugwey/npcs.atl b/ATL/Lugwey/npcs.atl index 47dbee7..d66ae2d 100644 --- a/ATL/Lugwey/npcs.atl +++ b/ATL/Lugwey/npcs.atl @@ -11,13 +11,13 @@ description "An old monk, slightly hard of hearing, and looking very bored." says "Welcome, stranger! Good to see somebody here! Come on in!" -define-npc "Gardner" +define-npc "Gardener" description "A middle-aged monk with a rather dirty habit and a sweaty face." says "Hello there! Could you bring me some water? I'm really thirsty!" quest "Bring water" define-quest "Bring water" - start "Go and have a look near the kitchen, perhaps you'll find some." - end "Thank you very much for this water, I appreciate that!" + say-before "Go and have a look near the kitchen, perhaps you'll find some." + say-after "Thank you very much for this water, I appreciate that!" proof-item "Cup of water" experience 15 \ No newline at end of file diff --git a/ATL/Lugwey/places.atl b/ATL/Lugwey/places.atl index f5f4df1..9b6fefe 100644 --- a/ATL/Lugwey/places.atl +++ b/ATL/Lugwey/places.atl @@ -82,6 +82,7 @@ neighbour "Dining Hall" neighbour "Storeroom" neighbour "Beer cellar" + item "Cup of water" define-place "Storeroom" description "" @@ -100,7 +101,7 @@ keeps out unwanted visitors. A few monks are currently at work." neighbour "Monastery grounds" neighbour "Stable" - npc "Gardner" + npc "Gardener" item "Hoe" item "Bucket" diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 8e2091a..7edb8b6 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -26,7 +26,8 @@ (name "") (description "") (says "") - (sells NIL)) + (sells NIL) + (quest "")) (defstruct monster (name "") @@ -52,6 +53,14 @@ (type "") (damage 0)) +(defstruct quest + (name "") + (say-before "") + (say-after "") + (proof-item NIL) + (reward-item NIL) + (money 0) + (experience 0)) (defun set-object-attribute (game-object property value) "Set the attribute 'property' of 'game-object' to 'value'" diff --git a/ATL/Lugwey/items.atl b/ATL/Lugwey/items.atl index 45e8b03..f29c37e 100644 --- a/ATL/Lugwey/items.atl +++ b/ATL/Lugwey/items.atl @@ -55,3 +55,6 @@ define-item "Bucket" description "A wooden bucket, held together by iron rims." cost 15 + +define-item "Cup of water" + description "A cup brimming full of nice, cool water..." \ No newline at end of file diff --git a/ATL/Lugwey/npcs.atl b/ATL/Lugwey/npcs.atl index 47dbee7..d66ae2d 100644 --- a/ATL/Lugwey/npcs.atl +++ b/ATL/Lugwey/npcs.atl @@ -11,13 +11,13 @@ description "An old monk, slightly hard of hearing, and looking very bored." says "Welcome, stranger! Good to see somebody here! Come on in!" -define-npc "Gardner" +define-npc "Gardener" description "A middle-aged monk with a rather dirty habit and a sweaty face." says "Hello there! Could you bring me some water? I'm really thirsty!" quest "Bring water" define-quest "Bring water" - start "Go and have a look near the kitchen, perhaps you'll find some." - end "Thank you very much for this water, I appreciate that!" + say-before "Go and have a look near the kitchen, perhaps you'll find some." + say-after "Thank you very much for this water, I appreciate that!" proof-item "Cup of water" experience 15 \ No newline at end of file diff --git a/ATL/Lugwey/places.atl b/ATL/Lugwey/places.atl index f5f4df1..9b6fefe 100644 --- a/ATL/Lugwey/places.atl +++ b/ATL/Lugwey/places.atl @@ -82,6 +82,7 @@ neighbour "Dining Hall" neighbour "Storeroom" neighbour "Beer cellar" + item "Cup of water" define-place "Storeroom" description "" @@ -100,7 +101,7 @@ keeps out unwanted visitors. A few monks are currently at work." neighbour "Monastery grounds" neighbour "Stable" - npc "Gardner" + npc "Gardener" item "Hoe" item "Bucket" diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 8e2091a..7edb8b6 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -26,7 +26,8 @@ (name "") (description "") (says "") - (sells NIL)) + (sells NIL) + (quest "")) (defstruct monster (name "") @@ -52,6 +53,14 @@ (type "") (damage 0)) +(defstruct quest + (name "") + (say-before "") + (say-after "") + (proof-item NIL) + (reward-item NIL) + (money 0) + (experience 0)) (defun set-object-attribute (game-object property value) "Set the attribute 'property' of 'game-object' to 'value'" diff --git a/lisp/interpreter.lisp b/lisp/interpreter.lisp index bd1f1ed..46232f6 100644 --- a/lisp/interpreter.lisp +++ b/lisp/interpreter.lisp @@ -11,8 +11,7 @@ ;; A list of ATL language constructs ;; (Note: not complete - each (defcommand) appends to this list) -(defvar *atl-commands* - '(load-file start-place start-money name-world)) +(defvar *atl-commands* '(load-file name-world)) (defun build-define-command (object-type) "Build a new define command function for the specified object type" @@ -38,6 +37,7 @@ (defcommand define-weapon weapon) (defcommand define-item item) (defcommand define-npc npc) +(defcommand define-quest quest) (let ((world-directory NIL) diff --git a/ATL/Lugwey/items.atl b/ATL/Lugwey/items.atl index 45e8b03..f29c37e 100644 --- a/ATL/Lugwey/items.atl +++ b/ATL/Lugwey/items.atl @@ -55,3 +55,6 @@ define-item "Bucket" description "A wooden bucket, held together by iron rims." cost 15 + +define-item "Cup of water" + description "A cup brimming full of nice, cool water..." \ No newline at end of file diff --git a/ATL/Lugwey/npcs.atl b/ATL/Lugwey/npcs.atl index 47dbee7..d66ae2d 100644 --- a/ATL/Lugwey/npcs.atl +++ b/ATL/Lugwey/npcs.atl @@ -11,13 +11,13 @@ description "An old monk, slightly hard of hearing, and looking very bored." says "Welcome, stranger! Good to see somebody here! Come on in!" -define-npc "Gardner" +define-npc "Gardener" description "A middle-aged monk with a rather dirty habit and a sweaty face." says "Hello there! Could you bring me some water? I'm really thirsty!" quest "Bring water" define-quest "Bring water" - start "Go and have a look near the kitchen, perhaps you'll find some." - end "Thank you very much for this water, I appreciate that!" + say-before "Go and have a look near the kitchen, perhaps you'll find some." + say-after "Thank you very much for this water, I appreciate that!" proof-item "Cup of water" experience 15 \ No newline at end of file diff --git a/ATL/Lugwey/places.atl b/ATL/Lugwey/places.atl index f5f4df1..9b6fefe 100644 --- a/ATL/Lugwey/places.atl +++ b/ATL/Lugwey/places.atl @@ -82,6 +82,7 @@ neighbour "Dining Hall" neighbour "Storeroom" neighbour "Beer cellar" + item "Cup of water" define-place "Storeroom" description "" @@ -100,7 +101,7 @@ keeps out unwanted visitors. A few monks are currently at work." neighbour "Monastery grounds" neighbour "Stable" - npc "Gardner" + npc "Gardener" item "Hoe" item "Bucket" diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 8e2091a..7edb8b6 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -26,7 +26,8 @@ (name "") (description "") (says "") - (sells NIL)) + (sells NIL) + (quest "")) (defstruct monster (name "") @@ -52,6 +53,14 @@ (type "") (damage 0)) +(defstruct quest + (name "") + (say-before "") + (say-after "") + (proof-item NIL) + (reward-item NIL) + (money 0) + (experience 0)) (defun set-object-attribute (game-object property value) "Set the attribute 'property' of 'game-object' to 'value'" diff --git a/lisp/interpreter.lisp b/lisp/interpreter.lisp index bd1f1ed..46232f6 100644 --- a/lisp/interpreter.lisp +++ b/lisp/interpreter.lisp @@ -11,8 +11,7 @@ ;; A list of ATL language constructs ;; (Note: not complete - each (defcommand) appends to this list) -(defvar *atl-commands* - '(load-file start-place start-money name-world)) +(defvar *atl-commands* '(load-file name-world)) (defun build-define-command (object-type) "Build a new define command function for the specified object type" @@ -38,6 +37,7 @@ (defcommand define-weapon weapon) (defcommand define-item item) (defcommand define-npc npc) +(defcommand define-quest quest) (let ((world-directory NIL) diff --git a/lisp/player.lisp b/lisp/player.lisp index daa69a8..61ca6be 100644 --- a/lisp/player.lisp +++ b/lisp/player.lisp @@ -85,3 +85,7 @@ (incf (player-experience player) amount) (when (zerop (rem (player-experience player) *level-experience*)) (incf (player-level player) player))) + +(defun add-player-money (player amount) + "Increase the player's money by amount" + (incf (player-money player) amount)) diff --git a/ATL/Lugwey/items.atl b/ATL/Lugwey/items.atl index 45e8b03..f29c37e 100644 --- a/ATL/Lugwey/items.atl +++ b/ATL/Lugwey/items.atl @@ -55,3 +55,6 @@ define-item "Bucket" description "A wooden bucket, held together by iron rims." cost 15 + +define-item "Cup of water" + description "A cup brimming full of nice, cool water..." \ No newline at end of file diff --git a/ATL/Lugwey/npcs.atl b/ATL/Lugwey/npcs.atl index 47dbee7..d66ae2d 100644 --- a/ATL/Lugwey/npcs.atl +++ b/ATL/Lugwey/npcs.atl @@ -11,13 +11,13 @@ description "An old monk, slightly hard of hearing, and looking very bored." says "Welcome, stranger! Good to see somebody here! Come on in!" -define-npc "Gardner" +define-npc "Gardener" description "A middle-aged monk with a rather dirty habit and a sweaty face." says "Hello there! Could you bring me some water? I'm really thirsty!" quest "Bring water" define-quest "Bring water" - start "Go and have a look near the kitchen, perhaps you'll find some." - end "Thank you very much for this water, I appreciate that!" + say-before "Go and have a look near the kitchen, perhaps you'll find some." + say-after "Thank you very much for this water, I appreciate that!" proof-item "Cup of water" experience 15 \ No newline at end of file diff --git a/ATL/Lugwey/places.atl b/ATL/Lugwey/places.atl index f5f4df1..9b6fefe 100644 --- a/ATL/Lugwey/places.atl +++ b/ATL/Lugwey/places.atl @@ -82,6 +82,7 @@ neighbour "Dining Hall" neighbour "Storeroom" neighbour "Beer cellar" + item "Cup of water" define-place "Storeroom" description "" @@ -100,7 +101,7 @@ keeps out unwanted visitors. A few monks are currently at work." neighbour "Monastery grounds" neighbour "Stable" - npc "Gardner" + npc "Gardener" item "Hoe" item "Bucket" diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 8e2091a..7edb8b6 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -26,7 +26,8 @@ (name "") (description "") (says "") - (sells NIL)) + (sells NIL) + (quest "")) (defstruct monster (name "") @@ -52,6 +53,14 @@ (type "") (damage 0)) +(defstruct quest + (name "") + (say-before "") + (say-after "") + (proof-item NIL) + (reward-item NIL) + (money 0) + (experience 0)) (defun set-object-attribute (game-object property value) "Set the attribute 'property' of 'game-object' to 'value'" diff --git a/lisp/interpreter.lisp b/lisp/interpreter.lisp index bd1f1ed..46232f6 100644 --- a/lisp/interpreter.lisp +++ b/lisp/interpreter.lisp @@ -11,8 +11,7 @@ ;; A list of ATL language constructs ;; (Note: not complete - each (defcommand) appends to this list) -(defvar *atl-commands* - '(load-file start-place start-money name-world)) +(defvar *atl-commands* '(load-file name-world)) (defun build-define-command (object-type) "Build a new define command function for the specified object type" @@ -38,6 +37,7 @@ (defcommand define-weapon weapon) (defcommand define-item item) (defcommand define-npc npc) +(defcommand define-quest quest) (let ((world-directory NIL) diff --git a/lisp/player.lisp b/lisp/player.lisp index daa69a8..61ca6be 100644 --- a/lisp/player.lisp +++ b/lisp/player.lisp @@ -85,3 +85,7 @@ (incf (player-experience player) amount) (when (zerop (rem (player-experience player) *level-experience*)) (incf (player-level player) player))) + +(defun add-player-money (player amount) + "Increase the player's money by amount" + (incf (player-money player) amount)) diff --git a/lisp/ui.lisp b/lisp/ui.lisp index 4f16ea6..9e76021 100644 --- a/lisp/ui.lisp +++ b/lisp/ui.lisp @@ -207,6 +207,7 @@ (clear-screen) (debugging "~&~A is going to ~A." (player-name player) location) (change-player-location player location) + (add-player-experience player 1) (describe-place location)) (defun about (player &optional object-name) @@ -240,13 +241,38 @@ (let* ((place (get-game-object 'place (player-place player))) (npc (when (member npc-name (place-npc place) :test #'equalp) (get-game-object 'npc npc-name)))) - (if npc - (progn - (format t "~&~A: ~A" (string-upcase npc-name) (npc-says npc)) - (when (and (npc-sells npc) - (y-or-n-p "Trade with ~A?" npc-name)) - (trade player npc))) - (format t "~&~A is not here!" npc-name)))) + ;; Check if the NPC is here + (unless npc + (format t "~&~A is not here!" npc-name) + (return-from talk)) + (format t "~&~A: ~A" (string-upcase npc-name) (npc-says npc)) + ;; Trade with the NPC + (when (and (npc-sells npc) + (y-or-n-p "Trade with ~A?" npc-name)) + (trade player npc)) + ;; Handle quests + (let ((quest (get-game-object 'quest (npc-quest npc)))) + (when quest + (if (dolist (i (quest-proof-item quest)) + (unless (member i (player-item player) :test #'equalp) + (return T))) + (when (y-or-n-p "~%~A has a quest. Accept it?" npc-name) + (format t "~&~A: ~A" (string-upcase npc-name) + (quest-say-before quest))) + (when (y-or-n-p "~%Give to ~A: ~A?" npc-name + (string-from-list (quest-proof-item quest) ", ")) + (dolist (j (quest-proof-item quest)) + (remove-object-attribute player 'item j)) + (dolist (k (quest-reward-item quest)) + (set-object-attribute player 'item k)) + (add-player-experience player (quest-experience quest)) + (add-player-money player (quest-money quest)) + (format t "~&~A: ~A" (string-upcase npc-name) + (quest-say-after quest)) + (format t "~&~%Quest complete. You gain:") + (format t "~&Money: ~A Experience: ~A~&Items: ~A" + (quest-money quest) (quest-experience quest) + (string-from-list (quest-reward-item quest))))))))) (defun trade (player npc) "The player trades with this NPC" diff --git a/ATL/Lugwey/items.atl b/ATL/Lugwey/items.atl index 45e8b03..f29c37e 100644 --- a/ATL/Lugwey/items.atl +++ b/ATL/Lugwey/items.atl @@ -55,3 +55,6 @@ define-item "Bucket" description "A wooden bucket, held together by iron rims." cost 15 + +define-item "Cup of water" + description "A cup brimming full of nice, cool water..." \ No newline at end of file diff --git a/ATL/Lugwey/npcs.atl b/ATL/Lugwey/npcs.atl index 47dbee7..d66ae2d 100644 --- a/ATL/Lugwey/npcs.atl +++ b/ATL/Lugwey/npcs.atl @@ -11,13 +11,13 @@ description "An old monk, slightly hard of hearing, and looking very bored." says "Welcome, stranger! Good to see somebody here! Come on in!" -define-npc "Gardner" +define-npc "Gardener" description "A middle-aged monk with a rather dirty habit and a sweaty face." says "Hello there! Could you bring me some water? I'm really thirsty!" quest "Bring water" define-quest "Bring water" - start "Go and have a look near the kitchen, perhaps you'll find some." - end "Thank you very much for this water, I appreciate that!" + say-before "Go and have a look near the kitchen, perhaps you'll find some." + say-after "Thank you very much for this water, I appreciate that!" proof-item "Cup of water" experience 15 \ No newline at end of file diff --git a/ATL/Lugwey/places.atl b/ATL/Lugwey/places.atl index f5f4df1..9b6fefe 100644 --- a/ATL/Lugwey/places.atl +++ b/ATL/Lugwey/places.atl @@ -82,6 +82,7 @@ neighbour "Dining Hall" neighbour "Storeroom" neighbour "Beer cellar" + item "Cup of water" define-place "Storeroom" description "" @@ -100,7 +101,7 @@ keeps out unwanted visitors. A few monks are currently at work." neighbour "Monastery grounds" neighbour "Stable" - npc "Gardner" + npc "Gardener" item "Hoe" item "Bucket" diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 8e2091a..7edb8b6 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -26,7 +26,8 @@ (name "") (description "") (says "") - (sells NIL)) + (sells NIL) + (quest "")) (defstruct monster (name "") @@ -52,6 +53,14 @@ (type "") (damage 0)) +(defstruct quest + (name "") + (say-before "") + (say-after "") + (proof-item NIL) + (reward-item NIL) + (money 0) + (experience 0)) (defun set-object-attribute (game-object property value) "Set the attribute 'property' of 'game-object' to 'value'" diff --git a/lisp/interpreter.lisp b/lisp/interpreter.lisp index bd1f1ed..46232f6 100644 --- a/lisp/interpreter.lisp +++ b/lisp/interpreter.lisp @@ -11,8 +11,7 @@ ;; A list of ATL language constructs ;; (Note: not complete - each (defcommand) appends to this list) -(defvar *atl-commands* - '(load-file start-place start-money name-world)) +(defvar *atl-commands* '(load-file name-world)) (defun build-define-command (object-type) "Build a new define command function for the specified object type" @@ -38,6 +37,7 @@ (defcommand define-weapon weapon) (defcommand define-item item) (defcommand define-npc npc) +(defcommand define-quest quest) (let ((world-directory NIL) diff --git a/lisp/player.lisp b/lisp/player.lisp index daa69a8..61ca6be 100644 --- a/lisp/player.lisp +++ b/lisp/player.lisp @@ -85,3 +85,7 @@ (incf (player-experience player) amount) (when (zerop (rem (player-experience player) *level-experience*)) (incf (player-level player) player))) + +(defun add-player-money (player amount) + "Increase the player's money by amount" + (incf (player-money player) amount)) diff --git a/lisp/ui.lisp b/lisp/ui.lisp index 4f16ea6..9e76021 100644 --- a/lisp/ui.lisp +++ b/lisp/ui.lisp @@ -207,6 +207,7 @@ (clear-screen) (debugging "~&~A is going to ~A." (player-name player) location) (change-player-location player location) + (add-player-experience player 1) (describe-place location)) (defun about (player &optional object-name) @@ -240,13 +241,38 @@ (let* ((place (get-game-object 'place (player-place player))) (npc (when (member npc-name (place-npc place) :test #'equalp) (get-game-object 'npc npc-name)))) - (if npc - (progn - (format t "~&~A: ~A" (string-upcase npc-name) (npc-says npc)) - (when (and (npc-sells npc) - (y-or-n-p "Trade with ~A?" npc-name)) - (trade player npc))) - (format t "~&~A is not here!" npc-name)))) + ;; Check if the NPC is here + (unless npc + (format t "~&~A is not here!" npc-name) + (return-from talk)) + (format t "~&~A: ~A" (string-upcase npc-name) (npc-says npc)) + ;; Trade with the NPC + (when (and (npc-sells npc) + (y-or-n-p "Trade with ~A?" npc-name)) + (trade player npc)) + ;; Handle quests + (let ((quest (get-game-object 'quest (npc-quest npc)))) + (when quest + (if (dolist (i (quest-proof-item quest)) + (unless (member i (player-item player) :test #'equalp) + (return T))) + (when (y-or-n-p "~%~A has a quest. Accept it?" npc-name) + (format t "~&~A: ~A" (string-upcase npc-name) + (quest-say-before quest))) + (when (y-or-n-p "~%Give to ~A: ~A?" npc-name + (string-from-list (quest-proof-item quest) ", ")) + (dolist (j (quest-proof-item quest)) + (remove-object-attribute player 'item j)) + (dolist (k (quest-reward-item quest)) + (set-object-attribute player 'item k)) + (add-player-experience player (quest-experience quest)) + (add-player-money player (quest-money quest)) + (format t "~&~A: ~A" (string-upcase npc-name) + (quest-say-after quest)) + (format t "~&~%Quest complete. You gain:") + (format t "~&Money: ~A Experience: ~A~&Items: ~A" + (quest-money quest) (quest-experience quest) + (string-from-list (quest-reward-item quest))))))))) (defun trade (player npc) "The player trades with this NPC" diff --git a/lisp/world.lisp b/lisp/world.lisp index 2e739eb..02b33c3 100644 --- a/lisp/world.lisp +++ b/lisp/world.lisp @@ -26,6 +26,7 @@ (npcs NIL) (items NIL) (weapons NIL) + (quests NIL) (starting-place "") (starting-money 0))