diff --git a/ATL/Lugwey/items.atl b/ATL/Lugwey/items.atl index f7ee691..13b694b 100644 --- a/ATL/Lugwey/items.atl +++ b/ATL/Lugwey/items.atl @@ -17,7 +17,7 @@ define-item "Dagger" description "A long, sharp knife, useful for self defence." - weapon "Yes" + weapon cost 20 define-weapon "Dagger" @@ -31,7 +31,7 @@ define-item "Whip" description "A horse-whip." - weapon "yes" + weapon cost 10 define-weapon "Whip" @@ -100,7 +100,7 @@ strength 3 dexterity 5 aggression 75 - spawn-probability 40 + spawn 40 weapon "Teeth" item "Foxhide" armour-class 0 diff --git a/ATL/Lugwey/items.atl b/ATL/Lugwey/items.atl index f7ee691..13b694b 100644 --- a/ATL/Lugwey/items.atl +++ b/ATL/Lugwey/items.atl @@ -17,7 +17,7 @@ define-item "Dagger" description "A long, sharp knife, useful for self defence." - weapon "Yes" + weapon cost 20 define-weapon "Dagger" @@ -31,7 +31,7 @@ define-item "Whip" description "A horse-whip." - weapon "yes" + weapon cost 10 define-weapon "Whip" @@ -100,7 +100,7 @@ strength 3 dexterity 5 aggression 75 - spawn-probability 40 + spawn 40 weapon "Teeth" item "Foxhide" armour-class 0 diff --git a/ATL/Lugwey/lugwey.atl b/ATL/Lugwey/lugwey.atl index df42617..5e68b2d 100644 --- a/ATL/Lugwey/lugwey.atl +++ b/ATL/Lugwey/lugwey.atl @@ -35,10 +35,10 @@ item "Lantern" ; night-vision -define-function "light" - docstring "Gives the player night vision" - player night-vision - print "You now have night vision!" +; define-function "light" +; docstring "Gives the player night vision" +; player night-vision +; print "You now have night vision!" load-file "places.atl" load-file "items.atl" diff --git a/ATL/Lugwey/items.atl b/ATL/Lugwey/items.atl index f7ee691..13b694b 100644 --- a/ATL/Lugwey/items.atl +++ b/ATL/Lugwey/items.atl @@ -17,7 +17,7 @@ define-item "Dagger" description "A long, sharp knife, useful for self defence." - weapon "Yes" + weapon cost 20 define-weapon "Dagger" @@ -31,7 +31,7 @@ define-item "Whip" description "A horse-whip." - weapon "yes" + weapon cost 10 define-weapon "Whip" @@ -100,7 +100,7 @@ strength 3 dexterity 5 aggression 75 - spawn-probability 40 + spawn 40 weapon "Teeth" item "Foxhide" armour-class 0 diff --git a/ATL/Lugwey/lugwey.atl b/ATL/Lugwey/lugwey.atl index df42617..5e68b2d 100644 --- a/ATL/Lugwey/lugwey.atl +++ b/ATL/Lugwey/lugwey.atl @@ -35,10 +35,10 @@ item "Lantern" ; night-vision -define-function "light" - docstring "Gives the player night vision" - player night-vision - print "You now have night vision!" +; define-function "light" +; docstring "Gives the player night vision" +; player night-vision +; print "You now have night vision!" load-file "places.atl" load-file "items.atl" diff --git a/ATL/test/game-objects.atl b/ATL/test/game-objects.atl index 19a648a..0a219ea 100644 --- a/ATL/test/game-objects.atl +++ b/ATL/test/game-objects.atl @@ -9,8 +9,15 @@ dexterity 20 strength 10 aggression 30 + spawn 50 armour-class 3 weapon "fire-whip" + item "fire-whip" + +define-item "fire-whip" + description "A 10-foot long whip, blazing with magical fire" + cost 180 + weapon define-weapon "fire-whip" description "A 10-foot long whip, blazing with magical fire" @@ -19,11 +26,11 @@ define-item "Anaklusmos" description "Riptide, a sword for heroes!" - weapon "yes" + weapon define-item "Lightning bolt" description "Zeus lightning bolt - the most powerful weapon of the universe!" - weapon "yes" + weapon define-weapon "Anaklusmos" description "Riptide, a sword for heroes!" diff --git a/ATL/Lugwey/items.atl b/ATL/Lugwey/items.atl index f7ee691..13b694b 100644 --- a/ATL/Lugwey/items.atl +++ b/ATL/Lugwey/items.atl @@ -17,7 +17,7 @@ define-item "Dagger" description "A long, sharp knife, useful for self defence." - weapon "Yes" + weapon cost 20 define-weapon "Dagger" @@ -31,7 +31,7 @@ define-item "Whip" description "A horse-whip." - weapon "yes" + weapon cost 10 define-weapon "Whip" @@ -100,7 +100,7 @@ strength 3 dexterity 5 aggression 75 - spawn-probability 40 + spawn 40 weapon "Teeth" item "Foxhide" armour-class 0 diff --git a/ATL/Lugwey/lugwey.atl b/ATL/Lugwey/lugwey.atl index df42617..5e68b2d 100644 --- a/ATL/Lugwey/lugwey.atl +++ b/ATL/Lugwey/lugwey.atl @@ -35,10 +35,10 @@ item "Lantern" ; night-vision -define-function "light" - docstring "Gives the player night vision" - player night-vision - print "You now have night vision!" +; define-function "light" +; docstring "Gives the player night vision" +; player night-vision +; print "You now have night vision!" load-file "places.atl" load-file "items.atl" diff --git a/ATL/test/game-objects.atl b/ATL/test/game-objects.atl index 19a648a..0a219ea 100644 --- a/ATL/test/game-objects.atl +++ b/ATL/test/game-objects.atl @@ -9,8 +9,15 @@ dexterity 20 strength 10 aggression 30 + spawn 50 armour-class 3 weapon "fire-whip" + item "fire-whip" + +define-item "fire-whip" + description "A 10-foot long whip, blazing with magical fire" + cost 180 + weapon define-weapon "fire-whip" description "A 10-foot long whip, blazing with magical fire" @@ -19,11 +26,11 @@ define-item "Anaklusmos" description "Riptide, a sword for heroes!" - weapon "yes" + weapon define-item "Lightning bolt" description "Zeus lightning bolt - the most powerful weapon of the universe!" - weapon "yes" + weapon define-weapon "Anaklusmos" description "Riptide, a sword for heroes!" diff --git a/ATL/test/lisp-test.atl b/ATL/test/lisp-test.atl index eed1c62..81c1d7c 100644 --- a/ATL/test/lisp-test.atl +++ b/ATL/test/lisp-test.atl @@ -15,6 +15,7 @@ You are in the void, the space between the worlds. Around you is black. Black, except for one tiny pin-prick of light to the north." neighbour "Styx" + dark define-place "Elysium" description "This is where you want to be when you are six feet under..." @@ -29,6 +30,7 @@ neighbour "Elysium" neighbour "Fields of Asphodel" monster "Fury" + spawns "Fury" define-place "Fields of Asphodel" description "Nothing special. Really, nothing special at all. @@ -45,10 +47,10 @@ item "Anaklusmos" npc "Charon" -define-function "Light" - docstring "Gives a player night-vision" - player night-vision T - print "You can now see in the dark!" +; define-function "Light" +; docstring "Gives a player night-vision" +; player night-vision T +; print "You can now see in the dark!" define-function "Spawn Fury" docstring "Spawn a Fury in this place" diff --git a/ATL/Lugwey/items.atl b/ATL/Lugwey/items.atl index f7ee691..13b694b 100644 --- a/ATL/Lugwey/items.atl +++ b/ATL/Lugwey/items.atl @@ -17,7 +17,7 @@ define-item "Dagger" description "A long, sharp knife, useful for self defence." - weapon "Yes" + weapon cost 20 define-weapon "Dagger" @@ -31,7 +31,7 @@ define-item "Whip" description "A horse-whip." - weapon "yes" + weapon cost 10 define-weapon "Whip" @@ -100,7 +100,7 @@ strength 3 dexterity 5 aggression 75 - spawn-probability 40 + spawn 40 weapon "Teeth" item "Foxhide" armour-class 0 diff --git a/ATL/Lugwey/lugwey.atl b/ATL/Lugwey/lugwey.atl index df42617..5e68b2d 100644 --- a/ATL/Lugwey/lugwey.atl +++ b/ATL/Lugwey/lugwey.atl @@ -35,10 +35,10 @@ item "Lantern" ; night-vision -define-function "light" - docstring "Gives the player night vision" - player night-vision - print "You now have night vision!" +; define-function "light" +; docstring "Gives the player night vision" +; player night-vision +; print "You now have night vision!" load-file "places.atl" load-file "items.atl" diff --git a/ATL/test/game-objects.atl b/ATL/test/game-objects.atl index 19a648a..0a219ea 100644 --- a/ATL/test/game-objects.atl +++ b/ATL/test/game-objects.atl @@ -9,8 +9,15 @@ dexterity 20 strength 10 aggression 30 + spawn 50 armour-class 3 weapon "fire-whip" + item "fire-whip" + +define-item "fire-whip" + description "A 10-foot long whip, blazing with magical fire" + cost 180 + weapon define-weapon "fire-whip" description "A 10-foot long whip, blazing with magical fire" @@ -19,11 +26,11 @@ define-item "Anaklusmos" description "Riptide, a sword for heroes!" - weapon "yes" + weapon define-item "Lightning bolt" description "Zeus lightning bolt - the most powerful weapon of the universe!" - weapon "yes" + weapon define-weapon "Anaklusmos" description "Riptide, a sword for heroes!" diff --git a/ATL/test/lisp-test.atl b/ATL/test/lisp-test.atl index eed1c62..81c1d7c 100644 --- a/ATL/test/lisp-test.atl +++ b/ATL/test/lisp-test.atl @@ -15,6 +15,7 @@ You are in the void, the space between the worlds. Around you is black. Black, except for one tiny pin-prick of light to the north." neighbour "Styx" + dark define-place "Elysium" description "This is where you want to be when you are six feet under..." @@ -29,6 +30,7 @@ neighbour "Elysium" neighbour "Fields of Asphodel" monster "Fury" + spawns "Fury" define-place "Fields of Asphodel" description "Nothing special. Really, nothing special at all. @@ -45,10 +47,10 @@ item "Anaklusmos" npc "Charon" -define-function "Light" - docstring "Gives a player night-vision" - player night-vision T - print "You can now see in the dark!" +; define-function "Light" +; docstring "Gives a player night-vision" +; player night-vision T +; print "You can now see in the dark!" define-function "Spawn Fury" docstring "Spawn a Fury in this place" diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 3183153..ab7a257 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -66,6 +66,7 @@ (money 0) (experience 0)) +;; TODO Needs a complete overhaul (defstruct game-function (name "") (docstring "") diff --git a/ATL/Lugwey/items.atl b/ATL/Lugwey/items.atl index f7ee691..13b694b 100644 --- a/ATL/Lugwey/items.atl +++ b/ATL/Lugwey/items.atl @@ -17,7 +17,7 @@ define-item "Dagger" description "A long, sharp knife, useful for self defence." - weapon "Yes" + weapon cost 20 define-weapon "Dagger" @@ -31,7 +31,7 @@ define-item "Whip" description "A horse-whip." - weapon "yes" + weapon cost 10 define-weapon "Whip" @@ -100,7 +100,7 @@ strength 3 dexterity 5 aggression 75 - spawn-probability 40 + spawn 40 weapon "Teeth" item "Foxhide" armour-class 0 diff --git a/ATL/Lugwey/lugwey.atl b/ATL/Lugwey/lugwey.atl index df42617..5e68b2d 100644 --- a/ATL/Lugwey/lugwey.atl +++ b/ATL/Lugwey/lugwey.atl @@ -35,10 +35,10 @@ item "Lantern" ; night-vision -define-function "light" - docstring "Gives the player night vision" - player night-vision - print "You now have night vision!" +; define-function "light" +; docstring "Gives the player night vision" +; player night-vision +; print "You now have night vision!" load-file "places.atl" load-file "items.atl" diff --git a/ATL/test/game-objects.atl b/ATL/test/game-objects.atl index 19a648a..0a219ea 100644 --- a/ATL/test/game-objects.atl +++ b/ATL/test/game-objects.atl @@ -9,8 +9,15 @@ dexterity 20 strength 10 aggression 30 + spawn 50 armour-class 3 weapon "fire-whip" + item "fire-whip" + +define-item "fire-whip" + description "A 10-foot long whip, blazing with magical fire" + cost 180 + weapon define-weapon "fire-whip" description "A 10-foot long whip, blazing with magical fire" @@ -19,11 +26,11 @@ define-item "Anaklusmos" description "Riptide, a sword for heroes!" - weapon "yes" + weapon define-item "Lightning bolt" description "Zeus lightning bolt - the most powerful weapon of the universe!" - weapon "yes" + weapon define-weapon "Anaklusmos" description "Riptide, a sword for heroes!" diff --git a/ATL/test/lisp-test.atl b/ATL/test/lisp-test.atl index eed1c62..81c1d7c 100644 --- a/ATL/test/lisp-test.atl +++ b/ATL/test/lisp-test.atl @@ -15,6 +15,7 @@ You are in the void, the space between the worlds. Around you is black. Black, except for one tiny pin-prick of light to the north." neighbour "Styx" + dark define-place "Elysium" description "This is where you want to be when you are six feet under..." @@ -29,6 +30,7 @@ neighbour "Elysium" neighbour "Fields of Asphodel" monster "Fury" + spawns "Fury" define-place "Fields of Asphodel" description "Nothing special. Really, nothing special at all. @@ -45,10 +47,10 @@ item "Anaklusmos" npc "Charon" -define-function "Light" - docstring "Gives a player night-vision" - player night-vision T - print "You can now see in the dark!" +; define-function "Light" +; docstring "Gives a player night-vision" +; player night-vision T +; print "You can now see in the dark!" define-function "Spawn Fury" docstring "Spawn a Fury in this place" diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 3183153..ab7a257 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -66,6 +66,7 @@ (money 0) (experience 0)) +;; TODO Needs a complete overhaul (defstruct game-function (name "") (docstring "") diff --git a/lisp/player.lisp b/lisp/player.lisp index fac2547..fb19e22 100644 --- a/lisp/player.lisp +++ b/lisp/player.lisp @@ -27,7 +27,7 @@ (level 0) (max-health 50) (health 50) - (night-vision NIL) ;This needs to be shifted into a list of abilities + (abilities '(night-vision)) (game-admin NIL)) ;; How many XP are needed to level up? @@ -75,6 +75,10 @@ "Get a list of the names of all the player's objects of this type." (funcall list-function object-type player))) +(defun player-has-ability (ability player) + "Check whether a player has the given ability" + (member ability (player-abilities player) :test #'equalp)) + (defun change-player-health (player amount) "Change the player's health points" (incf (player-health player) amount) diff --git a/ATL/Lugwey/items.atl b/ATL/Lugwey/items.atl index f7ee691..13b694b 100644 --- a/ATL/Lugwey/items.atl +++ b/ATL/Lugwey/items.atl @@ -17,7 +17,7 @@ define-item "Dagger" description "A long, sharp knife, useful for self defence." - weapon "Yes" + weapon cost 20 define-weapon "Dagger" @@ -31,7 +31,7 @@ define-item "Whip" description "A horse-whip." - weapon "yes" + weapon cost 10 define-weapon "Whip" @@ -100,7 +100,7 @@ strength 3 dexterity 5 aggression 75 - spawn-probability 40 + spawn 40 weapon "Teeth" item "Foxhide" armour-class 0 diff --git a/ATL/Lugwey/lugwey.atl b/ATL/Lugwey/lugwey.atl index df42617..5e68b2d 100644 --- a/ATL/Lugwey/lugwey.atl +++ b/ATL/Lugwey/lugwey.atl @@ -35,10 +35,10 @@ item "Lantern" ; night-vision -define-function "light" - docstring "Gives the player night vision" - player night-vision - print "You now have night vision!" +; define-function "light" +; docstring "Gives the player night vision" +; player night-vision +; print "You now have night vision!" load-file "places.atl" load-file "items.atl" diff --git a/ATL/test/game-objects.atl b/ATL/test/game-objects.atl index 19a648a..0a219ea 100644 --- a/ATL/test/game-objects.atl +++ b/ATL/test/game-objects.atl @@ -9,8 +9,15 @@ dexterity 20 strength 10 aggression 30 + spawn 50 armour-class 3 weapon "fire-whip" + item "fire-whip" + +define-item "fire-whip" + description "A 10-foot long whip, blazing with magical fire" + cost 180 + weapon define-weapon "fire-whip" description "A 10-foot long whip, blazing with magical fire" @@ -19,11 +26,11 @@ define-item "Anaklusmos" description "Riptide, a sword for heroes!" - weapon "yes" + weapon define-item "Lightning bolt" description "Zeus lightning bolt - the most powerful weapon of the universe!" - weapon "yes" + weapon define-weapon "Anaklusmos" description "Riptide, a sword for heroes!" diff --git a/ATL/test/lisp-test.atl b/ATL/test/lisp-test.atl index eed1c62..81c1d7c 100644 --- a/ATL/test/lisp-test.atl +++ b/ATL/test/lisp-test.atl @@ -15,6 +15,7 @@ You are in the void, the space between the worlds. Around you is black. Black, except for one tiny pin-prick of light to the north." neighbour "Styx" + dark define-place "Elysium" description "This is where you want to be when you are six feet under..." @@ -29,6 +30,7 @@ neighbour "Elysium" neighbour "Fields of Asphodel" monster "Fury" + spawns "Fury" define-place "Fields of Asphodel" description "Nothing special. Really, nothing special at all. @@ -45,10 +47,10 @@ item "Anaklusmos" npc "Charon" -define-function "Light" - docstring "Gives a player night-vision" - player night-vision T - print "You can now see in the dark!" +; define-function "Light" +; docstring "Gives a player night-vision" +; player night-vision T +; print "You can now see in the dark!" define-function "Spawn Fury" docstring "Spawn a Fury in this place" diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 3183153..ab7a257 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -66,6 +66,7 @@ (money 0) (experience 0)) +;; TODO Needs a complete overhaul (defstruct game-function (name "") (docstring "") diff --git a/lisp/player.lisp b/lisp/player.lisp index fac2547..fb19e22 100644 --- a/lisp/player.lisp +++ b/lisp/player.lisp @@ -27,7 +27,7 @@ (level 0) (max-health 50) (health 50) - (night-vision NIL) ;This needs to be shifted into a list of abilities + (abilities '(night-vision)) (game-admin NIL)) ;; How many XP are needed to level up? @@ -75,6 +75,10 @@ "Get a list of the names of all the player's objects of this type." (funcall list-function object-type player))) +(defun player-has-ability (ability player) + "Check whether a player has the given ability" + (member ability (player-abilities player) :test #'equalp)) + (defun change-player-health (player amount) "Change the player's health points" (incf (player-health player) amount) diff --git a/lisp/ui.lisp b/lisp/ui.lisp index f2699b1..c9a6ffd 100644 --- a/lisp/ui.lisp +++ b/lisp/ui.lisp @@ -25,7 +25,7 @@ ;; The actual game loop (clear-screen) (let ((place (get-game-object 'place (player-place player)))) - (describe-place place (player-night-vision player)) + (describe-place place (player-has-ability "night-vision" player)) (input-string command) (while (not (or (equalp command "quit") (equalp command "exit"))) (game-command command player) @@ -153,7 +153,8 @@ ;; identical with the struct name) Probably not, but best to be aware. (defun place (player) "Describe the player's current location (wrapper function)" - (describe-place (player-place player) (player-night-vision player))) + (describe-place (player-place player) + (player-has-ability "night-vision" player))) (defun player (p) "Print a description of this player" @@ -169,7 +170,7 @@ (format t "~&Constitution: ~A~ADexterity: ~A" (player-constitution p) tab (player-dexterity p)) (format t "~&Night vision: ~A" - (if (player-night-vision p) "yes" "no")) + (if (player-has-ability "night-vision" p) "yes" "no")) (format t "~&=====") (format t "~&Weapon: ~A" (player-weapon p)) ;; XXX This will need adjusting for large item numbers @@ -216,7 +217,7 @@ (change-player-location player location) (spawn-monsters location) (add-player-experience player 1) - (describe-place location (player-night-vision player))) + (describe-place location (player-has-ability "night-vision" player))) (defun about (player &optional object-name) "Print a description of this object"