diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index b1463ac..44b008d 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -123,6 +123,7 @@ constant bouncing can be incredibly irritating, but he is very loyal and too friendly to really dislike." says "Watch out, HERE I COME!!!" + says "Heads up! Tigger coming through!" interaction-hook "bouncy-tigger" define-npc "Owl" @@ -243,4 +244,13 @@ strength 1 dexterity 1 item "Hunny" - death-msg "The Heffalump runs away." ;TODO \ No newline at end of file + death-msg "The Heffalump runs away." ;TODO + +define-monster "Bees" + description "A swarm of hundreds of fiercely buzzing bees. You don't want + to mess with them!" + health 5 + strength 5 + dexterity 10 + aggression 80 + \ No newline at end of file diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index b1463ac..44b008d 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -123,6 +123,7 @@ constant bouncing can be incredibly irritating, but he is very loyal and too friendly to really dislike." says "Watch out, HERE I COME!!!" + says "Heads up! Tigger coming through!" interaction-hook "bouncy-tigger" define-npc "Owl" @@ -243,4 +244,13 @@ strength 1 dexterity 1 item "Hunny" - death-msg "The Heffalump runs away." ;TODO \ No newline at end of file + death-msg "The Heffalump runs away." ;TODO + +define-monster "Bees" + description "A swarm of hundreds of fiercely buzzing bees. You don't want + to mess with them!" + health 5 + strength 5 + dexterity 10 + aggression 80 + \ No newline at end of file diff --git a/ATL/Pooh/pooh.atl b/ATL/Pooh/pooh.atl index bf0ffa7..9c5fa1a 100644 --- a/ATL/Pooh/pooh.atl +++ b/ATL/Pooh/pooh.atl @@ -14,7 +14,8 @@ define-player "Winnie the Pooh" description "A small but lovable bear of Very Little Brain." - place "Pooh's home" + ;place "Pooh's home" + place "Northern woods" max-health 20 health 20 strength 1 diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index b1463ac..44b008d 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -123,6 +123,7 @@ constant bouncing can be incredibly irritating, but he is very loyal and too friendly to really dislike." says "Watch out, HERE I COME!!!" + says "Heads up! Tigger coming through!" interaction-hook "bouncy-tigger" define-npc "Owl" @@ -243,4 +244,13 @@ strength 1 dexterity 1 item "Hunny" - death-msg "The Heffalump runs away." ;TODO \ No newline at end of file + death-msg "The Heffalump runs away." ;TODO + +define-monster "Bees" + description "A swarm of hundreds of fiercely buzzing bees. You don't want + to mess with them!" + health 5 + strength 5 + dexterity 10 + aggression 80 + \ No newline at end of file diff --git a/ATL/Pooh/pooh.atl b/ATL/Pooh/pooh.atl index bf0ffa7..9c5fa1a 100644 --- a/ATL/Pooh/pooh.atl +++ b/ATL/Pooh/pooh.atl @@ -14,7 +14,8 @@ define-player "Winnie the Pooh" description "A small but lovable bear of Very Little Brain." - place "Pooh's home" + ;place "Pooh's home" + place "Northern woods" max-health 20 health 20 strength 1 diff --git a/ATL/Pooh/woods.atl b/ATL/Pooh/woods.atl index 64314e4..2a996fe 100644 --- a/ATL/Pooh/woods.atl +++ b/ATL/Pooh/woods.atl @@ -202,6 +202,7 @@ define-place "Bee tree" description "TODO" neighbour "Northern woods" + monster "Bees" define-place "Rabbit's house" description "TODO" diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index b1463ac..44b008d 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -123,6 +123,7 @@ constant bouncing can be incredibly irritating, but he is very loyal and too friendly to really dislike." says "Watch out, HERE I COME!!!" + says "Heads up! Tigger coming through!" interaction-hook "bouncy-tigger" define-npc "Owl" @@ -243,4 +244,13 @@ strength 1 dexterity 1 item "Hunny" - death-msg "The Heffalump runs away." ;TODO \ No newline at end of file + death-msg "The Heffalump runs away." ;TODO + +define-monster "Bees" + description "A swarm of hundreds of fiercely buzzing bees. You don't want + to mess with them!" + health 5 + strength 5 + dexterity 10 + aggression 80 + \ No newline at end of file diff --git a/ATL/Pooh/pooh.atl b/ATL/Pooh/pooh.atl index bf0ffa7..9c5fa1a 100644 --- a/ATL/Pooh/pooh.atl +++ b/ATL/Pooh/pooh.atl @@ -14,7 +14,8 @@ define-player "Winnie the Pooh" description "A small but lovable bear of Very Little Brain." - place "Pooh's home" + ;place "Pooh's home" + place "Northern woods" max-health 20 health 20 strength 1 diff --git a/ATL/Pooh/woods.atl b/ATL/Pooh/woods.atl index 64314e4..2a996fe 100644 --- a/ATL/Pooh/woods.atl +++ b/ATL/Pooh/woods.atl @@ -202,6 +202,7 @@ define-place "Bee tree" description "TODO" neighbour "Northern woods" + monster "Bees" define-place "Rabbit's house" description "TODO" diff --git a/doc/TODO b/doc/TODO index a4ca23d..c8e37b6 100644 --- a/doc/TODO +++ b/doc/TODO @@ -5,4 +5,3 @@ * require XP minimum to finish game? * think of more quests * integrate the quests to lead the player through the game -* integrate monster aggression diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index b1463ac..44b008d 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -123,6 +123,7 @@ constant bouncing can be incredibly irritating, but he is very loyal and too friendly to really dislike." says "Watch out, HERE I COME!!!" + says "Heads up! Tigger coming through!" interaction-hook "bouncy-tigger" define-npc "Owl" @@ -243,4 +244,13 @@ strength 1 dexterity 1 item "Hunny" - death-msg "The Heffalump runs away." ;TODO \ No newline at end of file + death-msg "The Heffalump runs away." ;TODO + +define-monster "Bees" + description "A swarm of hundreds of fiercely buzzing bees. You don't want + to mess with them!" + health 5 + strength 5 + dexterity 10 + aggression 80 + \ No newline at end of file diff --git a/ATL/Pooh/pooh.atl b/ATL/Pooh/pooh.atl index bf0ffa7..9c5fa1a 100644 --- a/ATL/Pooh/pooh.atl +++ b/ATL/Pooh/pooh.atl @@ -14,7 +14,8 @@ define-player "Winnie the Pooh" description "A small but lovable bear of Very Little Brain." - place "Pooh's home" + ;place "Pooh's home" + place "Northern woods" max-health 20 health 20 strength 1 diff --git a/ATL/Pooh/woods.atl b/ATL/Pooh/woods.atl index 64314e4..2a996fe 100644 --- a/ATL/Pooh/woods.atl +++ b/ATL/Pooh/woods.atl @@ -202,6 +202,7 @@ define-place "Bee tree" description "TODO" neighbour "Northern woods" + monster "Bees" define-place "Rabbit's house" description "TODO" diff --git a/doc/TODO b/doc/TODO index a4ca23d..c8e37b6 100644 --- a/doc/TODO +++ b/doc/TODO @@ -5,4 +5,3 @@ * require XP minimum to finish game? * think of more quests * integrate the quests to lead the player through the game -* integrate monster aggression diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index ade565f..f54c418 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -28,7 +28,7 @@ (defstruct npc (name "") (description "") - (says "") + (says NIL) (sells NIL) (buys NIL) (quest "") diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index b1463ac..44b008d 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -123,6 +123,7 @@ constant bouncing can be incredibly irritating, but he is very loyal and too friendly to really dislike." says "Watch out, HERE I COME!!!" + says "Heads up! Tigger coming through!" interaction-hook "bouncy-tigger" define-npc "Owl" @@ -243,4 +244,13 @@ strength 1 dexterity 1 item "Hunny" - death-msg "The Heffalump runs away." ;TODO \ No newline at end of file + death-msg "The Heffalump runs away." ;TODO + +define-monster "Bees" + description "A swarm of hundreds of fiercely buzzing bees. You don't want + to mess with them!" + health 5 + strength 5 + dexterity 10 + aggression 80 + \ No newline at end of file diff --git a/ATL/Pooh/pooh.atl b/ATL/Pooh/pooh.atl index bf0ffa7..9c5fa1a 100644 --- a/ATL/Pooh/pooh.atl +++ b/ATL/Pooh/pooh.atl @@ -14,7 +14,8 @@ define-player "Winnie the Pooh" description "A small but lovable bear of Very Little Brain." - place "Pooh's home" + ;place "Pooh's home" + place "Northern woods" max-health 20 health 20 strength 1 diff --git a/ATL/Pooh/woods.atl b/ATL/Pooh/woods.atl index 64314e4..2a996fe 100644 --- a/ATL/Pooh/woods.atl +++ b/ATL/Pooh/woods.atl @@ -202,6 +202,7 @@ define-place "Bee tree" description "TODO" neighbour "Northern woods" + monster "Bees" define-place "Rabbit's house" description "TODO" diff --git a/doc/TODO b/doc/TODO index a4ca23d..c8e37b6 100644 --- a/doc/TODO +++ b/doc/TODO @@ -5,4 +5,3 @@ * require XP minimum to finish game? * think of more quests * integrate the quests to lead the player through the game -* integrate monster aggression diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index ade565f..f54c418 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -28,7 +28,7 @@ (defstruct npc (name "") (description "") - (says "") + (says NIL) (sells NIL) (buys NIL) (quest "") diff --git a/lisp/ui.lisp b/lisp/ui.lisp index 713b833..628b96d 100644 --- a/lisp/ui.lisp +++ b/lisp/ui.lisp @@ -189,7 +189,12 @@ (let ((hook (place-entry-hook (get-game-object 'place location)))) ;entry hook (unless (zerop (length hook)) (funcall (read-from-string hook) player))) (add-player-experience player 1) - (describe-place (player-place player))) + (describe-place (player-place player)) + ;; Aggressive monsters attack + (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 look (player &optional object-name) "Print a description of this object" @@ -206,7 +211,7 @@ (setf description (item-description (get-game-object 'item object-name)))) (if description - (format t "~&(~A) ~A" object-name description) + (format t "~&(~A) ~A" (string-capitalize object-name) description) (format t "~&Could not find ~A!" object-name)))) (defun search (player &optional arg) @@ -231,14 +236,17 @@ (let ((split-name (cut-string npc-name 3))) (when (equalp (first split-name) "to ") (setf npc-name (second split-name)))) - (let* ((place (get-game-object 'place (player-place player))) + (let* ((npc-name (string-capitalize npc-name)) + (place (get-game-object 'place (player-place player))) (npc (when (member npc-name (place-npc place) :test #'equalp) (get-game-object 'npc 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)) + ;; The NPC says one of its lines + (format t "~&~A: ~A" (string-upcase npc-name) + (random-elt (npc-says npc))) ;; Interaction hook (let ((hook (npc-interaction-hook npc))) (unless (zerop (length hook)) diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index b1463ac..44b008d 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -123,6 +123,7 @@ constant bouncing can be incredibly irritating, but he is very loyal and too friendly to really dislike." says "Watch out, HERE I COME!!!" + says "Heads up! Tigger coming through!" interaction-hook "bouncy-tigger" define-npc "Owl" @@ -243,4 +244,13 @@ strength 1 dexterity 1 item "Hunny" - death-msg "The Heffalump runs away." ;TODO \ No newline at end of file + death-msg "The Heffalump runs away." ;TODO + +define-monster "Bees" + description "A swarm of hundreds of fiercely buzzing bees. You don't want + to mess with them!" + health 5 + strength 5 + dexterity 10 + aggression 80 + \ No newline at end of file diff --git a/ATL/Pooh/pooh.atl b/ATL/Pooh/pooh.atl index bf0ffa7..9c5fa1a 100644 --- a/ATL/Pooh/pooh.atl +++ b/ATL/Pooh/pooh.atl @@ -14,7 +14,8 @@ define-player "Winnie the Pooh" description "A small but lovable bear of Very Little Brain." - place "Pooh's home" + ;place "Pooh's home" + place "Northern woods" max-health 20 health 20 strength 1 diff --git a/ATL/Pooh/woods.atl b/ATL/Pooh/woods.atl index 64314e4..2a996fe 100644 --- a/ATL/Pooh/woods.atl +++ b/ATL/Pooh/woods.atl @@ -202,6 +202,7 @@ define-place "Bee tree" description "TODO" neighbour "Northern woods" + monster "Bees" define-place "Rabbit's house" description "TODO" diff --git a/doc/TODO b/doc/TODO index a4ca23d..c8e37b6 100644 --- a/doc/TODO +++ b/doc/TODO @@ -5,4 +5,3 @@ * require XP minimum to finish game? * think of more quests * integrate the quests to lead the player through the game -* integrate monster aggression diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index ade565f..f54c418 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -28,7 +28,7 @@ (defstruct npc (name "") (description "") - (says "") + (says NIL) (sells NIL) (buys NIL) (quest "") diff --git a/lisp/ui.lisp b/lisp/ui.lisp index 713b833..628b96d 100644 --- a/lisp/ui.lisp +++ b/lisp/ui.lisp @@ -189,7 +189,12 @@ (let ((hook (place-entry-hook (get-game-object 'place location)))) ;entry hook (unless (zerop (length hook)) (funcall (read-from-string hook) player))) (add-player-experience player 1) - (describe-place (player-place player))) + (describe-place (player-place player)) + ;; Aggressive monsters attack + (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 look (player &optional object-name) "Print a description of this object" @@ -206,7 +211,7 @@ (setf description (item-description (get-game-object 'item object-name)))) (if description - (format t "~&(~A) ~A" object-name description) + (format t "~&(~A) ~A" (string-capitalize object-name) description) (format t "~&Could not find ~A!" object-name)))) (defun search (player &optional arg) @@ -231,14 +236,17 @@ (let ((split-name (cut-string npc-name 3))) (when (equalp (first split-name) "to ") (setf npc-name (second split-name)))) - (let* ((place (get-game-object 'place (player-place player))) + (let* ((npc-name (string-capitalize npc-name)) + (place (get-game-object 'place (player-place player))) (npc (when (member npc-name (place-npc place) :test #'equalp) (get-game-object 'npc 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)) + ;; The NPC says one of its lines + (format t "~&~A: ~A" (string-upcase npc-name) + (random-elt (npc-says npc))) ;; Interaction hook (let ((hook (npc-interaction-hook npc))) (unless (zerop (length hook)) diff --git a/lisp/util.lisp b/lisp/util.lisp index 9d86fa4..26115f1 100644 --- a/lisp/util.lisp +++ b/lisp/util.lisp @@ -117,6 +117,7 @@ ;; TODO change &optional to &key (and figure out why the heck that doesn't ;; work - clisp bug?), add null-filler keyword +;; TODO Add a maximum line length after which a newline is inserted (defun string-from-list (lst &optional (separator " - ")) "Put all elements of lst into a single string, separated by the separator" (cond ((null lst) "")