diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index 44b008d..26a1174 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -12,6 +12,11 @@ description "A jar full to the brim of delicious, golden honey. Hmmmm..." command "eat" +define-item "Jar" + description "You can tell that this jar used to hold honey, but try as you + might, you can't get any more out of it now. What a shame. + Perhaps you should refill it." + define-item "Letter" description "A closed letter, addressed to Somebody in Christopher Robin's handwriting. You think it's a letter to you, but as you are just diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index 44b008d..26a1174 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -12,6 +12,11 @@ description "A jar full to the brim of delicious, golden honey. Hmmmm..." command "eat" +define-item "Jar" + description "You can tell that this jar used to hold honey, but try as you + might, you can't get any more out of it now. What a shame. + Perhaps you should refill it." + define-item "Letter" description "A closed letter, addressed to Somebody in Christopher Robin's handwriting. You think it's a letter to you, but as you are just diff --git a/ATL/Pooh/pooh-extensions.lisp b/ATL/Pooh/pooh-extensions.lisp index 4e5026e..44e6bf7 100644 --- a/ATL/Pooh/pooh-extensions.lisp +++ b/ATL/Pooh/pooh-extensions.lisp @@ -10,13 +10,23 @@ (defun eat (player &optional arg) "Allow the player to eat something." (cond ((null arg) (format t "~&What do you want to eat?")) + ;; Berries can be eaten any time, but don't have any effect ((and (equalp arg "berries") (member "berries" (player-item player) :test #'equalp)) (format t "~&Mmmh, these berries are really delicious!") (remove-object-attribute player 'item "berries")) + ;; Honey is reserved as medicine :-) ((and (or (equalp arg "hunny") (equalp arg "honey")) (member "Hunny" (player-item player) :test #'equalp)) - (format t "~&The honey looks incredibly tempting, but perhaps you should save it for later.")) + (if (> (player-health player) 10) + (format t "~&The honey looks incredibly tempting, but perhaps you should save it for later.") + (progn (format t "~&You really shouldn't, but you are feeling sore enough to eat some anyway.") + (format t "~&You stick your paw deeply into the jar, then draw it out again.") + (format t "~&Smooth golden honey runs into your mouth, making you feel much better.") + (format t "~&+10 HP") + (change-player-health player 10) + (remove-object-attribute player 'item "Hunny") + (set-object-attribute player 'item "Jar")))) (T (format t "~&You can't eat that!")))) (defun jump (player &optional arg) @@ -25,8 +35,8 @@ (if (> 50 (random 100)) (progn (format t "~&You land safely. That was fun! You gain 3 XP.") (add-player-experience player 3)) - (progn (format t "~&Ouch! That hurt! You take 3 HP fall damage.") - (change-player-health player -3))) + (progn (format t "~&Ouch! That hurt! You take 2 HP fall damage.") + (change-player-health player -2))) (read-line) (goto player "Pooh's porch")) @@ -82,12 +92,69 @@ "A wrapper function for lost-in-the-forest for the deep forest location" (lost-in-the-forest player "Deep forest" 40)) +(let ((climbed NIL)) + (defun climb (player &optional arg) + "Try to climb the bee tree. Warning: bees sting, and trees are tall ;-)" + (let ((place (get-game-object 'place (player-place player)))) + (when climbed + (if (member 'down (extract-elements arg)) + (climb-down player) + (format t "~&You are already sitting up the tree.")) + (return-from climb)) + (format t "~&You start climbing up the tree.") + ;; The player has a 60% chance of success. + (if (> 60 (random 100)) + (progn (setf climbed T) (add-player-experience player 2) + (format t "~&You make it to the top.")) + (progn (format t "~&A branch breaks beneath you! You fall into a gorse bush.") + (format t "~&You take 4 HP fall damage.") + (change-player-health player -4))) + ;; The bees attack if they are still present + (dolist (m (place-monster place)) + (when (> (monster-aggression m) (random 100)) + (format t "~&~%You are attacked by ~A!" (monster-name m)) + (attack player (monster-name m)))))) + + (defun collect (player &optional arg) + "Collect honey from the bees' nest (requires an empty jar)" + (cond ((not (member "Jar" (player-item player) :test #'equalp)) + (format t "~&If you want to collect honey, you need an empty jar!")) + ((not climbed) + (format t "~&The honey is up in the tree. You're going to need to climb it first.")) + (T ;; Collect the honey + (remove-object-attribute player 'item "Jar") + (set-object-attribute player 'item "Hunny") + (format t "~&You fill your jar with honey.") + ;; The bees attack if they are still present + (dolist (m (place-monster (get-game-object 'place (player-place player)))) + (when (> (monster-aggression m) (random 100)) + (format t "~&~%You are attacked by ~A!" (monster-name m)) + (attack player (monster-name m))))))) + + (defun climb-down (player) + "Climb down the tree." + (if climbed + (progn (format t "~&Slowly you climb back down the tree.") + (if (> 60 (random 100)) + (format t "~&You reach the ground safely.") + (progn (format t "~&You lose your grip!") + (format t "~&Well, that was rather faster than expected.") + (format t "~&You take 4 HP fall damage.") + (change-player-health player -4))) + (setf climbed NIL)) + (format t "~&You are already on the ground."))) + + (defun leave-bee-tree (player) + "Make sure you've climbed down before leaving the bee tree." + (when climbed (climb-down player)) + (read-line))) + ;; The golden ring is an easter egg referencing, of course, ;; The Lord of the Rings. (defun wear (player &optional arg) "Wear the mystical golden ring..." - (if (and arg (member 'ring (extract-elements arg))) + (if (member 'ring (extract-elements arg)) (progn (format t "~&You slip the golden ring on your finger.") (format t "~&You feel something ought to happen.~&Nothing does.")) diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index 44b008d..26a1174 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -12,6 +12,11 @@ description "A jar full to the brim of delicious, golden honey. Hmmmm..." command "eat" +define-item "Jar" + description "You can tell that this jar used to hold honey, but try as you + might, you can't get any more out of it now. What a shame. + Perhaps you should refill it." + define-item "Letter" description "A closed letter, addressed to Somebody in Christopher Robin's handwriting. You think it's a letter to you, but as you are just diff --git a/ATL/Pooh/pooh-extensions.lisp b/ATL/Pooh/pooh-extensions.lisp index 4e5026e..44e6bf7 100644 --- a/ATL/Pooh/pooh-extensions.lisp +++ b/ATL/Pooh/pooh-extensions.lisp @@ -10,13 +10,23 @@ (defun eat (player &optional arg) "Allow the player to eat something." (cond ((null arg) (format t "~&What do you want to eat?")) + ;; Berries can be eaten any time, but don't have any effect ((and (equalp arg "berries") (member "berries" (player-item player) :test #'equalp)) (format t "~&Mmmh, these berries are really delicious!") (remove-object-attribute player 'item "berries")) + ;; Honey is reserved as medicine :-) ((and (or (equalp arg "hunny") (equalp arg "honey")) (member "Hunny" (player-item player) :test #'equalp)) - (format t "~&The honey looks incredibly tempting, but perhaps you should save it for later.")) + (if (> (player-health player) 10) + (format t "~&The honey looks incredibly tempting, but perhaps you should save it for later.") + (progn (format t "~&You really shouldn't, but you are feeling sore enough to eat some anyway.") + (format t "~&You stick your paw deeply into the jar, then draw it out again.") + (format t "~&Smooth golden honey runs into your mouth, making you feel much better.") + (format t "~&+10 HP") + (change-player-health player 10) + (remove-object-attribute player 'item "Hunny") + (set-object-attribute player 'item "Jar")))) (T (format t "~&You can't eat that!")))) (defun jump (player &optional arg) @@ -25,8 +35,8 @@ (if (> 50 (random 100)) (progn (format t "~&You land safely. That was fun! You gain 3 XP.") (add-player-experience player 3)) - (progn (format t "~&Ouch! That hurt! You take 3 HP fall damage.") - (change-player-health player -3))) + (progn (format t "~&Ouch! That hurt! You take 2 HP fall damage.") + (change-player-health player -2))) (read-line) (goto player "Pooh's porch")) @@ -82,12 +92,69 @@ "A wrapper function for lost-in-the-forest for the deep forest location" (lost-in-the-forest player "Deep forest" 40)) +(let ((climbed NIL)) + (defun climb (player &optional arg) + "Try to climb the bee tree. Warning: bees sting, and trees are tall ;-)" + (let ((place (get-game-object 'place (player-place player)))) + (when climbed + (if (member 'down (extract-elements arg)) + (climb-down player) + (format t "~&You are already sitting up the tree.")) + (return-from climb)) + (format t "~&You start climbing up the tree.") + ;; The player has a 60% chance of success. + (if (> 60 (random 100)) + (progn (setf climbed T) (add-player-experience player 2) + (format t "~&You make it to the top.")) + (progn (format t "~&A branch breaks beneath you! You fall into a gorse bush.") + (format t "~&You take 4 HP fall damage.") + (change-player-health player -4))) + ;; The bees attack if they are still present + (dolist (m (place-monster place)) + (when (> (monster-aggression m) (random 100)) + (format t "~&~%You are attacked by ~A!" (monster-name m)) + (attack player (monster-name m)))))) + + (defun collect (player &optional arg) + "Collect honey from the bees' nest (requires an empty jar)" + (cond ((not (member "Jar" (player-item player) :test #'equalp)) + (format t "~&If you want to collect honey, you need an empty jar!")) + ((not climbed) + (format t "~&The honey is up in the tree. You're going to need to climb it first.")) + (T ;; Collect the honey + (remove-object-attribute player 'item "Jar") + (set-object-attribute player 'item "Hunny") + (format t "~&You fill your jar with honey.") + ;; The bees attack if they are still present + (dolist (m (place-monster (get-game-object 'place (player-place player)))) + (when (> (monster-aggression m) (random 100)) + (format t "~&~%You are attacked by ~A!" (monster-name m)) + (attack player (monster-name m))))))) + + (defun climb-down (player) + "Climb down the tree." + (if climbed + (progn (format t "~&Slowly you climb back down the tree.") + (if (> 60 (random 100)) + (format t "~&You reach the ground safely.") + (progn (format t "~&You lose your grip!") + (format t "~&Well, that was rather faster than expected.") + (format t "~&You take 4 HP fall damage.") + (change-player-health player -4))) + (setf climbed NIL)) + (format t "~&You are already on the ground."))) + + (defun leave-bee-tree (player) + "Make sure you've climbed down before leaving the bee tree." + (when climbed (climb-down player)) + (read-line))) + ;; The golden ring is an easter egg referencing, of course, ;; The Lord of the Rings. (defun wear (player &optional arg) "Wear the mystical golden ring..." - (if (and arg (member 'ring (extract-elements arg))) + (if (member 'ring (extract-elements arg)) (progn (format t "~&You slip the golden ring on your finger.") (format t "~&You feel something ought to happen.~&Nothing does.")) diff --git a/ATL/Pooh/pooh.atl b/ATL/Pooh/pooh.atl index 9c5fa1a..f52a6be 100644 --- a/ATL/Pooh/pooh.atl +++ b/ATL/Pooh/pooh.atl @@ -15,6 +15,7 @@ define-player "Winnie the Pooh" description "A small but lovable bear of Very Little Brain." ;place "Pooh's home" + item "Jar" place "Northern woods" max-health 20 health 20 diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index 44b008d..26a1174 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -12,6 +12,11 @@ description "A jar full to the brim of delicious, golden honey. Hmmmm..." command "eat" +define-item "Jar" + description "You can tell that this jar used to hold honey, but try as you + might, you can't get any more out of it now. What a shame. + Perhaps you should refill it." + define-item "Letter" description "A closed letter, addressed to Somebody in Christopher Robin's handwriting. You think it's a letter to you, but as you are just diff --git a/ATL/Pooh/pooh-extensions.lisp b/ATL/Pooh/pooh-extensions.lisp index 4e5026e..44e6bf7 100644 --- a/ATL/Pooh/pooh-extensions.lisp +++ b/ATL/Pooh/pooh-extensions.lisp @@ -10,13 +10,23 @@ (defun eat (player &optional arg) "Allow the player to eat something." (cond ((null arg) (format t "~&What do you want to eat?")) + ;; Berries can be eaten any time, but don't have any effect ((and (equalp arg "berries") (member "berries" (player-item player) :test #'equalp)) (format t "~&Mmmh, these berries are really delicious!") (remove-object-attribute player 'item "berries")) + ;; Honey is reserved as medicine :-) ((and (or (equalp arg "hunny") (equalp arg "honey")) (member "Hunny" (player-item player) :test #'equalp)) - (format t "~&The honey looks incredibly tempting, but perhaps you should save it for later.")) + (if (> (player-health player) 10) + (format t "~&The honey looks incredibly tempting, but perhaps you should save it for later.") + (progn (format t "~&You really shouldn't, but you are feeling sore enough to eat some anyway.") + (format t "~&You stick your paw deeply into the jar, then draw it out again.") + (format t "~&Smooth golden honey runs into your mouth, making you feel much better.") + (format t "~&+10 HP") + (change-player-health player 10) + (remove-object-attribute player 'item "Hunny") + (set-object-attribute player 'item "Jar")))) (T (format t "~&You can't eat that!")))) (defun jump (player &optional arg) @@ -25,8 +35,8 @@ (if (> 50 (random 100)) (progn (format t "~&You land safely. That was fun! You gain 3 XP.") (add-player-experience player 3)) - (progn (format t "~&Ouch! That hurt! You take 3 HP fall damage.") - (change-player-health player -3))) + (progn (format t "~&Ouch! That hurt! You take 2 HP fall damage.") + (change-player-health player -2))) (read-line) (goto player "Pooh's porch")) @@ -82,12 +92,69 @@ "A wrapper function for lost-in-the-forest for the deep forest location" (lost-in-the-forest player "Deep forest" 40)) +(let ((climbed NIL)) + (defun climb (player &optional arg) + "Try to climb the bee tree. Warning: bees sting, and trees are tall ;-)" + (let ((place (get-game-object 'place (player-place player)))) + (when climbed + (if (member 'down (extract-elements arg)) + (climb-down player) + (format t "~&You are already sitting up the tree.")) + (return-from climb)) + (format t "~&You start climbing up the tree.") + ;; The player has a 60% chance of success. + (if (> 60 (random 100)) + (progn (setf climbed T) (add-player-experience player 2) + (format t "~&You make it to the top.")) + (progn (format t "~&A branch breaks beneath you! You fall into a gorse bush.") + (format t "~&You take 4 HP fall damage.") + (change-player-health player -4))) + ;; The bees attack if they are still present + (dolist (m (place-monster place)) + (when (> (monster-aggression m) (random 100)) + (format t "~&~%You are attacked by ~A!" (monster-name m)) + (attack player (monster-name m)))))) + + (defun collect (player &optional arg) + "Collect honey from the bees' nest (requires an empty jar)" + (cond ((not (member "Jar" (player-item player) :test #'equalp)) + (format t "~&If you want to collect honey, you need an empty jar!")) + ((not climbed) + (format t "~&The honey is up in the tree. You're going to need to climb it first.")) + (T ;; Collect the honey + (remove-object-attribute player 'item "Jar") + (set-object-attribute player 'item "Hunny") + (format t "~&You fill your jar with honey.") + ;; The bees attack if they are still present + (dolist (m (place-monster (get-game-object 'place (player-place player)))) + (when (> (monster-aggression m) (random 100)) + (format t "~&~%You are attacked by ~A!" (monster-name m)) + (attack player (monster-name m))))))) + + (defun climb-down (player) + "Climb down the tree." + (if climbed + (progn (format t "~&Slowly you climb back down the tree.") + (if (> 60 (random 100)) + (format t "~&You reach the ground safely.") + (progn (format t "~&You lose your grip!") + (format t "~&Well, that was rather faster than expected.") + (format t "~&You take 4 HP fall damage.") + (change-player-health player -4))) + (setf climbed NIL)) + (format t "~&You are already on the ground."))) + + (defun leave-bee-tree (player) + "Make sure you've climbed down before leaving the bee tree." + (when climbed (climb-down player)) + (read-line))) + ;; The golden ring is an easter egg referencing, of course, ;; The Lord of the Rings. (defun wear (player &optional arg) "Wear the mystical golden ring..." - (if (and arg (member 'ring (extract-elements arg))) + (if (member 'ring (extract-elements arg)) (progn (format t "~&You slip the golden ring on your finger.") (format t "~&You feel something ought to happen.~&Nothing does.")) diff --git a/ATL/Pooh/pooh.atl b/ATL/Pooh/pooh.atl index 9c5fa1a..f52a6be 100644 --- a/ATL/Pooh/pooh.atl +++ b/ATL/Pooh/pooh.atl @@ -15,6 +15,7 @@ define-player "Winnie the Pooh" description "A small but lovable bear of Very Little Brain." ;place "Pooh's home" + item "Jar" place "Northern woods" max-health 20 health 20 diff --git a/ATL/Pooh/woods.atl b/ATL/Pooh/woods.atl index 2a996fe..46508aa 100644 --- a/ATL/Pooh/woods.atl +++ b/ATL/Pooh/woods.atl @@ -13,6 +13,7 @@ neighbour "Pooh's porch" neighbour "Pooh's branch" item "Hunny" + item "Jar" item "Letter" hidden "Lamp" ;XXX development @@ -200,9 +201,15 @@ monster "Heffalump" define-place "Bee tree" - description "TODO" + description "In an open place in the middle of the forest, a large oak stands + all by itself. A loud buzzing fills the air. Looking up, you see + a lot of bees flying in and out of a hole far up the tree trunk. + If you could get up there, there's sure to be some honey there!" neighbour "Northern woods" monster "Bees" + command "climb" + command "collect" + exit-hook "leave-bee-tree" define-place "Rabbit's house" description "TODO" diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index 44b008d..26a1174 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -12,6 +12,11 @@ description "A jar full to the brim of delicious, golden honey. Hmmmm..." command "eat" +define-item "Jar" + description "You can tell that this jar used to hold honey, but try as you + might, you can't get any more out of it now. What a shame. + Perhaps you should refill it." + define-item "Letter" description "A closed letter, addressed to Somebody in Christopher Robin's handwriting. You think it's a letter to you, but as you are just diff --git a/ATL/Pooh/pooh-extensions.lisp b/ATL/Pooh/pooh-extensions.lisp index 4e5026e..44e6bf7 100644 --- a/ATL/Pooh/pooh-extensions.lisp +++ b/ATL/Pooh/pooh-extensions.lisp @@ -10,13 +10,23 @@ (defun eat (player &optional arg) "Allow the player to eat something." (cond ((null arg) (format t "~&What do you want to eat?")) + ;; Berries can be eaten any time, but don't have any effect ((and (equalp arg "berries") (member "berries" (player-item player) :test #'equalp)) (format t "~&Mmmh, these berries are really delicious!") (remove-object-attribute player 'item "berries")) + ;; Honey is reserved as medicine :-) ((and (or (equalp arg "hunny") (equalp arg "honey")) (member "Hunny" (player-item player) :test #'equalp)) - (format t "~&The honey looks incredibly tempting, but perhaps you should save it for later.")) + (if (> (player-health player) 10) + (format t "~&The honey looks incredibly tempting, but perhaps you should save it for later.") + (progn (format t "~&You really shouldn't, but you are feeling sore enough to eat some anyway.") + (format t "~&You stick your paw deeply into the jar, then draw it out again.") + (format t "~&Smooth golden honey runs into your mouth, making you feel much better.") + (format t "~&+10 HP") + (change-player-health player 10) + (remove-object-attribute player 'item "Hunny") + (set-object-attribute player 'item "Jar")))) (T (format t "~&You can't eat that!")))) (defun jump (player &optional arg) @@ -25,8 +35,8 @@ (if (> 50 (random 100)) (progn (format t "~&You land safely. That was fun! You gain 3 XP.") (add-player-experience player 3)) - (progn (format t "~&Ouch! That hurt! You take 3 HP fall damage.") - (change-player-health player -3))) + (progn (format t "~&Ouch! That hurt! You take 2 HP fall damage.") + (change-player-health player -2))) (read-line) (goto player "Pooh's porch")) @@ -82,12 +92,69 @@ "A wrapper function for lost-in-the-forest for the deep forest location" (lost-in-the-forest player "Deep forest" 40)) +(let ((climbed NIL)) + (defun climb (player &optional arg) + "Try to climb the bee tree. Warning: bees sting, and trees are tall ;-)" + (let ((place (get-game-object 'place (player-place player)))) + (when climbed + (if (member 'down (extract-elements arg)) + (climb-down player) + (format t "~&You are already sitting up the tree.")) + (return-from climb)) + (format t "~&You start climbing up the tree.") + ;; The player has a 60% chance of success. + (if (> 60 (random 100)) + (progn (setf climbed T) (add-player-experience player 2) + (format t "~&You make it to the top.")) + (progn (format t "~&A branch breaks beneath you! You fall into a gorse bush.") + (format t "~&You take 4 HP fall damage.") + (change-player-health player -4))) + ;; The bees attack if they are still present + (dolist (m (place-monster place)) + (when (> (monster-aggression m) (random 100)) + (format t "~&~%You are attacked by ~A!" (monster-name m)) + (attack player (monster-name m)))))) + + (defun collect (player &optional arg) + "Collect honey from the bees' nest (requires an empty jar)" + (cond ((not (member "Jar" (player-item player) :test #'equalp)) + (format t "~&If you want to collect honey, you need an empty jar!")) + ((not climbed) + (format t "~&The honey is up in the tree. You're going to need to climb it first.")) + (T ;; Collect the honey + (remove-object-attribute player 'item "Jar") + (set-object-attribute player 'item "Hunny") + (format t "~&You fill your jar with honey.") + ;; The bees attack if they are still present + (dolist (m (place-monster (get-game-object 'place (player-place player)))) + (when (> (monster-aggression m) (random 100)) + (format t "~&~%You are attacked by ~A!" (monster-name m)) + (attack player (monster-name m))))))) + + (defun climb-down (player) + "Climb down the tree." + (if climbed + (progn (format t "~&Slowly you climb back down the tree.") + (if (> 60 (random 100)) + (format t "~&You reach the ground safely.") + (progn (format t "~&You lose your grip!") + (format t "~&Well, that was rather faster than expected.") + (format t "~&You take 4 HP fall damage.") + (change-player-health player -4))) + (setf climbed NIL)) + (format t "~&You are already on the ground."))) + + (defun leave-bee-tree (player) + "Make sure you've climbed down before leaving the bee tree." + (when climbed (climb-down player)) + (read-line))) + ;; The golden ring is an easter egg referencing, of course, ;; The Lord of the Rings. (defun wear (player &optional arg) "Wear the mystical golden ring..." - (if (and arg (member 'ring (extract-elements arg))) + (if (member 'ring (extract-elements arg)) (progn (format t "~&You slip the golden ring on your finger.") (format t "~&You feel something ought to happen.~&Nothing does.")) diff --git a/ATL/Pooh/pooh.atl b/ATL/Pooh/pooh.atl index 9c5fa1a..f52a6be 100644 --- a/ATL/Pooh/pooh.atl +++ b/ATL/Pooh/pooh.atl @@ -15,6 +15,7 @@ define-player "Winnie the Pooh" description "A small but lovable bear of Very Little Brain." ;place "Pooh's home" + item "Jar" place "Northern woods" max-health 20 health 20 diff --git a/ATL/Pooh/woods.atl b/ATL/Pooh/woods.atl index 2a996fe..46508aa 100644 --- a/ATL/Pooh/woods.atl +++ b/ATL/Pooh/woods.atl @@ -13,6 +13,7 @@ neighbour "Pooh's porch" neighbour "Pooh's branch" item "Hunny" + item "Jar" item "Letter" hidden "Lamp" ;XXX development @@ -200,9 +201,15 @@ monster "Heffalump" define-place "Bee tree" - description "TODO" + description "In an open place in the middle of the forest, a large oak stands + all by itself. A loud buzzing fills the air. Looking up, you see + a lot of bees flying in and out of a hole far up the tree trunk. + If you could get up there, there's sure to be some honey there!" neighbour "Northern woods" monster "Bees" + command "climb" + command "collect" + exit-hook "leave-bee-tree" define-place "Rabbit's house" description "TODO" diff --git a/lisp/ui.lisp b/lisp/ui.lisp index 628b96d..21c84de 100644 --- a/lisp/ui.lisp +++ b/lisp/ui.lisp @@ -52,7 +52,7 @@ ;; Check default commands (cmd-fn (when (member command *commands* :test #'eq) command))) ;; Search for place commands - (when (member cmd + (when (member (to-string command) (place-command (get-game-object 'place (player-place player))) :test #'equalp) (setf cmd-fn command)) @@ -119,7 +119,7 @@ ;; TODO update (let ((tab (string #\tab))) (when (stringp p) (setf p (get-game-object 'player p))) - (format t "~&Player ~A:" (player-name p)) + (format t "~&~A" (string-upcase (player-name p))) (format t "~&~%Current place: ~A" (player-place p)) (format t "~&=====~&Attributes:") (format t "~&Intelligence: ~A~AStrength: ~A" @@ -180,6 +180,7 @@ (format t "~&You cannot enter this place unless you have: ~A" req) (return-from goto)))) ;; Change places + (setf location (string-capitalize location)) (let ((hook (place-exit-hook (get-game-object 'place (player-place player))))) ;exit hook (unless (zerop (length hook)) (funcall (read-from-string hook) player))) (clear-screen) @@ -340,6 +341,7 @@ (format t "~&Please specify an item to pick up!") (return-from take)) (let ((place (get-game-object 'place (player-place player))) + (item-name (string-capitalize item-name)) (item (get-game-object 'item item-name))) (if (member item-name (place-item place) :test #'equalp) (if (item-fixed item) @@ -362,6 +364,7 @@ (unless item (format t "~&Please specify an item to drop!") (return-from drop)) + (setf item (string-capitalize item)) (if (member item (player-item player) :test #'equalp) (progn (remove-object-attribute player 'item item) diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index 44b008d..26a1174 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -12,6 +12,11 @@ description "A jar full to the brim of delicious, golden honey. Hmmmm..." command "eat" +define-item "Jar" + description "You can tell that this jar used to hold honey, but try as you + might, you can't get any more out of it now. What a shame. + Perhaps you should refill it." + define-item "Letter" description "A closed letter, addressed to Somebody in Christopher Robin's handwriting. You think it's a letter to you, but as you are just diff --git a/ATL/Pooh/pooh-extensions.lisp b/ATL/Pooh/pooh-extensions.lisp index 4e5026e..44e6bf7 100644 --- a/ATL/Pooh/pooh-extensions.lisp +++ b/ATL/Pooh/pooh-extensions.lisp @@ -10,13 +10,23 @@ (defun eat (player &optional arg) "Allow the player to eat something." (cond ((null arg) (format t "~&What do you want to eat?")) + ;; Berries can be eaten any time, but don't have any effect ((and (equalp arg "berries") (member "berries" (player-item player) :test #'equalp)) (format t "~&Mmmh, these berries are really delicious!") (remove-object-attribute player 'item "berries")) + ;; Honey is reserved as medicine :-) ((and (or (equalp arg "hunny") (equalp arg "honey")) (member "Hunny" (player-item player) :test #'equalp)) - (format t "~&The honey looks incredibly tempting, but perhaps you should save it for later.")) + (if (> (player-health player) 10) + (format t "~&The honey looks incredibly tempting, but perhaps you should save it for later.") + (progn (format t "~&You really shouldn't, but you are feeling sore enough to eat some anyway.") + (format t "~&You stick your paw deeply into the jar, then draw it out again.") + (format t "~&Smooth golden honey runs into your mouth, making you feel much better.") + (format t "~&+10 HP") + (change-player-health player 10) + (remove-object-attribute player 'item "Hunny") + (set-object-attribute player 'item "Jar")))) (T (format t "~&You can't eat that!")))) (defun jump (player &optional arg) @@ -25,8 +35,8 @@ (if (> 50 (random 100)) (progn (format t "~&You land safely. That was fun! You gain 3 XP.") (add-player-experience player 3)) - (progn (format t "~&Ouch! That hurt! You take 3 HP fall damage.") - (change-player-health player -3))) + (progn (format t "~&Ouch! That hurt! You take 2 HP fall damage.") + (change-player-health player -2))) (read-line) (goto player "Pooh's porch")) @@ -82,12 +92,69 @@ "A wrapper function for lost-in-the-forest for the deep forest location" (lost-in-the-forest player "Deep forest" 40)) +(let ((climbed NIL)) + (defun climb (player &optional arg) + "Try to climb the bee tree. Warning: bees sting, and trees are tall ;-)" + (let ((place (get-game-object 'place (player-place player)))) + (when climbed + (if (member 'down (extract-elements arg)) + (climb-down player) + (format t "~&You are already sitting up the tree.")) + (return-from climb)) + (format t "~&You start climbing up the tree.") + ;; The player has a 60% chance of success. + (if (> 60 (random 100)) + (progn (setf climbed T) (add-player-experience player 2) + (format t "~&You make it to the top.")) + (progn (format t "~&A branch breaks beneath you! You fall into a gorse bush.") + (format t "~&You take 4 HP fall damage.") + (change-player-health player -4))) + ;; The bees attack if they are still present + (dolist (m (place-monster place)) + (when (> (monster-aggression m) (random 100)) + (format t "~&~%You are attacked by ~A!" (monster-name m)) + (attack player (monster-name m)))))) + + (defun collect (player &optional arg) + "Collect honey from the bees' nest (requires an empty jar)" + (cond ((not (member "Jar" (player-item player) :test #'equalp)) + (format t "~&If you want to collect honey, you need an empty jar!")) + ((not climbed) + (format t "~&The honey is up in the tree. You're going to need to climb it first.")) + (T ;; Collect the honey + (remove-object-attribute player 'item "Jar") + (set-object-attribute player 'item "Hunny") + (format t "~&You fill your jar with honey.") + ;; The bees attack if they are still present + (dolist (m (place-monster (get-game-object 'place (player-place player)))) + (when (> (monster-aggression m) (random 100)) + (format t "~&~%You are attacked by ~A!" (monster-name m)) + (attack player (monster-name m))))))) + + (defun climb-down (player) + "Climb down the tree." + (if climbed + (progn (format t "~&Slowly you climb back down the tree.") + (if (> 60 (random 100)) + (format t "~&You reach the ground safely.") + (progn (format t "~&You lose your grip!") + (format t "~&Well, that was rather faster than expected.") + (format t "~&You take 4 HP fall damage.") + (change-player-health player -4))) + (setf climbed NIL)) + (format t "~&You are already on the ground."))) + + (defun leave-bee-tree (player) + "Make sure you've climbed down before leaving the bee tree." + (when climbed (climb-down player)) + (read-line))) + ;; The golden ring is an easter egg referencing, of course, ;; The Lord of the Rings. (defun wear (player &optional arg) "Wear the mystical golden ring..." - (if (and arg (member 'ring (extract-elements arg))) + (if (member 'ring (extract-elements arg)) (progn (format t "~&You slip the golden ring on your finger.") (format t "~&You feel something ought to happen.~&Nothing does.")) diff --git a/ATL/Pooh/pooh.atl b/ATL/Pooh/pooh.atl index 9c5fa1a..f52a6be 100644 --- a/ATL/Pooh/pooh.atl +++ b/ATL/Pooh/pooh.atl @@ -15,6 +15,7 @@ define-player "Winnie the Pooh" description "A small but lovable bear of Very Little Brain." ;place "Pooh's home" + item "Jar" place "Northern woods" max-health 20 health 20 diff --git a/ATL/Pooh/woods.atl b/ATL/Pooh/woods.atl index 2a996fe..46508aa 100644 --- a/ATL/Pooh/woods.atl +++ b/ATL/Pooh/woods.atl @@ -13,6 +13,7 @@ neighbour "Pooh's porch" neighbour "Pooh's branch" item "Hunny" + item "Jar" item "Letter" hidden "Lamp" ;XXX development @@ -200,9 +201,15 @@ monster "Heffalump" define-place "Bee tree" - description "TODO" + description "In an open place in the middle of the forest, a large oak stands + all by itself. A loud buzzing fills the air. Looking up, you see + a lot of bees flying in and out of a hole far up the tree trunk. + If you could get up there, there's sure to be some honey there!" neighbour "Northern woods" monster "Bees" + command "climb" + command "collect" + exit-hook "leave-bee-tree" define-place "Rabbit's house" description "TODO" diff --git a/lisp/ui.lisp b/lisp/ui.lisp index 628b96d..21c84de 100644 --- a/lisp/ui.lisp +++ b/lisp/ui.lisp @@ -52,7 +52,7 @@ ;; Check default commands (cmd-fn (when (member command *commands* :test #'eq) command))) ;; Search for place commands - (when (member cmd + (when (member (to-string command) (place-command (get-game-object 'place (player-place player))) :test #'equalp) (setf cmd-fn command)) @@ -119,7 +119,7 @@ ;; TODO update (let ((tab (string #\tab))) (when (stringp p) (setf p (get-game-object 'player p))) - (format t "~&Player ~A:" (player-name p)) + (format t "~&~A" (string-upcase (player-name p))) (format t "~&~%Current place: ~A" (player-place p)) (format t "~&=====~&Attributes:") (format t "~&Intelligence: ~A~AStrength: ~A" @@ -180,6 +180,7 @@ (format t "~&You cannot enter this place unless you have: ~A" req) (return-from goto)))) ;; Change places + (setf location (string-capitalize location)) (let ((hook (place-exit-hook (get-game-object 'place (player-place player))))) ;exit hook (unless (zerop (length hook)) (funcall (read-from-string hook) player))) (clear-screen) @@ -340,6 +341,7 @@ (format t "~&Please specify an item to pick up!") (return-from take)) (let ((place (get-game-object 'place (player-place player))) + (item-name (string-capitalize item-name)) (item (get-game-object 'item item-name))) (if (member item-name (place-item place) :test #'equalp) (if (item-fixed item) @@ -362,6 +364,7 @@ (unless item (format t "~&Please specify an item to drop!") (return-from drop)) + (setf item (string-capitalize item)) (if (member item (player-item player) :test #'equalp) (progn (remove-object-attribute player 'item item) diff --git a/lisp/util.lisp b/lisp/util.lisp index 26115f1..0de81ba 100644 --- a/lisp/util.lisp +++ b/lisp/util.lisp @@ -161,6 +161,7 @@ (defun extract-elements (str) "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (when (null str) (return-from extract-elements)) (multiple-value-bind (next-element i) (read-from-string str nil) (if (null next-element) NIL (cons next-element