diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index 3692a93..495dd24 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -5,3 +5,19 @@ ; ; author: Daniel Vedder ; date: 07/06/2017 + +define-item "Hunny" + description "A jar full to the brim of delicious, golden honey. Hmmmm..." + +define-item "Pooh's sign" + description " + SANDERS + " + +define-item "Piglet's sign" + description " + ____________________ + | \\_ + | TRESPASSERS WILL > + |____________________< + " \ No newline at end of file diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index 3692a93..495dd24 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -5,3 +5,19 @@ ; ; author: Daniel Vedder ; date: 07/06/2017 + +define-item "Hunny" + description "A jar full to the brim of delicious, golden honey. Hmmmm..." + +define-item "Pooh's sign" + description " + SANDERS + " + +define-item "Piglet's sign" + description " + ____________________ + | \\_ + | TRESPASSERS WILL > + |____________________< + " \ No newline at end of file diff --git a/ATL/Pooh/pooh.atl b/ATL/Pooh/pooh.atl index 302df84..181995f 100644 --- a/ATL/Pooh/pooh.atl +++ b/ATL/Pooh/pooh.atl @@ -8,11 +8,9 @@ name-world "100 Acre Wood" -load-file "woods.atl" load-file "objects.atl" +load-file "woods.atl" define-player "Winnie the Pooh" - money 0 + description "A small but very lovable bear of very little brain." place "Pooh's home" - max-health 50 - health 50 diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index 3692a93..495dd24 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -5,3 +5,19 @@ ; ; author: Daniel Vedder ; date: 07/06/2017 + +define-item "Hunny" + description "A jar full to the brim of delicious, golden honey. Hmmmm..." + +define-item "Pooh's sign" + description " + SANDERS + " + +define-item "Piglet's sign" + description " + ____________________ + | \\_ + | TRESPASSERS WILL > + |____________________< + " \ No newline at end of file diff --git a/ATL/Pooh/pooh.atl b/ATL/Pooh/pooh.atl index 302df84..181995f 100644 --- a/ATL/Pooh/pooh.atl +++ b/ATL/Pooh/pooh.atl @@ -8,11 +8,9 @@ name-world "100 Acre Wood" -load-file "woods.atl" load-file "objects.atl" +load-file "woods.atl" define-player "Winnie the Pooh" - money 0 + description "A small but very lovable bear of very little brain." place "Pooh's home" - max-health 50 - health 50 diff --git a/ATL/Pooh/woods.atl b/ATL/Pooh/woods.atl index 291539a..d0a702c 100644 --- a/ATL/Pooh/woods.atl +++ b/ATL/Pooh/woods.atl @@ -12,7 +12,6 @@ delicious honey..." neighbour "Pooh's porch" neighbour "Pooh's branch" - neighbour "Western woods" item "Hunny" define-place "Pooh's porch" @@ -20,13 +19,16 @@ the name 'Sanders', as anyone can see by the old sign planted beside the door. A comfy-looking bench stands in the sun, inviting you to a well-earned rest." + item "Pooh's sign" neighbour "Pooh's home" + neighbour "Western woods" define-place "Pooh's branch" description "This is a thick branch above Pooh's home. Once, on a very blustery day, Pooh had to escape to up here. Since then, he keeps an emergency ration of honey handy." neighbour "Pooh's home" + neighbour "Pooh's porch" item "Hunny" define-place "Western woods" diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index 3692a93..495dd24 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -5,3 +5,19 @@ ; ; author: Daniel Vedder ; date: 07/06/2017 + +define-item "Hunny" + description "A jar full to the brim of delicious, golden honey. Hmmmm..." + +define-item "Pooh's sign" + description " + SANDERS + " + +define-item "Piglet's sign" + description " + ____________________ + | \\_ + | TRESPASSERS WILL > + |____________________< + " \ No newline at end of file diff --git a/ATL/Pooh/pooh.atl b/ATL/Pooh/pooh.atl index 302df84..181995f 100644 --- a/ATL/Pooh/pooh.atl +++ b/ATL/Pooh/pooh.atl @@ -8,11 +8,9 @@ name-world "100 Acre Wood" -load-file "woods.atl" load-file "objects.atl" +load-file "woods.atl" define-player "Winnie the Pooh" - money 0 + description "A small but very lovable bear of very little brain." place "Pooh's home" - max-health 50 - health 50 diff --git a/ATL/Pooh/woods.atl b/ATL/Pooh/woods.atl index 291539a..d0a702c 100644 --- a/ATL/Pooh/woods.atl +++ b/ATL/Pooh/woods.atl @@ -12,7 +12,6 @@ delicious honey..." neighbour "Pooh's porch" neighbour "Pooh's branch" - neighbour "Western woods" item "Hunny" define-place "Pooh's porch" @@ -20,13 +19,16 @@ the name 'Sanders', as anyone can see by the old sign planted beside the door. A comfy-looking bench stands in the sun, inviting you to a well-earned rest." + item "Pooh's sign" neighbour "Pooh's home" + neighbour "Western woods" define-place "Pooh's branch" description "This is a thick branch above Pooh's home. Once, on a very blustery day, Pooh had to escape to up here. Since then, he keeps an emergency ration of honey handy." neighbour "Pooh's home" + neighbour "Pooh's porch" item "Hunny" define-place "Western woods" diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 7bd153f..4401088 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -24,7 +24,6 @@ (setf *debugging* T) (load-file "../ATL/test/lisp-test.atl") (let ((player (make-player :name "Bilbo" - :race "Hobbit" :class "Burglar" :place "Fields of Punishment" :strength 6 :constitution 12 :dexterity 19 :intelligence 14 @@ -53,7 +52,6 @@ ;;FIXME Present the player with a choice of saved games (0 (format t "~&What world file do you want to load?") (input-string world-file) - (setf world-file (concatenate 'string "../saves/" world-file)) ;;FIXME Allowing only one player per world eliminates the need ;; to ask for a player name (format t "~&What is your name?") @@ -63,6 +61,7 @@ ;;FIXME Present the player with a choice of game worlds (1 (format t "~&What game file do you want to load?") (input-string game) + (setf game (concatenate 'string "../saves/" game)) (load-game game) ;;FIXME Present the player with a choice of predefined characters (format t "~&What is your name?") diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index 3692a93..495dd24 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -5,3 +5,19 @@ ; ; author: Daniel Vedder ; date: 07/06/2017 + +define-item "Hunny" + description "A jar full to the brim of delicious, golden honey. Hmmmm..." + +define-item "Pooh's sign" + description " + SANDERS + " + +define-item "Piglet's sign" + description " + ____________________ + | \\_ + | TRESPASSERS WILL > + |____________________< + " \ No newline at end of file diff --git a/ATL/Pooh/pooh.atl b/ATL/Pooh/pooh.atl index 302df84..181995f 100644 --- a/ATL/Pooh/pooh.atl +++ b/ATL/Pooh/pooh.atl @@ -8,11 +8,9 @@ name-world "100 Acre Wood" -load-file "woods.atl" load-file "objects.atl" +load-file "woods.atl" define-player "Winnie the Pooh" - money 0 + description "A small but very lovable bear of very little brain." place "Pooh's home" - max-health 50 - health 50 diff --git a/ATL/Pooh/woods.atl b/ATL/Pooh/woods.atl index 291539a..d0a702c 100644 --- a/ATL/Pooh/woods.atl +++ b/ATL/Pooh/woods.atl @@ -12,7 +12,6 @@ delicious honey..." neighbour "Pooh's porch" neighbour "Pooh's branch" - neighbour "Western woods" item "Hunny" define-place "Pooh's porch" @@ -20,13 +19,16 @@ the name 'Sanders', as anyone can see by the old sign planted beside the door. A comfy-looking bench stands in the sun, inviting you to a well-earned rest." + item "Pooh's sign" neighbour "Pooh's home" + neighbour "Western woods" define-place "Pooh's branch" description "This is a thick branch above Pooh's home. Once, on a very blustery day, Pooh had to escape to up here. Since then, he keeps an emergency ration of honey handy." neighbour "Pooh's home" + neighbour "Pooh's porch" item "Hunny" define-place "Western woods" diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 7bd153f..4401088 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -24,7 +24,6 @@ (setf *debugging* T) (load-file "../ATL/test/lisp-test.atl") (let ((player (make-player :name "Bilbo" - :race "Hobbit" :class "Burglar" :place "Fields of Punishment" :strength 6 :constitution 12 :dexterity 19 :intelligence 14 @@ -53,7 +52,6 @@ ;;FIXME Present the player with a choice of saved games (0 (format t "~&What world file do you want to load?") (input-string world-file) - (setf world-file (concatenate 'string "../saves/" world-file)) ;;FIXME Allowing only one player per world eliminates the need ;; to ask for a player name (format t "~&What is your name?") @@ -63,6 +61,7 @@ ;;FIXME Present the player with a choice of game worlds (1 (format t "~&What game file do you want to load?") (input-string game) + (setf game (concatenate 'string "../saves/" game)) (load-game game) ;;FIXME Present the player with a choice of predefined characters (format t "~&What is your name?") diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 6f768a2..ccd02b9 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -15,7 +15,6 @@ (description "") ;; Missing 's' in the following list names due to parsing issues (neighbour NIL) - (player NIL) (item NIL) (monster NIL) (npc NIL) diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index 3692a93..495dd24 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -5,3 +5,19 @@ ; ; author: Daniel Vedder ; date: 07/06/2017 + +define-item "Hunny" + description "A jar full to the brim of delicious, golden honey. Hmmmm..." + +define-item "Pooh's sign" + description " + SANDERS + " + +define-item "Piglet's sign" + description " + ____________________ + | \\_ + | TRESPASSERS WILL > + |____________________< + " \ No newline at end of file diff --git a/ATL/Pooh/pooh.atl b/ATL/Pooh/pooh.atl index 302df84..181995f 100644 --- a/ATL/Pooh/pooh.atl +++ b/ATL/Pooh/pooh.atl @@ -8,11 +8,9 @@ name-world "100 Acre Wood" -load-file "woods.atl" load-file "objects.atl" +load-file "woods.atl" define-player "Winnie the Pooh" - money 0 + description "A small but very lovable bear of very little brain." place "Pooh's home" - max-health 50 - health 50 diff --git a/ATL/Pooh/woods.atl b/ATL/Pooh/woods.atl index 291539a..d0a702c 100644 --- a/ATL/Pooh/woods.atl +++ b/ATL/Pooh/woods.atl @@ -12,7 +12,6 @@ delicious honey..." neighbour "Pooh's porch" neighbour "Pooh's branch" - neighbour "Western woods" item "Hunny" define-place "Pooh's porch" @@ -20,13 +19,16 @@ the name 'Sanders', as anyone can see by the old sign planted beside the door. A comfy-looking bench stands in the sun, inviting you to a well-earned rest." + item "Pooh's sign" neighbour "Pooh's home" + neighbour "Western woods" define-place "Pooh's branch" description "This is a thick branch above Pooh's home. Once, on a very blustery day, Pooh had to escape to up here. Since then, he keeps an emergency ration of honey handy." neighbour "Pooh's home" + neighbour "Pooh's porch" item "Hunny" define-place "Western woods" diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 7bd153f..4401088 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -24,7 +24,6 @@ (setf *debugging* T) (load-file "../ATL/test/lisp-test.atl") (let ((player (make-player :name "Bilbo" - :race "Hobbit" :class "Burglar" :place "Fields of Punishment" :strength 6 :constitution 12 :dexterity 19 :intelligence 14 @@ -53,7 +52,6 @@ ;;FIXME Present the player with a choice of saved games (0 (format t "~&What world file do you want to load?") (input-string world-file) - (setf world-file (concatenate 'string "../saves/" world-file)) ;;FIXME Allowing only one player per world eliminates the need ;; to ask for a player name (format t "~&What is your name?") @@ -63,6 +61,7 @@ ;;FIXME Present the player with a choice of game worlds (1 (format t "~&What game file do you want to load?") (input-string game) + (setf game (concatenate 'string "../saves/" game)) (load-game game) ;;FIXME Present the player with a choice of predefined characters (format t "~&What is your name?") diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 6f768a2..ccd02b9 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -15,7 +15,6 @@ (description "") ;; Missing 's' in the following list names due to parsing issues (neighbour NIL) - (player NIL) (item NIL) (monster NIL) (npc NIL) diff --git a/lisp/interpreter.lisp b/lisp/interpreter.lisp index 3204ccb..04ab683 100644 --- a/lisp/interpreter.lisp +++ b/lisp/interpreter.lisp @@ -32,8 +32,6 @@ ;;; (defcommand ) (defcommand define-place place) -(defcommand define-race race) -(defcommand define-class character-class) (defcommand define-player player) (defcommand define-monster monster) (defcommand define-weapon weapon) diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index 3692a93..495dd24 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -5,3 +5,19 @@ ; ; author: Daniel Vedder ; date: 07/06/2017 + +define-item "Hunny" + description "A jar full to the brim of delicious, golden honey. Hmmmm..." + +define-item "Pooh's sign" + description " + SANDERS + " + +define-item "Piglet's sign" + description " + ____________________ + | \\_ + | TRESPASSERS WILL > + |____________________< + " \ No newline at end of file diff --git a/ATL/Pooh/pooh.atl b/ATL/Pooh/pooh.atl index 302df84..181995f 100644 --- a/ATL/Pooh/pooh.atl +++ b/ATL/Pooh/pooh.atl @@ -8,11 +8,9 @@ name-world "100 Acre Wood" -load-file "woods.atl" load-file "objects.atl" +load-file "woods.atl" define-player "Winnie the Pooh" - money 0 + description "A small but very lovable bear of very little brain." place "Pooh's home" - max-health 50 - health 50 diff --git a/ATL/Pooh/woods.atl b/ATL/Pooh/woods.atl index 291539a..d0a702c 100644 --- a/ATL/Pooh/woods.atl +++ b/ATL/Pooh/woods.atl @@ -12,7 +12,6 @@ delicious honey..." neighbour "Pooh's porch" neighbour "Pooh's branch" - neighbour "Western woods" item "Hunny" define-place "Pooh's porch" @@ -20,13 +19,16 @@ the name 'Sanders', as anyone can see by the old sign planted beside the door. A comfy-looking bench stands in the sun, inviting you to a well-earned rest." + item "Pooh's sign" neighbour "Pooh's home" + neighbour "Western woods" define-place "Pooh's branch" description "This is a thick branch above Pooh's home. Once, on a very blustery day, Pooh had to escape to up here. Since then, he keeps an emergency ration of honey handy." neighbour "Pooh's home" + neighbour "Pooh's porch" item "Hunny" define-place "Western woods" diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 7bd153f..4401088 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -24,7 +24,6 @@ (setf *debugging* T) (load-file "../ATL/test/lisp-test.atl") (let ((player (make-player :name "Bilbo" - :race "Hobbit" :class "Burglar" :place "Fields of Punishment" :strength 6 :constitution 12 :dexterity 19 :intelligence 14 @@ -53,7 +52,6 @@ ;;FIXME Present the player with a choice of saved games (0 (format t "~&What world file do you want to load?") (input-string world-file) - (setf world-file (concatenate 'string "../saves/" world-file)) ;;FIXME Allowing only one player per world eliminates the need ;; to ask for a player name (format t "~&What is your name?") @@ -63,6 +61,7 @@ ;;FIXME Present the player with a choice of game worlds (1 (format t "~&What game file do you want to load?") (input-string game) + (setf game (concatenate 'string "../saves/" game)) (load-game game) ;;FIXME Present the player with a choice of predefined characters (format t "~&What is your name?") diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 6f768a2..ccd02b9 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -15,7 +15,6 @@ (description "") ;; Missing 's' in the following list names due to parsing issues (neighbour NIL) - (player NIL) (item NIL) (monster NIL) (npc NIL) diff --git a/lisp/interpreter.lisp b/lisp/interpreter.lisp index 3204ccb..04ab683 100644 --- a/lisp/interpreter.lisp +++ b/lisp/interpreter.lisp @@ -32,8 +32,6 @@ ;;; (defcommand ) (defcommand define-place place) -(defcommand define-race race) -(defcommand define-class character-class) (defcommand define-player player) (defcommand define-monster monster) (defcommand define-weapon weapon) diff --git a/lisp/player.lisp b/lisp/player.lisp index 430a21b..08cf181 100644 --- a/lisp/player.lisp +++ b/lisp/player.lisp @@ -12,8 +12,7 @@ (defstruct player (name "") - (race "") - (class "") + (description "") (strength 0) (dexterity 0) (constitution 0) @@ -34,21 +33,6 @@ ;; XXX Make this configurable in ATL? (defvar *level-experience* 100) -(defstruct race - (name "") - (description "") - (strength-bonus 0) - (dexterity-bonus 0) - (constitution-bonus 0) - (intelligence-bonus 0) - (special-ability NIL)) - -(defstruct character-class - (name "") - (description "") - (special-item NIL) - (special-ability NIL)) - (defun add-player (player) "Add this player to the game world" @@ -59,12 +43,7 @@ "Change the player's location and do housekeeping" (setf location (to-string location)) (objectify-place-monsters location) - (when (player-place player) - (remove-object-attribute (get-game-object 'place (player-place player)) - 'player (player-name player))) - (set-object-attribute player 'place location) - (set-object-attribute (get-game-object 'place location) - 'player (player-name player))) + (set-object-attribute player 'place location)) ;; XXX This function is probably superfluous, as the player struct should only ;; store names of game objects (the actual objects are stored in *world*) diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index 3692a93..495dd24 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -5,3 +5,19 @@ ; ; author: Daniel Vedder ; date: 07/06/2017 + +define-item "Hunny" + description "A jar full to the brim of delicious, golden honey. Hmmmm..." + +define-item "Pooh's sign" + description " + SANDERS + " + +define-item "Piglet's sign" + description " + ____________________ + | \\_ + | TRESPASSERS WILL > + |____________________< + " \ No newline at end of file diff --git a/ATL/Pooh/pooh.atl b/ATL/Pooh/pooh.atl index 302df84..181995f 100644 --- a/ATL/Pooh/pooh.atl +++ b/ATL/Pooh/pooh.atl @@ -8,11 +8,9 @@ name-world "100 Acre Wood" -load-file "woods.atl" load-file "objects.atl" +load-file "woods.atl" define-player "Winnie the Pooh" - money 0 + description "A small but very lovable bear of very little brain." place "Pooh's home" - max-health 50 - health 50 diff --git a/ATL/Pooh/woods.atl b/ATL/Pooh/woods.atl index 291539a..d0a702c 100644 --- a/ATL/Pooh/woods.atl +++ b/ATL/Pooh/woods.atl @@ -12,7 +12,6 @@ delicious honey..." neighbour "Pooh's porch" neighbour "Pooh's branch" - neighbour "Western woods" item "Hunny" define-place "Pooh's porch" @@ -20,13 +19,16 @@ the name 'Sanders', as anyone can see by the old sign planted beside the door. A comfy-looking bench stands in the sun, inviting you to a well-earned rest." + item "Pooh's sign" neighbour "Pooh's home" + neighbour "Western woods" define-place "Pooh's branch" description "This is a thick branch above Pooh's home. Once, on a very blustery day, Pooh had to escape to up here. Since then, he keeps an emergency ration of honey handy." neighbour "Pooh's home" + neighbour "Pooh's porch" item "Hunny" define-place "Western woods" diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 7bd153f..4401088 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -24,7 +24,6 @@ (setf *debugging* T) (load-file "../ATL/test/lisp-test.atl") (let ((player (make-player :name "Bilbo" - :race "Hobbit" :class "Burglar" :place "Fields of Punishment" :strength 6 :constitution 12 :dexterity 19 :intelligence 14 @@ -53,7 +52,6 @@ ;;FIXME Present the player with a choice of saved games (0 (format t "~&What world file do you want to load?") (input-string world-file) - (setf world-file (concatenate 'string "../saves/" world-file)) ;;FIXME Allowing only one player per world eliminates the need ;; to ask for a player name (format t "~&What is your name?") @@ -63,6 +61,7 @@ ;;FIXME Present the player with a choice of game worlds (1 (format t "~&What game file do you want to load?") (input-string game) + (setf game (concatenate 'string "../saves/" game)) (load-game game) ;;FIXME Present the player with a choice of predefined characters (format t "~&What is your name?") diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 6f768a2..ccd02b9 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -15,7 +15,6 @@ (description "") ;; Missing 's' in the following list names due to parsing issues (neighbour NIL) - (player NIL) (item NIL) (monster NIL) (npc NIL) diff --git a/lisp/interpreter.lisp b/lisp/interpreter.lisp index 3204ccb..04ab683 100644 --- a/lisp/interpreter.lisp +++ b/lisp/interpreter.lisp @@ -32,8 +32,6 @@ ;;; (defcommand ) (defcommand define-place place) -(defcommand define-race race) -(defcommand define-class character-class) (defcommand define-player player) (defcommand define-monster monster) (defcommand define-weapon weapon) diff --git a/lisp/player.lisp b/lisp/player.lisp index 430a21b..08cf181 100644 --- a/lisp/player.lisp +++ b/lisp/player.lisp @@ -12,8 +12,7 @@ (defstruct player (name "") - (race "") - (class "") + (description "") (strength 0) (dexterity 0) (constitution 0) @@ -34,21 +33,6 @@ ;; XXX Make this configurable in ATL? (defvar *level-experience* 100) -(defstruct race - (name "") - (description "") - (strength-bonus 0) - (dexterity-bonus 0) - (constitution-bonus 0) - (intelligence-bonus 0) - (special-ability NIL)) - -(defstruct character-class - (name "") - (description "") - (special-item NIL) - (special-ability NIL)) - (defun add-player (player) "Add this player to the game world" @@ -59,12 +43,7 @@ "Change the player's location and do housekeeping" (setf location (to-string location)) (objectify-place-monsters location) - (when (player-place player) - (remove-object-attribute (get-game-object 'place (player-place player)) - 'player (player-name player))) - (set-object-attribute player 'place location) - (set-object-attribute (get-game-object 'place location) - 'player (player-name player))) + (set-object-attribute player 'place location)) ;; XXX This function is probably superfluous, as the player struct should only ;; store names of game objects (the actual objects are stored in *world*) diff --git a/lisp/ui.lisp b/lisp/ui.lisp index bbb1fd8..406322d 100644 --- a/lisp/ui.lisp +++ b/lisp/ui.lisp @@ -37,8 +37,6 @@ (defun create-player (player-name) "The user creates a new player" ;; FIXME Remove this entirely. Game authors should define all playable characters. - ;; TODO Rewrite this if possible - ;; XXX This function feels somewhat ugly - any possibility of a cleanup? (let* ((start-player (get-game-object 'player "Start")) (player (if start-player (copy-player start-player) ;FIXME adjust the name (make-player :name player-name @@ -50,21 +48,6 @@ (character-points NIL)) (format t "~&The name you have chosen is not registered on this game.") (unless (y-or-n-p "~&Create a new player?") (start-menu) (quit)) - ;; Chose race and class - (format t "~&Please chose a race:") - (setf (player-race player) (choose-option (list-world-objects 'race))) - (format t "~&Please chose a class:") - (setf (player-class player) - (choose-option (list-world-objects 'character-class))) - (dolist (i (character-class-special-item - (get-game-object 'character-class (player-class player)))) - (set-object-attribute player 'item i)) - (dolist (ac (character-class-special-ability - (get-game-object 'character-class (player-class player)))) - (set-object-attribute player 'ability ac)) - (dolist (ac (race-special-ability - (get-game-object 'race (player-race player)))) - (set-object-attribute player 'ability ar)) ;; Set character attributes (while (or (< (reduce #'+ character-points) 24) ; XXX magic number! (not (set-p character-points))) @@ -99,7 +82,6 @@ (format t "~&~%~A" (place-description p)) (format t "~&~%Neighbouring places: ~A" (string-from-list (place-neighbour p))) - (format t "~&Players present: ~A" (string-from-list (place-player p))) (format t "~&Items: ~A" (string-from-list (place-item p))) (format t "~&NPCs: ~A" (string-from-list (place-npc p))) (format t "~&Monsters: ~A" (string-from-list @@ -123,11 +105,10 @@ ;; A list of all in-game commands. Each new command must be registered here. (defvar *commands* - '(help place player - goto pickup drop - talk trade + '(help player goto pickup + drop talk trade equip attack spell - about save clear)) + look save clear)) ;;; The following commands don't take any arguments except for a player @@ -168,7 +149,6 @@ (when (stringp p) (setf p (get-game-object 'player p))) (format t "~&Player ~A:" (player-name p)) (format t "~&~%Current place: ~A" (player-place p)) - (format t "~&Race: ~A~AClass: ~A" (player-race p) tab (player-class p)) (format t "~&=====~&Attributes:") (format t "~&Intelligence: ~A~AStrength: ~A" (player-intelligence p) tab (player-strength p)) @@ -235,11 +215,11 @@ (defun look (player &optional object-name) "Print a description of this object" (unless object-name - (describe-place (player-place player)) + (place player) (return-from look)) ;; A bit of syntactic sugar... - (cond ((equalp object-name "me") (player player) (return-from about)) - ((equalp object-name "here") (place player) (return-from about))) + (cond ((equalp object-name "me") (player player) (return-from look)) + ((equalp object-name "here") (place player) (return-from look))) (let ((description (get-object-description object-name (player-place player)))) ;; Don't forget items the player is carrying diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index 3692a93..495dd24 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -5,3 +5,19 @@ ; ; author: Daniel Vedder ; date: 07/06/2017 + +define-item "Hunny" + description "A jar full to the brim of delicious, golden honey. Hmmmm..." + +define-item "Pooh's sign" + description " + SANDERS + " + +define-item "Piglet's sign" + description " + ____________________ + | \\_ + | TRESPASSERS WILL > + |____________________< + " \ No newline at end of file diff --git a/ATL/Pooh/pooh.atl b/ATL/Pooh/pooh.atl index 302df84..181995f 100644 --- a/ATL/Pooh/pooh.atl +++ b/ATL/Pooh/pooh.atl @@ -8,11 +8,9 @@ name-world "100 Acre Wood" -load-file "woods.atl" load-file "objects.atl" +load-file "woods.atl" define-player "Winnie the Pooh" - money 0 + description "A small but very lovable bear of very little brain." place "Pooh's home" - max-health 50 - health 50 diff --git a/ATL/Pooh/woods.atl b/ATL/Pooh/woods.atl index 291539a..d0a702c 100644 --- a/ATL/Pooh/woods.atl +++ b/ATL/Pooh/woods.atl @@ -12,7 +12,6 @@ delicious honey..." neighbour "Pooh's porch" neighbour "Pooh's branch" - neighbour "Western woods" item "Hunny" define-place "Pooh's porch" @@ -20,13 +19,16 @@ the name 'Sanders', as anyone can see by the old sign planted beside the door. A comfy-looking bench stands in the sun, inviting you to a well-earned rest." + item "Pooh's sign" neighbour "Pooh's home" + neighbour "Western woods" define-place "Pooh's branch" description "This is a thick branch above Pooh's home. Once, on a very blustery day, Pooh had to escape to up here. Since then, he keeps an emergency ration of honey handy." neighbour "Pooh's home" + neighbour "Pooh's porch" item "Hunny" define-place "Western woods" diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 7bd153f..4401088 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -24,7 +24,6 @@ (setf *debugging* T) (load-file "../ATL/test/lisp-test.atl") (let ((player (make-player :name "Bilbo" - :race "Hobbit" :class "Burglar" :place "Fields of Punishment" :strength 6 :constitution 12 :dexterity 19 :intelligence 14 @@ -53,7 +52,6 @@ ;;FIXME Present the player with a choice of saved games (0 (format t "~&What world file do you want to load?") (input-string world-file) - (setf world-file (concatenate 'string "../saves/" world-file)) ;;FIXME Allowing only one player per world eliminates the need ;; to ask for a player name (format t "~&What is your name?") @@ -63,6 +61,7 @@ ;;FIXME Present the player with a choice of game worlds (1 (format t "~&What game file do you want to load?") (input-string game) + (setf game (concatenate 'string "../saves/" game)) (load-game game) ;;FIXME Present the player with a choice of predefined characters (format t "~&What is your name?") diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 6f768a2..ccd02b9 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -15,7 +15,6 @@ (description "") ;; Missing 's' in the following list names due to parsing issues (neighbour NIL) - (player NIL) (item NIL) (monster NIL) (npc NIL) diff --git a/lisp/interpreter.lisp b/lisp/interpreter.lisp index 3204ccb..04ab683 100644 --- a/lisp/interpreter.lisp +++ b/lisp/interpreter.lisp @@ -32,8 +32,6 @@ ;;; (defcommand ) (defcommand define-place place) -(defcommand define-race race) -(defcommand define-class character-class) (defcommand define-player player) (defcommand define-monster monster) (defcommand define-weapon weapon) diff --git a/lisp/player.lisp b/lisp/player.lisp index 430a21b..08cf181 100644 --- a/lisp/player.lisp +++ b/lisp/player.lisp @@ -12,8 +12,7 @@ (defstruct player (name "") - (race "") - (class "") + (description "") (strength 0) (dexterity 0) (constitution 0) @@ -34,21 +33,6 @@ ;; XXX Make this configurable in ATL? (defvar *level-experience* 100) -(defstruct race - (name "") - (description "") - (strength-bonus 0) - (dexterity-bonus 0) - (constitution-bonus 0) - (intelligence-bonus 0) - (special-ability NIL)) - -(defstruct character-class - (name "") - (description "") - (special-item NIL) - (special-ability NIL)) - (defun add-player (player) "Add this player to the game world" @@ -59,12 +43,7 @@ "Change the player's location and do housekeeping" (setf location (to-string location)) (objectify-place-monsters location) - (when (player-place player) - (remove-object-attribute (get-game-object 'place (player-place player)) - 'player (player-name player))) - (set-object-attribute player 'place location) - (set-object-attribute (get-game-object 'place location) - 'player (player-name player))) + (set-object-attribute player 'place location)) ;; XXX This function is probably superfluous, as the player struct should only ;; store names of game objects (the actual objects are stored in *world*) diff --git a/lisp/ui.lisp b/lisp/ui.lisp index bbb1fd8..406322d 100644 --- a/lisp/ui.lisp +++ b/lisp/ui.lisp @@ -37,8 +37,6 @@ (defun create-player (player-name) "The user creates a new player" ;; FIXME Remove this entirely. Game authors should define all playable characters. - ;; TODO Rewrite this if possible - ;; XXX This function feels somewhat ugly - any possibility of a cleanup? (let* ((start-player (get-game-object 'player "Start")) (player (if start-player (copy-player start-player) ;FIXME adjust the name (make-player :name player-name @@ -50,21 +48,6 @@ (character-points NIL)) (format t "~&The name you have chosen is not registered on this game.") (unless (y-or-n-p "~&Create a new player?") (start-menu) (quit)) - ;; Chose race and class - (format t "~&Please chose a race:") - (setf (player-race player) (choose-option (list-world-objects 'race))) - (format t "~&Please chose a class:") - (setf (player-class player) - (choose-option (list-world-objects 'character-class))) - (dolist (i (character-class-special-item - (get-game-object 'character-class (player-class player)))) - (set-object-attribute player 'item i)) - (dolist (ac (character-class-special-ability - (get-game-object 'character-class (player-class player)))) - (set-object-attribute player 'ability ac)) - (dolist (ac (race-special-ability - (get-game-object 'race (player-race player)))) - (set-object-attribute player 'ability ar)) ;; Set character attributes (while (or (< (reduce #'+ character-points) 24) ; XXX magic number! (not (set-p character-points))) @@ -99,7 +82,6 @@ (format t "~&~%~A" (place-description p)) (format t "~&~%Neighbouring places: ~A" (string-from-list (place-neighbour p))) - (format t "~&Players present: ~A" (string-from-list (place-player p))) (format t "~&Items: ~A" (string-from-list (place-item p))) (format t "~&NPCs: ~A" (string-from-list (place-npc p))) (format t "~&Monsters: ~A" (string-from-list @@ -123,11 +105,10 @@ ;; A list of all in-game commands. Each new command must be registered here. (defvar *commands* - '(help place player - goto pickup drop - talk trade + '(help player goto pickup + drop talk trade equip attack spell - about save clear)) + look save clear)) ;;; The following commands don't take any arguments except for a player @@ -168,7 +149,6 @@ (when (stringp p) (setf p (get-game-object 'player p))) (format t "~&Player ~A:" (player-name p)) (format t "~&~%Current place: ~A" (player-place p)) - (format t "~&Race: ~A~AClass: ~A" (player-race p) tab (player-class p)) (format t "~&=====~&Attributes:") (format t "~&Intelligence: ~A~AStrength: ~A" (player-intelligence p) tab (player-strength p)) @@ -235,11 +215,11 @@ (defun look (player &optional object-name) "Print a description of this object" (unless object-name - (describe-place (player-place player)) + (place player) (return-from look)) ;; A bit of syntactic sugar... - (cond ((equalp object-name "me") (player player) (return-from about)) - ((equalp object-name "here") (place player) (return-from about))) + (cond ((equalp object-name "me") (player player) (return-from look)) + ((equalp object-name "here") (place player) (return-from look))) (let ((description (get-object-description object-name (player-place player)))) ;; Don't forget items the player is carrying diff --git a/lisp/world.lisp b/lisp/world.lisp index 29c6346..eee42dd 100644 --- a/lisp/world.lisp +++ b/lisp/world.lisp @@ -19,8 +19,6 @@ (defstruct world (name "") (players NIL) - (character-classs NIL) ;Bad English because of parsing issues - (races NIL) (places NIL) (monsters NIL) (npcs NIL) diff --git a/ATL/Pooh/objects.atl b/ATL/Pooh/objects.atl index 3692a93..495dd24 100644 --- a/ATL/Pooh/objects.atl +++ b/ATL/Pooh/objects.atl @@ -5,3 +5,19 @@ ; ; author: Daniel Vedder ; date: 07/06/2017 + +define-item "Hunny" + description "A jar full to the brim of delicious, golden honey. Hmmmm..." + +define-item "Pooh's sign" + description " + SANDERS + " + +define-item "Piglet's sign" + description " + ____________________ + | \\_ + | TRESPASSERS WILL > + |____________________< + " \ No newline at end of file diff --git a/ATL/Pooh/pooh.atl b/ATL/Pooh/pooh.atl index 302df84..181995f 100644 --- a/ATL/Pooh/pooh.atl +++ b/ATL/Pooh/pooh.atl @@ -8,11 +8,9 @@ name-world "100 Acre Wood" -load-file "woods.atl" load-file "objects.atl" +load-file "woods.atl" define-player "Winnie the Pooh" - money 0 + description "A small but very lovable bear of very little brain." place "Pooh's home" - max-health 50 - health 50 diff --git a/ATL/Pooh/woods.atl b/ATL/Pooh/woods.atl index 291539a..d0a702c 100644 --- a/ATL/Pooh/woods.atl +++ b/ATL/Pooh/woods.atl @@ -12,7 +12,6 @@ delicious honey..." neighbour "Pooh's porch" neighbour "Pooh's branch" - neighbour "Western woods" item "Hunny" define-place "Pooh's porch" @@ -20,13 +19,16 @@ the name 'Sanders', as anyone can see by the old sign planted beside the door. A comfy-looking bench stands in the sun, inviting you to a well-earned rest." + item "Pooh's sign" neighbour "Pooh's home" + neighbour "Western woods" define-place "Pooh's branch" description "This is a thick branch above Pooh's home. Once, on a very blustery day, Pooh had to escape to up here. Since then, he keeps an emergency ration of honey handy." neighbour "Pooh's home" + neighbour "Pooh's porch" item "Hunny" define-place "Western woods" diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 7bd153f..4401088 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -24,7 +24,6 @@ (setf *debugging* T) (load-file "../ATL/test/lisp-test.atl") (let ((player (make-player :name "Bilbo" - :race "Hobbit" :class "Burglar" :place "Fields of Punishment" :strength 6 :constitution 12 :dexterity 19 :intelligence 14 @@ -53,7 +52,6 @@ ;;FIXME Present the player with a choice of saved games (0 (format t "~&What world file do you want to load?") (input-string world-file) - (setf world-file (concatenate 'string "../saves/" world-file)) ;;FIXME Allowing only one player per world eliminates the need ;; to ask for a player name (format t "~&What is your name?") @@ -63,6 +61,7 @@ ;;FIXME Present the player with a choice of game worlds (1 (format t "~&What game file do you want to load?") (input-string game) + (setf game (concatenate 'string "../saves/" game)) (load-game game) ;;FIXME Present the player with a choice of predefined characters (format t "~&What is your name?") diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 6f768a2..ccd02b9 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -15,7 +15,6 @@ (description "") ;; Missing 's' in the following list names due to parsing issues (neighbour NIL) - (player NIL) (item NIL) (monster NIL) (npc NIL) diff --git a/lisp/interpreter.lisp b/lisp/interpreter.lisp index 3204ccb..04ab683 100644 --- a/lisp/interpreter.lisp +++ b/lisp/interpreter.lisp @@ -32,8 +32,6 @@ ;;; (defcommand ) (defcommand define-place place) -(defcommand define-race race) -(defcommand define-class character-class) (defcommand define-player player) (defcommand define-monster monster) (defcommand define-weapon weapon) diff --git a/lisp/player.lisp b/lisp/player.lisp index 430a21b..08cf181 100644 --- a/lisp/player.lisp +++ b/lisp/player.lisp @@ -12,8 +12,7 @@ (defstruct player (name "") - (race "") - (class "") + (description "") (strength 0) (dexterity 0) (constitution 0) @@ -34,21 +33,6 @@ ;; XXX Make this configurable in ATL? (defvar *level-experience* 100) -(defstruct race - (name "") - (description "") - (strength-bonus 0) - (dexterity-bonus 0) - (constitution-bonus 0) - (intelligence-bonus 0) - (special-ability NIL)) - -(defstruct character-class - (name "") - (description "") - (special-item NIL) - (special-ability NIL)) - (defun add-player (player) "Add this player to the game world" @@ -59,12 +43,7 @@ "Change the player's location and do housekeeping" (setf location (to-string location)) (objectify-place-monsters location) - (when (player-place player) - (remove-object-attribute (get-game-object 'place (player-place player)) - 'player (player-name player))) - (set-object-attribute player 'place location) - (set-object-attribute (get-game-object 'place location) - 'player (player-name player))) + (set-object-attribute player 'place location)) ;; XXX This function is probably superfluous, as the player struct should only ;; store names of game objects (the actual objects are stored in *world*) diff --git a/lisp/ui.lisp b/lisp/ui.lisp index bbb1fd8..406322d 100644 --- a/lisp/ui.lisp +++ b/lisp/ui.lisp @@ -37,8 +37,6 @@ (defun create-player (player-name) "The user creates a new player" ;; FIXME Remove this entirely. Game authors should define all playable characters. - ;; TODO Rewrite this if possible - ;; XXX This function feels somewhat ugly - any possibility of a cleanup? (let* ((start-player (get-game-object 'player "Start")) (player (if start-player (copy-player start-player) ;FIXME adjust the name (make-player :name player-name @@ -50,21 +48,6 @@ (character-points NIL)) (format t "~&The name you have chosen is not registered on this game.") (unless (y-or-n-p "~&Create a new player?") (start-menu) (quit)) - ;; Chose race and class - (format t "~&Please chose a race:") - (setf (player-race player) (choose-option (list-world-objects 'race))) - (format t "~&Please chose a class:") - (setf (player-class player) - (choose-option (list-world-objects 'character-class))) - (dolist (i (character-class-special-item - (get-game-object 'character-class (player-class player)))) - (set-object-attribute player 'item i)) - (dolist (ac (character-class-special-ability - (get-game-object 'character-class (player-class player)))) - (set-object-attribute player 'ability ac)) - (dolist (ac (race-special-ability - (get-game-object 'race (player-race player)))) - (set-object-attribute player 'ability ar)) ;; Set character attributes (while (or (< (reduce #'+ character-points) 24) ; XXX magic number! (not (set-p character-points))) @@ -99,7 +82,6 @@ (format t "~&~%~A" (place-description p)) (format t "~&~%Neighbouring places: ~A" (string-from-list (place-neighbour p))) - (format t "~&Players present: ~A" (string-from-list (place-player p))) (format t "~&Items: ~A" (string-from-list (place-item p))) (format t "~&NPCs: ~A" (string-from-list (place-npc p))) (format t "~&Monsters: ~A" (string-from-list @@ -123,11 +105,10 @@ ;; A list of all in-game commands. Each new command must be registered here. (defvar *commands* - '(help place player - goto pickup drop - talk trade + '(help player goto pickup + drop talk trade equip attack spell - about save clear)) + look save clear)) ;;; The following commands don't take any arguments except for a player @@ -168,7 +149,6 @@ (when (stringp p) (setf p (get-game-object 'player p))) (format t "~&Player ~A:" (player-name p)) (format t "~&~%Current place: ~A" (player-place p)) - (format t "~&Race: ~A~AClass: ~A" (player-race p) tab (player-class p)) (format t "~&=====~&Attributes:") (format t "~&Intelligence: ~A~AStrength: ~A" (player-intelligence p) tab (player-strength p)) @@ -235,11 +215,11 @@ (defun look (player &optional object-name) "Print a description of this object" (unless object-name - (describe-place (player-place player)) + (place player) (return-from look)) ;; A bit of syntactic sugar... - (cond ((equalp object-name "me") (player player) (return-from about)) - ((equalp object-name "here") (place player) (return-from about))) + (cond ((equalp object-name "me") (player player) (return-from look)) + ((equalp object-name "here") (place player) (return-from look))) (let ((description (get-object-description object-name (player-place player)))) ;; Don't forget items the player is carrying diff --git a/lisp/world.lisp b/lisp/world.lisp index 29c6346..eee42dd 100644 --- a/lisp/world.lisp +++ b/lisp/world.lisp @@ -19,8 +19,6 @@ (defstruct world (name "") (players NIL) - (character-classs NIL) ;Bad English because of parsing issues - (races NIL) (places NIL) (monsters NIL) (npcs NIL) diff --git a/saves/pooh1 b/saves/pooh1 new file mode 100644 index 0000000..49e38ee --- /dev/null +++ b/saves/pooh1 @@ -0,0 +1,51 @@ +(0 2 1) +#S(WORLD :NAME "100 Acre Wood" + :PLAYERS + (#S(PLAYER :NAME "Winnie the Pooh" :DESCRIPTION "A small but very lovable bear of very little brain." :STRENGTH 0 :DEXTERITY 0 :CONSTITUTION 0 :INTELLIGENCE 0 + :MONEY 0 :ABILITY NIL :ITEM NIL :WEAPON "" :ARMOUR-CLASS 0 :PLACE "Western woods" :EXPERIENCE 2 :LEVEL 0 :MAX-HEALTH 50 :HEALTH 50)) + :PLACES + (#S(PLACE :NAME "Pooh's home" + :DESCRIPTION + "Welcome home! This is what you call comfort: your bed, your +chair, your table. Not to forget your larder, filled with +delicious honey..." + :NEIGHBOUR ("Pooh's porch" "Pooh's branch") :ITEM ("Hunny") :MONSTER NIL :NPC NIL :SPAWNS NIL :REQUIRES "" :FUNCTION "") + #S(PLACE :NAME "Pooh's porch" + :DESCRIPTION + "You are standing in front of Pooh's home. Here he lives under +the name 'Sanders', as anyone can see by the old sign planted +beside the door. A comfy-looking bench stands in the sun, inviting +you to a well-earned rest." + :NEIGHBOUR ("Pooh's home" "Western woods") :ITEM ("Pooh's sign") :MONSTER NIL :NPC NIL :SPAWNS NIL :REQUIRES "" :FUNCTION "") + #S(PLACE :NAME "Pooh's branch" + :DESCRIPTION + "This is a thick branch above Pooh's home. Once, on a very +blustery day, Pooh had to escape to up here. Since then, he +keeps an emergency ration of honey handy." + :NEIGHBOUR ("Pooh's home" "Pooh's porch") :ITEM ("Hunny") :MONSTER NIL :NPC NIL :SPAWNS NIL :REQUIRES "" :FUNCTION "") + #S(PLACE :NAME "Western woods" + :DESCRIPTION + "This is the western part of the 100 Acre Wood. As you would +expect in a wood, it is full of trees. Here, however, there are +not quite that many - mainly young birches." + :NEIGHBOUR ("Pooh's porch" "Central woods" "Northern woods" "Southern woods" "Piglet's porch") :ITEM NIL :MONSTER NIL :NPC NIL :SPAWNS NIL :REQUIRES "" + :FUNCTION "")) + :MONSTERS NIL :NPCS NIL + :ITEMS + (#S(ITEM :NAME "Hunny" :DESCRIPTION "A jar full to the brim of delicious, golden honey. Hmmmm..." :COST 0 :WEAPON NIL :FUNCTION NIL :ABILITY NIL) + #S(ITEM :NAME "Pooh's sign" + :DESCRIPTION + " +SANDERS +" + :COST 0 :WEAPON NIL :FUNCTION NIL :ABILITY NIL) + #S(ITEM :NAME "Piglet's sign" + :DESCRIPTION + " +____________________ +| _ +| TRESPASSERS WILL > +|____________________< +" + :COST 0 :WEAPON NIL :FUNCTION NIL :ABILITY NIL)) + :WEAPONS NIL :QUESTS NIL :GAME-FUNCTIONS NIL)