diff --git a/ATL/atl-mode.el b/ATL/atl-mode.el index efab9cf..598c28c 100644 --- a/ATL/atl-mode.el +++ b/ATL/atl-mode.el @@ -13,7 +13,8 @@ ;; define commands '("define-place" "define-item" "define-monster" "define-npc" "define-race" "define-place" "define-weapon" - "define-class" "name-world" "load-file" "start-place") + "define-class" "name-world" "load-file" + "start-place" "start-money") '() ;; other commands (adjust this?) '("\\.atl$") ;; files for which to activate this mode '(linum-mode) ;; other functions to call diff --git a/ATL/atl-mode.el b/ATL/atl-mode.el index efab9cf..598c28c 100644 --- a/ATL/atl-mode.el +++ b/ATL/atl-mode.el @@ -13,7 +13,8 @@ ;; define commands '("define-place" "define-item" "define-monster" "define-npc" "define-race" "define-place" "define-weapon" - "define-class" "name-world" "load-file" "start-place") + "define-class" "name-world" "load-file" + "start-place" "start-money") '() ;; other commands (adjust this?) '("\\.atl$") ;; files for which to activate this mode '(linum-mode) ;; other functions to call diff --git a/ATL/creator-test.atl b/ATL/creator-test.atl index fa40b88..6209e7c 100644 --- a/ATL/creator-test.atl +++ b/ATL/creator-test.atl @@ -1,185 +1,185 @@ ;; This code has been automatically generated by the ;; Atlantis world creator. -define-item Rope (20m) +define-item "Rope (20m)" cost 5 -define-item Backpack +define-item "Backpack" cost 5 -define-item Knife +define-item "Knife" cost 10 -define-item Short sword +define-item "Short sword" cost 40 -define-item Long sword +define-item "Long sword" cost 80 -define-item Dagger +define-item "Dagger" cost 20 -define-item Spear +define-item "Spear" cost 25 -define-item Short bow +define-item "Short bow" cost 30 -define-item Longbow +define-item "Longbow" cost 60 -define-item Slingshot +define-item "Slingshot" cost 15 -define-item Throwing knife +define-item "Throwing knife" cost 15 -define-item Quiver of arrows +define-item "Quiver of arrows" cost 20 -define-item Leather armour +define-item "Leather armour" cost 60 -define-item Chain mail +define-item "Chain mail" cost 120 -define-item Plate armour +define-item "Plate armour" cost 200 -define-item Buckler +define-item "Buckler" cost 35 -define-item Full shield +define-item "Full shield" cost 45 -define-item Candles (3x) +define-item "Candles (3x)" cost 5 -define-item Matches +define-item "Matches" cost 1 -define-item Food rations (5x) +define-item "Food rations (5x)" cost 10 -define-item Grappling hook +define-item "Grappling hook" cost 15 -define-item Fishing net +define-item "Fishing net" cost 25 -define-item Fishing rod +define-item "Fishing rod" cost 15 -define-item Tent (2 people) +define-item "Tent (2 people)" cost 30 -define-item Cloak +define-item "Cloak" cost 15 -define-item Hat +define-item "Hat" cost 10 -define-item Water bottle +define-item "Water bottle" cost 5 -define-item Compass +define-item "Compass" cost 20 -define-item Quill and ink +define-item "Quill and ink" cost 5 -define-item Parchment +define-item "Parchment" cost 5 -define-item Blanket +define-item "Blanket" cost 5 -define-item Book of Legends +define-item "Book of Legends" cost 55 -define-item Book of Lore +define-item "Book of Lore" cost 55 -define-item Medicinal herbs +define-item "Medicinal herbs" cost 10 -define-item Bandages (3x) +define-item "Bandages (3x)" cost 5 -define-item Tea leaves +define-item "Tea leaves" cost 5 -define-item Sleeping potion +define-item "Sleeping potion" cost 15 -define-item Leather pouch +define-item "Leather pouch" cost 2 -define-item Face mask +define-item "Face mask" cost 10 -define-item Dye +define-item "Dye" cost 5 -define-item Cloth +define-item "Cloth" cost 5 -define-item Scissors +define-item "Scissors" cost 15 -define-item Needle and thread +define-item "Needle and thread" cost 3 -define-item Canvas +define-item "Canvas" cost 8 -define-item String +define-item "String" cost 2 -define-item Hatchet +define-item "Hatchet" cost 20 -define-item Map +define-item "Map" cost 35 -define-item Pony +define-item "Pony" cost 100 -define-item Horse +define-item "Horse" cost 180 -define-item Saddle and bridle +define-item "Saddle and bridle" cost 45 -define-item Saddlebag +define-item "Saddlebag" cost 35 -define-item Handmirror +define-item "Handmirror" cost 20 -define-item Magnifying glass +define-item "Magnifying glass" cost 20 -define-item Telescope +define-item "Telescope" cost 40 -define-item Rope ladder +define-item "Rope ladder" cost 15 -define-item Torches (3x) +define-item "Torches (3x)" cost 10 -define-item Staff +define-item "Staff" cost 10 -define-item Cooking pot +define-item "Cooking pot" cost 8 -define-item Soap +define-item "Soap" cost 2 -define-item Towel +define-item "Towel" cost 5 -define-item Boots +define-item "Boots" cost 10 \ No newline at end of file diff --git a/ATL/atl-mode.el b/ATL/atl-mode.el index efab9cf..598c28c 100644 --- a/ATL/atl-mode.el +++ b/ATL/atl-mode.el @@ -13,7 +13,8 @@ ;; define commands '("define-place" "define-item" "define-monster" "define-npc" "define-race" "define-place" "define-weapon" - "define-class" "name-world" "load-file" "start-place") + "define-class" "name-world" "load-file" + "start-place" "start-money") '() ;; other commands (adjust this?) '("\\.atl$") ;; files for which to activate this mode '(linum-mode) ;; other functions to call diff --git a/ATL/creator-test.atl b/ATL/creator-test.atl index fa40b88..6209e7c 100644 --- a/ATL/creator-test.atl +++ b/ATL/creator-test.atl @@ -1,185 +1,185 @@ ;; This code has been automatically generated by the ;; Atlantis world creator. -define-item Rope (20m) +define-item "Rope (20m)" cost 5 -define-item Backpack +define-item "Backpack" cost 5 -define-item Knife +define-item "Knife" cost 10 -define-item Short sword +define-item "Short sword" cost 40 -define-item Long sword +define-item "Long sword" cost 80 -define-item Dagger +define-item "Dagger" cost 20 -define-item Spear +define-item "Spear" cost 25 -define-item Short bow +define-item "Short bow" cost 30 -define-item Longbow +define-item "Longbow" cost 60 -define-item Slingshot +define-item "Slingshot" cost 15 -define-item Throwing knife +define-item "Throwing knife" cost 15 -define-item Quiver of arrows +define-item "Quiver of arrows" cost 20 -define-item Leather armour +define-item "Leather armour" cost 60 -define-item Chain mail +define-item "Chain mail" cost 120 -define-item Plate armour +define-item "Plate armour" cost 200 -define-item Buckler +define-item "Buckler" cost 35 -define-item Full shield +define-item "Full shield" cost 45 -define-item Candles (3x) +define-item "Candles (3x)" cost 5 -define-item Matches +define-item "Matches" cost 1 -define-item Food rations (5x) +define-item "Food rations (5x)" cost 10 -define-item Grappling hook +define-item "Grappling hook" cost 15 -define-item Fishing net +define-item "Fishing net" cost 25 -define-item Fishing rod +define-item "Fishing rod" cost 15 -define-item Tent (2 people) +define-item "Tent (2 people)" cost 30 -define-item Cloak +define-item "Cloak" cost 15 -define-item Hat +define-item "Hat" cost 10 -define-item Water bottle +define-item "Water bottle" cost 5 -define-item Compass +define-item "Compass" cost 20 -define-item Quill and ink +define-item "Quill and ink" cost 5 -define-item Parchment +define-item "Parchment" cost 5 -define-item Blanket +define-item "Blanket" cost 5 -define-item Book of Legends +define-item "Book of Legends" cost 55 -define-item Book of Lore +define-item "Book of Lore" cost 55 -define-item Medicinal herbs +define-item "Medicinal herbs" cost 10 -define-item Bandages (3x) +define-item "Bandages (3x)" cost 5 -define-item Tea leaves +define-item "Tea leaves" cost 5 -define-item Sleeping potion +define-item "Sleeping potion" cost 15 -define-item Leather pouch +define-item "Leather pouch" cost 2 -define-item Face mask +define-item "Face mask" cost 10 -define-item Dye +define-item "Dye" cost 5 -define-item Cloth +define-item "Cloth" cost 5 -define-item Scissors +define-item "Scissors" cost 15 -define-item Needle and thread +define-item "Needle and thread" cost 3 -define-item Canvas +define-item "Canvas" cost 8 -define-item String +define-item "String" cost 2 -define-item Hatchet +define-item "Hatchet" cost 20 -define-item Map +define-item "Map" cost 35 -define-item Pony +define-item "Pony" cost 100 -define-item Horse +define-item "Horse" cost 180 -define-item Saddle and bridle +define-item "Saddle and bridle" cost 45 -define-item Saddlebag +define-item "Saddlebag" cost 35 -define-item Handmirror +define-item "Handmirror" cost 20 -define-item Magnifying glass +define-item "Magnifying glass" cost 20 -define-item Telescope +define-item "Telescope" cost 40 -define-item Rope ladder +define-item "Rope ladder" cost 15 -define-item Torches (3x) +define-item "Torches (3x)" cost 10 -define-item Staff +define-item "Staff" cost 10 -define-item Cooking pot +define-item "Cooking pot" cost 8 -define-item Soap +define-item "Soap" cost 2 -define-item Towel +define-item "Towel" cost 5 -define-item Boots +define-item "Boots" cost 10 \ No newline at end of file diff --git a/ATL/game-objects.atl b/ATL/game-objects.atl index a860e54..5e29634 100644 --- a/ATL/game-objects.atl +++ b/ATL/game-objects.atl @@ -4,7 +4,7 @@ ; @date 02/06/2015 define-monster "Fury" - description "Hades messengers, torturers, assassins. Beware!" + description "Hades' messengers, torturers, assassins. Beware!" strength 10 aggression 30 armour-class 3 @@ -28,4 +28,11 @@ define-npc "Charon" description "A robe-clad ghoul, dread ferryman of the Styx." - says "..." \ No newline at end of file + says "..." + +define-npc "Persephone" ;testing the shop system + description "Hades' beautiful wife, bringer of summer." + says "Welcome, my friend from the upper world!" + sells "Sleeping potion" + sells "Handmirror" + sells "Book of Lore" \ No newline at end of file diff --git a/ATL/atl-mode.el b/ATL/atl-mode.el index efab9cf..598c28c 100644 --- a/ATL/atl-mode.el +++ b/ATL/atl-mode.el @@ -13,7 +13,8 @@ ;; define commands '("define-place" "define-item" "define-monster" "define-npc" "define-race" "define-place" "define-weapon" - "define-class" "name-world" "load-file" "start-place") + "define-class" "name-world" "load-file" + "start-place" "start-money") '() ;; other commands (adjust this?) '("\\.atl$") ;; files for which to activate this mode '(linum-mode) ;; other functions to call diff --git a/ATL/creator-test.atl b/ATL/creator-test.atl index fa40b88..6209e7c 100644 --- a/ATL/creator-test.atl +++ b/ATL/creator-test.atl @@ -1,185 +1,185 @@ ;; This code has been automatically generated by the ;; Atlantis world creator. -define-item Rope (20m) +define-item "Rope (20m)" cost 5 -define-item Backpack +define-item "Backpack" cost 5 -define-item Knife +define-item "Knife" cost 10 -define-item Short sword +define-item "Short sword" cost 40 -define-item Long sword +define-item "Long sword" cost 80 -define-item Dagger +define-item "Dagger" cost 20 -define-item Spear +define-item "Spear" cost 25 -define-item Short bow +define-item "Short bow" cost 30 -define-item Longbow +define-item "Longbow" cost 60 -define-item Slingshot +define-item "Slingshot" cost 15 -define-item Throwing knife +define-item "Throwing knife" cost 15 -define-item Quiver of arrows +define-item "Quiver of arrows" cost 20 -define-item Leather armour +define-item "Leather armour" cost 60 -define-item Chain mail +define-item "Chain mail" cost 120 -define-item Plate armour +define-item "Plate armour" cost 200 -define-item Buckler +define-item "Buckler" cost 35 -define-item Full shield +define-item "Full shield" cost 45 -define-item Candles (3x) +define-item "Candles (3x)" cost 5 -define-item Matches +define-item "Matches" cost 1 -define-item Food rations (5x) +define-item "Food rations (5x)" cost 10 -define-item Grappling hook +define-item "Grappling hook" cost 15 -define-item Fishing net +define-item "Fishing net" cost 25 -define-item Fishing rod +define-item "Fishing rod" cost 15 -define-item Tent (2 people) +define-item "Tent (2 people)" cost 30 -define-item Cloak +define-item "Cloak" cost 15 -define-item Hat +define-item "Hat" cost 10 -define-item Water bottle +define-item "Water bottle" cost 5 -define-item Compass +define-item "Compass" cost 20 -define-item Quill and ink +define-item "Quill and ink" cost 5 -define-item Parchment +define-item "Parchment" cost 5 -define-item Blanket +define-item "Blanket" cost 5 -define-item Book of Legends +define-item "Book of Legends" cost 55 -define-item Book of Lore +define-item "Book of Lore" cost 55 -define-item Medicinal herbs +define-item "Medicinal herbs" cost 10 -define-item Bandages (3x) +define-item "Bandages (3x)" cost 5 -define-item Tea leaves +define-item "Tea leaves" cost 5 -define-item Sleeping potion +define-item "Sleeping potion" cost 15 -define-item Leather pouch +define-item "Leather pouch" cost 2 -define-item Face mask +define-item "Face mask" cost 10 -define-item Dye +define-item "Dye" cost 5 -define-item Cloth +define-item "Cloth" cost 5 -define-item Scissors +define-item "Scissors" cost 15 -define-item Needle and thread +define-item "Needle and thread" cost 3 -define-item Canvas +define-item "Canvas" cost 8 -define-item String +define-item "String" cost 2 -define-item Hatchet +define-item "Hatchet" cost 20 -define-item Map +define-item "Map" cost 35 -define-item Pony +define-item "Pony" cost 100 -define-item Horse +define-item "Horse" cost 180 -define-item Saddle and bridle +define-item "Saddle and bridle" cost 45 -define-item Saddlebag +define-item "Saddlebag" cost 35 -define-item Handmirror +define-item "Handmirror" cost 20 -define-item Magnifying glass +define-item "Magnifying glass" cost 20 -define-item Telescope +define-item "Telescope" cost 40 -define-item Rope ladder +define-item "Rope ladder" cost 15 -define-item Torches (3x) +define-item "Torches (3x)" cost 10 -define-item Staff +define-item "Staff" cost 10 -define-item Cooking pot +define-item "Cooking pot" cost 8 -define-item Soap +define-item "Soap" cost 2 -define-item Towel +define-item "Towel" cost 5 -define-item Boots +define-item "Boots" cost 10 \ No newline at end of file diff --git a/ATL/game-objects.atl b/ATL/game-objects.atl index a860e54..5e29634 100644 --- a/ATL/game-objects.atl +++ b/ATL/game-objects.atl @@ -4,7 +4,7 @@ ; @date 02/06/2015 define-monster "Fury" - description "Hades messengers, torturers, assassins. Beware!" + description "Hades' messengers, torturers, assassins. Beware!" strength 10 aggression 30 armour-class 3 @@ -28,4 +28,11 @@ define-npc "Charon" description "A robe-clad ghoul, dread ferryman of the Styx." - says "..." \ No newline at end of file + says "..." + +define-npc "Persephone" ;testing the shop system + description "Hades' beautiful wife, bringer of summer." + says "Welcome, my friend from the upper world!" + sells "Sleeping potion" + sells "Handmirror" + sells "Book of Lore" \ No newline at end of file diff --git a/ATL/lisp-test.atl b/ATL/lisp-test.atl index 5687b44..a89aa59 100644 --- a/ATL/lisp-test.atl +++ b/ATL/lisp-test.atl @@ -15,6 +15,7 @@ neighbour "Styx" neighbour "Fields of Punishment" neighbour "Fields of Asphodel" + npc "Persephone" define-place "Fields of Punishment" description "Precisely where you do NOT want to end up..." @@ -43,4 +44,5 @@ load-file game-objects.atl load-file creator-test.atl -start-place "Styx" \ No newline at end of file +start-place "Styx" +start-money 50 \ No newline at end of file diff --git a/ATL/atl-mode.el b/ATL/atl-mode.el index efab9cf..598c28c 100644 --- a/ATL/atl-mode.el +++ b/ATL/atl-mode.el @@ -13,7 +13,8 @@ ;; define commands '("define-place" "define-item" "define-monster" "define-npc" "define-race" "define-place" "define-weapon" - "define-class" "name-world" "load-file" "start-place") + "define-class" "name-world" "load-file" + "start-place" "start-money") '() ;; other commands (adjust this?) '("\\.atl$") ;; files for which to activate this mode '(linum-mode) ;; other functions to call diff --git a/ATL/creator-test.atl b/ATL/creator-test.atl index fa40b88..6209e7c 100644 --- a/ATL/creator-test.atl +++ b/ATL/creator-test.atl @@ -1,185 +1,185 @@ ;; This code has been automatically generated by the ;; Atlantis world creator. -define-item Rope (20m) +define-item "Rope (20m)" cost 5 -define-item Backpack +define-item "Backpack" cost 5 -define-item Knife +define-item "Knife" cost 10 -define-item Short sword +define-item "Short sword" cost 40 -define-item Long sword +define-item "Long sword" cost 80 -define-item Dagger +define-item "Dagger" cost 20 -define-item Spear +define-item "Spear" cost 25 -define-item Short bow +define-item "Short bow" cost 30 -define-item Longbow +define-item "Longbow" cost 60 -define-item Slingshot +define-item "Slingshot" cost 15 -define-item Throwing knife +define-item "Throwing knife" cost 15 -define-item Quiver of arrows +define-item "Quiver of arrows" cost 20 -define-item Leather armour +define-item "Leather armour" cost 60 -define-item Chain mail +define-item "Chain mail" cost 120 -define-item Plate armour +define-item "Plate armour" cost 200 -define-item Buckler +define-item "Buckler" cost 35 -define-item Full shield +define-item "Full shield" cost 45 -define-item Candles (3x) +define-item "Candles (3x)" cost 5 -define-item Matches +define-item "Matches" cost 1 -define-item Food rations (5x) +define-item "Food rations (5x)" cost 10 -define-item Grappling hook +define-item "Grappling hook" cost 15 -define-item Fishing net +define-item "Fishing net" cost 25 -define-item Fishing rod +define-item "Fishing rod" cost 15 -define-item Tent (2 people) +define-item "Tent (2 people)" cost 30 -define-item Cloak +define-item "Cloak" cost 15 -define-item Hat +define-item "Hat" cost 10 -define-item Water bottle +define-item "Water bottle" cost 5 -define-item Compass +define-item "Compass" cost 20 -define-item Quill and ink +define-item "Quill and ink" cost 5 -define-item Parchment +define-item "Parchment" cost 5 -define-item Blanket +define-item "Blanket" cost 5 -define-item Book of Legends +define-item "Book of Legends" cost 55 -define-item Book of Lore +define-item "Book of Lore" cost 55 -define-item Medicinal herbs +define-item "Medicinal herbs" cost 10 -define-item Bandages (3x) +define-item "Bandages (3x)" cost 5 -define-item Tea leaves +define-item "Tea leaves" cost 5 -define-item Sleeping potion +define-item "Sleeping potion" cost 15 -define-item Leather pouch +define-item "Leather pouch" cost 2 -define-item Face mask +define-item "Face mask" cost 10 -define-item Dye +define-item "Dye" cost 5 -define-item Cloth +define-item "Cloth" cost 5 -define-item Scissors +define-item "Scissors" cost 15 -define-item Needle and thread +define-item "Needle and thread" cost 3 -define-item Canvas +define-item "Canvas" cost 8 -define-item String +define-item "String" cost 2 -define-item Hatchet +define-item "Hatchet" cost 20 -define-item Map +define-item "Map" cost 35 -define-item Pony +define-item "Pony" cost 100 -define-item Horse +define-item "Horse" cost 180 -define-item Saddle and bridle +define-item "Saddle and bridle" cost 45 -define-item Saddlebag +define-item "Saddlebag" cost 35 -define-item Handmirror +define-item "Handmirror" cost 20 -define-item Magnifying glass +define-item "Magnifying glass" cost 20 -define-item Telescope +define-item "Telescope" cost 40 -define-item Rope ladder +define-item "Rope ladder" cost 15 -define-item Torches (3x) +define-item "Torches (3x)" cost 10 -define-item Staff +define-item "Staff" cost 10 -define-item Cooking pot +define-item "Cooking pot" cost 8 -define-item Soap +define-item "Soap" cost 2 -define-item Towel +define-item "Towel" cost 5 -define-item Boots +define-item "Boots" cost 10 \ No newline at end of file diff --git a/ATL/game-objects.atl b/ATL/game-objects.atl index a860e54..5e29634 100644 --- a/ATL/game-objects.atl +++ b/ATL/game-objects.atl @@ -4,7 +4,7 @@ ; @date 02/06/2015 define-monster "Fury" - description "Hades messengers, torturers, assassins. Beware!" + description "Hades' messengers, torturers, assassins. Beware!" strength 10 aggression 30 armour-class 3 @@ -28,4 +28,11 @@ define-npc "Charon" description "A robe-clad ghoul, dread ferryman of the Styx." - says "..." \ No newline at end of file + says "..." + +define-npc "Persephone" ;testing the shop system + description "Hades' beautiful wife, bringer of summer." + says "Welcome, my friend from the upper world!" + sells "Sleeping potion" + sells "Handmirror" + sells "Book of Lore" \ No newline at end of file diff --git a/ATL/lisp-test.atl b/ATL/lisp-test.atl index 5687b44..a89aa59 100644 --- a/ATL/lisp-test.atl +++ b/ATL/lisp-test.atl @@ -15,6 +15,7 @@ neighbour "Styx" neighbour "Fields of Punishment" neighbour "Fields of Asphodel" + npc "Persephone" define-place "Fields of Punishment" description "Precisely where you do NOT want to end up..." @@ -43,4 +44,5 @@ load-file game-objects.atl load-file creator-test.atl -start-place "Styx" \ No newline at end of file +start-place "Styx" +start-money 50 \ No newline at end of file diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 2d248a4..65594ad 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -25,10 +25,10 @@ (load-file "../ATL/lisp-test.atl") (let ((player (make-player :name "Bilbo" :race "Hobbit" :class "Burglar" - :place (world-starting-place *world*) + :place "Elysium" :strength 6 :constitution 12 :dexterity 19 :intelligence 14 - :game-admin T))) + :money 100 :game-admin T))) (add-game-object player) (set-object-attribute (get-game-object 'place (player-place player)) 'player (player-name player)) diff --git a/ATL/atl-mode.el b/ATL/atl-mode.el index efab9cf..598c28c 100644 --- a/ATL/atl-mode.el +++ b/ATL/atl-mode.el @@ -13,7 +13,8 @@ ;; define commands '("define-place" "define-item" "define-monster" "define-npc" "define-race" "define-place" "define-weapon" - "define-class" "name-world" "load-file" "start-place") + "define-class" "name-world" "load-file" + "start-place" "start-money") '() ;; other commands (adjust this?) '("\\.atl$") ;; files for which to activate this mode '(linum-mode) ;; other functions to call diff --git a/ATL/creator-test.atl b/ATL/creator-test.atl index fa40b88..6209e7c 100644 --- a/ATL/creator-test.atl +++ b/ATL/creator-test.atl @@ -1,185 +1,185 @@ ;; This code has been automatically generated by the ;; Atlantis world creator. -define-item Rope (20m) +define-item "Rope (20m)" cost 5 -define-item Backpack +define-item "Backpack" cost 5 -define-item Knife +define-item "Knife" cost 10 -define-item Short sword +define-item "Short sword" cost 40 -define-item Long sword +define-item "Long sword" cost 80 -define-item Dagger +define-item "Dagger" cost 20 -define-item Spear +define-item "Spear" cost 25 -define-item Short bow +define-item "Short bow" cost 30 -define-item Longbow +define-item "Longbow" cost 60 -define-item Slingshot +define-item "Slingshot" cost 15 -define-item Throwing knife +define-item "Throwing knife" cost 15 -define-item Quiver of arrows +define-item "Quiver of arrows" cost 20 -define-item Leather armour +define-item "Leather armour" cost 60 -define-item Chain mail +define-item "Chain mail" cost 120 -define-item Plate armour +define-item "Plate armour" cost 200 -define-item Buckler +define-item "Buckler" cost 35 -define-item Full shield +define-item "Full shield" cost 45 -define-item Candles (3x) +define-item "Candles (3x)" cost 5 -define-item Matches +define-item "Matches" cost 1 -define-item Food rations (5x) +define-item "Food rations (5x)" cost 10 -define-item Grappling hook +define-item "Grappling hook" cost 15 -define-item Fishing net +define-item "Fishing net" cost 25 -define-item Fishing rod +define-item "Fishing rod" cost 15 -define-item Tent (2 people) +define-item "Tent (2 people)" cost 30 -define-item Cloak +define-item "Cloak" cost 15 -define-item Hat +define-item "Hat" cost 10 -define-item Water bottle +define-item "Water bottle" cost 5 -define-item Compass +define-item "Compass" cost 20 -define-item Quill and ink +define-item "Quill and ink" cost 5 -define-item Parchment +define-item "Parchment" cost 5 -define-item Blanket +define-item "Blanket" cost 5 -define-item Book of Legends +define-item "Book of Legends" cost 55 -define-item Book of Lore +define-item "Book of Lore" cost 55 -define-item Medicinal herbs +define-item "Medicinal herbs" cost 10 -define-item Bandages (3x) +define-item "Bandages (3x)" cost 5 -define-item Tea leaves +define-item "Tea leaves" cost 5 -define-item Sleeping potion +define-item "Sleeping potion" cost 15 -define-item Leather pouch +define-item "Leather pouch" cost 2 -define-item Face mask +define-item "Face mask" cost 10 -define-item Dye +define-item "Dye" cost 5 -define-item Cloth +define-item "Cloth" cost 5 -define-item Scissors +define-item "Scissors" cost 15 -define-item Needle and thread +define-item "Needle and thread" cost 3 -define-item Canvas +define-item "Canvas" cost 8 -define-item String +define-item "String" cost 2 -define-item Hatchet +define-item "Hatchet" cost 20 -define-item Map +define-item "Map" cost 35 -define-item Pony +define-item "Pony" cost 100 -define-item Horse +define-item "Horse" cost 180 -define-item Saddle and bridle +define-item "Saddle and bridle" cost 45 -define-item Saddlebag +define-item "Saddlebag" cost 35 -define-item Handmirror +define-item "Handmirror" cost 20 -define-item Magnifying glass +define-item "Magnifying glass" cost 20 -define-item Telescope +define-item "Telescope" cost 40 -define-item Rope ladder +define-item "Rope ladder" cost 15 -define-item Torches (3x) +define-item "Torches (3x)" cost 10 -define-item Staff +define-item "Staff" cost 10 -define-item Cooking pot +define-item "Cooking pot" cost 8 -define-item Soap +define-item "Soap" cost 2 -define-item Towel +define-item "Towel" cost 5 -define-item Boots +define-item "Boots" cost 10 \ No newline at end of file diff --git a/ATL/game-objects.atl b/ATL/game-objects.atl index a860e54..5e29634 100644 --- a/ATL/game-objects.atl +++ b/ATL/game-objects.atl @@ -4,7 +4,7 @@ ; @date 02/06/2015 define-monster "Fury" - description "Hades messengers, torturers, assassins. Beware!" + description "Hades' messengers, torturers, assassins. Beware!" strength 10 aggression 30 armour-class 3 @@ -28,4 +28,11 @@ define-npc "Charon" description "A robe-clad ghoul, dread ferryman of the Styx." - says "..." \ No newline at end of file + says "..." + +define-npc "Persephone" ;testing the shop system + description "Hades' beautiful wife, bringer of summer." + says "Welcome, my friend from the upper world!" + sells "Sleeping potion" + sells "Handmirror" + sells "Book of Lore" \ No newline at end of file diff --git a/ATL/lisp-test.atl b/ATL/lisp-test.atl index 5687b44..a89aa59 100644 --- a/ATL/lisp-test.atl +++ b/ATL/lisp-test.atl @@ -15,6 +15,7 @@ neighbour "Styx" neighbour "Fields of Punishment" neighbour "Fields of Asphodel" + npc "Persephone" define-place "Fields of Punishment" description "Precisely where you do NOT want to end up..." @@ -43,4 +44,5 @@ load-file game-objects.atl load-file creator-test.atl -start-place "Styx" \ No newline at end of file +start-place "Styx" +start-money 50 \ No newline at end of file diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 2d248a4..65594ad 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -25,10 +25,10 @@ (load-file "../ATL/lisp-test.atl") (let ((player (make-player :name "Bilbo" :race "Hobbit" :class "Burglar" - :place (world-starting-place *world*) + :place "Elysium" :strength 6 :constitution 12 :dexterity 19 :intelligence 14 - :game-admin T))) + :money 100 :game-admin T))) (add-game-object player) (set-object-attribute (get-game-object 'place (player-place player)) 'player (player-name player)) diff --git a/lisp/creator.lisp b/lisp/creator.lisp index e0bb854..cfd82ca 100644 --- a/lisp/creator.lisp +++ b/lisp/creator.lisp @@ -40,7 +40,8 @@ (setf atl-code (format NIL "~A~&~%~A" atl-code (concatenate 'string "define-" (string-downcase (to-string object-type)) - " " (first line-values)))) + " " (to-string #\") (first line-values) + (to-string #\")))) ;; Enter the value for each characteristic (dotimes (i (1- (length object-characteristics))) (setf atl-code (format NIL "~A~&~A" atl-code @@ -53,4 +54,16 @@ (defun world-creator () "The UI for the functions in this module" - (format t "~&Sorry, not yet available!")) + (clear-screen) + (format t "~&Welcome to the Atlantis world creator!") + (format t "~&~%What do you want to do?") + (case (choose-number-option '("Import a spreadsheet" "Nothing")) + (0 (progn + (format t "~&What OpenDocument spreadsheet do you want to import?") + (input-string s) + (format t "~&What ATL file do you want to export it to?") + (input-string a) + (import-spreadsheet s a) + (if (y-or-n-p "Done. Create something else?") + (world-creator) (start-menu)))) + (1 (start-menu)))) diff --git a/ATL/atl-mode.el b/ATL/atl-mode.el index efab9cf..598c28c 100644 --- a/ATL/atl-mode.el +++ b/ATL/atl-mode.el @@ -13,7 +13,8 @@ ;; define commands '("define-place" "define-item" "define-monster" "define-npc" "define-race" "define-place" "define-weapon" - "define-class" "name-world" "load-file" "start-place") + "define-class" "name-world" "load-file" + "start-place" "start-money") '() ;; other commands (adjust this?) '("\\.atl$") ;; files for which to activate this mode '(linum-mode) ;; other functions to call diff --git a/ATL/creator-test.atl b/ATL/creator-test.atl index fa40b88..6209e7c 100644 --- a/ATL/creator-test.atl +++ b/ATL/creator-test.atl @@ -1,185 +1,185 @@ ;; This code has been automatically generated by the ;; Atlantis world creator. -define-item Rope (20m) +define-item "Rope (20m)" cost 5 -define-item Backpack +define-item "Backpack" cost 5 -define-item Knife +define-item "Knife" cost 10 -define-item Short sword +define-item "Short sword" cost 40 -define-item Long sword +define-item "Long sword" cost 80 -define-item Dagger +define-item "Dagger" cost 20 -define-item Spear +define-item "Spear" cost 25 -define-item Short bow +define-item "Short bow" cost 30 -define-item Longbow +define-item "Longbow" cost 60 -define-item Slingshot +define-item "Slingshot" cost 15 -define-item Throwing knife +define-item "Throwing knife" cost 15 -define-item Quiver of arrows +define-item "Quiver of arrows" cost 20 -define-item Leather armour +define-item "Leather armour" cost 60 -define-item Chain mail +define-item "Chain mail" cost 120 -define-item Plate armour +define-item "Plate armour" cost 200 -define-item Buckler +define-item "Buckler" cost 35 -define-item Full shield +define-item "Full shield" cost 45 -define-item Candles (3x) +define-item "Candles (3x)" cost 5 -define-item Matches +define-item "Matches" cost 1 -define-item Food rations (5x) +define-item "Food rations (5x)" cost 10 -define-item Grappling hook +define-item "Grappling hook" cost 15 -define-item Fishing net +define-item "Fishing net" cost 25 -define-item Fishing rod +define-item "Fishing rod" cost 15 -define-item Tent (2 people) +define-item "Tent (2 people)" cost 30 -define-item Cloak +define-item "Cloak" cost 15 -define-item Hat +define-item "Hat" cost 10 -define-item Water bottle +define-item "Water bottle" cost 5 -define-item Compass +define-item "Compass" cost 20 -define-item Quill and ink +define-item "Quill and ink" cost 5 -define-item Parchment +define-item "Parchment" cost 5 -define-item Blanket +define-item "Blanket" cost 5 -define-item Book of Legends +define-item "Book of Legends" cost 55 -define-item Book of Lore +define-item "Book of Lore" cost 55 -define-item Medicinal herbs +define-item "Medicinal herbs" cost 10 -define-item Bandages (3x) +define-item "Bandages (3x)" cost 5 -define-item Tea leaves +define-item "Tea leaves" cost 5 -define-item Sleeping potion +define-item "Sleeping potion" cost 15 -define-item Leather pouch +define-item "Leather pouch" cost 2 -define-item Face mask +define-item "Face mask" cost 10 -define-item Dye +define-item "Dye" cost 5 -define-item Cloth +define-item "Cloth" cost 5 -define-item Scissors +define-item "Scissors" cost 15 -define-item Needle and thread +define-item "Needle and thread" cost 3 -define-item Canvas +define-item "Canvas" cost 8 -define-item String +define-item "String" cost 2 -define-item Hatchet +define-item "Hatchet" cost 20 -define-item Map +define-item "Map" cost 35 -define-item Pony +define-item "Pony" cost 100 -define-item Horse +define-item "Horse" cost 180 -define-item Saddle and bridle +define-item "Saddle and bridle" cost 45 -define-item Saddlebag +define-item "Saddlebag" cost 35 -define-item Handmirror +define-item "Handmirror" cost 20 -define-item Magnifying glass +define-item "Magnifying glass" cost 20 -define-item Telescope +define-item "Telescope" cost 40 -define-item Rope ladder +define-item "Rope ladder" cost 15 -define-item Torches (3x) +define-item "Torches (3x)" cost 10 -define-item Staff +define-item "Staff" cost 10 -define-item Cooking pot +define-item "Cooking pot" cost 8 -define-item Soap +define-item "Soap" cost 2 -define-item Towel +define-item "Towel" cost 5 -define-item Boots +define-item "Boots" cost 10 \ No newline at end of file diff --git a/ATL/game-objects.atl b/ATL/game-objects.atl index a860e54..5e29634 100644 --- a/ATL/game-objects.atl +++ b/ATL/game-objects.atl @@ -4,7 +4,7 @@ ; @date 02/06/2015 define-monster "Fury" - description "Hades messengers, torturers, assassins. Beware!" + description "Hades' messengers, torturers, assassins. Beware!" strength 10 aggression 30 armour-class 3 @@ -28,4 +28,11 @@ define-npc "Charon" description "A robe-clad ghoul, dread ferryman of the Styx." - says "..." \ No newline at end of file + says "..." + +define-npc "Persephone" ;testing the shop system + description "Hades' beautiful wife, bringer of summer." + says "Welcome, my friend from the upper world!" + sells "Sleeping potion" + sells "Handmirror" + sells "Book of Lore" \ No newline at end of file diff --git a/ATL/lisp-test.atl b/ATL/lisp-test.atl index 5687b44..a89aa59 100644 --- a/ATL/lisp-test.atl +++ b/ATL/lisp-test.atl @@ -15,6 +15,7 @@ neighbour "Styx" neighbour "Fields of Punishment" neighbour "Fields of Asphodel" + npc "Persephone" define-place "Fields of Punishment" description "Precisely where you do NOT want to end up..." @@ -43,4 +44,5 @@ load-file game-objects.atl load-file creator-test.atl -start-place "Styx" \ No newline at end of file +start-place "Styx" +start-money 50 \ No newline at end of file diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 2d248a4..65594ad 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -25,10 +25,10 @@ (load-file "../ATL/lisp-test.atl") (let ((player (make-player :name "Bilbo" :race "Hobbit" :class "Burglar" - :place (world-starting-place *world*) + :place "Elysium" :strength 6 :constitution 12 :dexterity 19 :intelligence 14 - :game-admin T))) + :money 100 :game-admin T))) (add-game-object player) (set-object-attribute (get-game-object 'place (player-place player)) 'player (player-name player)) diff --git a/lisp/creator.lisp b/lisp/creator.lisp index e0bb854..cfd82ca 100644 --- a/lisp/creator.lisp +++ b/lisp/creator.lisp @@ -40,7 +40,8 @@ (setf atl-code (format NIL "~A~&~%~A" atl-code (concatenate 'string "define-" (string-downcase (to-string object-type)) - " " (first line-values)))) + " " (to-string #\") (first line-values) + (to-string #\")))) ;; Enter the value for each characteristic (dotimes (i (1- (length object-characteristics))) (setf atl-code (format NIL "~A~&~A" atl-code @@ -53,4 +54,16 @@ (defun world-creator () "The UI for the functions in this module" - (format t "~&Sorry, not yet available!")) + (clear-screen) + (format t "~&Welcome to the Atlantis world creator!") + (format t "~&~%What do you want to do?") + (case (choose-number-option '("Import a spreadsheet" "Nothing")) + (0 (progn + (format t "~&What OpenDocument spreadsheet do you want to import?") + (input-string s) + (format t "~&What ATL file do you want to export it to?") + (input-string a) + (import-spreadsheet s a) + (if (y-or-n-p "Done. Create something else?") + (world-creator) (start-menu)))) + (1 (start-menu)))) diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 47e400c..6fbcee5 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -25,12 +25,14 @@ (defstruct npc (name "") (description "") - (says "")) + (says "") + (sells NIL)) (defstruct monster (name "") (description "") (strength 0) + (dexterity 0) (aggression 0) (weapon "") (armour-class 0)) diff --git a/ATL/atl-mode.el b/ATL/atl-mode.el index efab9cf..598c28c 100644 --- a/ATL/atl-mode.el +++ b/ATL/atl-mode.el @@ -13,7 +13,8 @@ ;; define commands '("define-place" "define-item" "define-monster" "define-npc" "define-race" "define-place" "define-weapon" - "define-class" "name-world" "load-file" "start-place") + "define-class" "name-world" "load-file" + "start-place" "start-money") '() ;; other commands (adjust this?) '("\\.atl$") ;; files for which to activate this mode '(linum-mode) ;; other functions to call diff --git a/ATL/creator-test.atl b/ATL/creator-test.atl index fa40b88..6209e7c 100644 --- a/ATL/creator-test.atl +++ b/ATL/creator-test.atl @@ -1,185 +1,185 @@ ;; This code has been automatically generated by the ;; Atlantis world creator. -define-item Rope (20m) +define-item "Rope (20m)" cost 5 -define-item Backpack +define-item "Backpack" cost 5 -define-item Knife +define-item "Knife" cost 10 -define-item Short sword +define-item "Short sword" cost 40 -define-item Long sword +define-item "Long sword" cost 80 -define-item Dagger +define-item "Dagger" cost 20 -define-item Spear +define-item "Spear" cost 25 -define-item Short bow +define-item "Short bow" cost 30 -define-item Longbow +define-item "Longbow" cost 60 -define-item Slingshot +define-item "Slingshot" cost 15 -define-item Throwing knife +define-item "Throwing knife" cost 15 -define-item Quiver of arrows +define-item "Quiver of arrows" cost 20 -define-item Leather armour +define-item "Leather armour" cost 60 -define-item Chain mail +define-item "Chain mail" cost 120 -define-item Plate armour +define-item "Plate armour" cost 200 -define-item Buckler +define-item "Buckler" cost 35 -define-item Full shield +define-item "Full shield" cost 45 -define-item Candles (3x) +define-item "Candles (3x)" cost 5 -define-item Matches +define-item "Matches" cost 1 -define-item Food rations (5x) +define-item "Food rations (5x)" cost 10 -define-item Grappling hook +define-item "Grappling hook" cost 15 -define-item Fishing net +define-item "Fishing net" cost 25 -define-item Fishing rod +define-item "Fishing rod" cost 15 -define-item Tent (2 people) +define-item "Tent (2 people)" cost 30 -define-item Cloak +define-item "Cloak" cost 15 -define-item Hat +define-item "Hat" cost 10 -define-item Water bottle +define-item "Water bottle" cost 5 -define-item Compass +define-item "Compass" cost 20 -define-item Quill and ink +define-item "Quill and ink" cost 5 -define-item Parchment +define-item "Parchment" cost 5 -define-item Blanket +define-item "Blanket" cost 5 -define-item Book of Legends +define-item "Book of Legends" cost 55 -define-item Book of Lore +define-item "Book of Lore" cost 55 -define-item Medicinal herbs +define-item "Medicinal herbs" cost 10 -define-item Bandages (3x) +define-item "Bandages (3x)" cost 5 -define-item Tea leaves +define-item "Tea leaves" cost 5 -define-item Sleeping potion +define-item "Sleeping potion" cost 15 -define-item Leather pouch +define-item "Leather pouch" cost 2 -define-item Face mask +define-item "Face mask" cost 10 -define-item Dye +define-item "Dye" cost 5 -define-item Cloth +define-item "Cloth" cost 5 -define-item Scissors +define-item "Scissors" cost 15 -define-item Needle and thread +define-item "Needle and thread" cost 3 -define-item Canvas +define-item "Canvas" cost 8 -define-item String +define-item "String" cost 2 -define-item Hatchet +define-item "Hatchet" cost 20 -define-item Map +define-item "Map" cost 35 -define-item Pony +define-item "Pony" cost 100 -define-item Horse +define-item "Horse" cost 180 -define-item Saddle and bridle +define-item "Saddle and bridle" cost 45 -define-item Saddlebag +define-item "Saddlebag" cost 35 -define-item Handmirror +define-item "Handmirror" cost 20 -define-item Magnifying glass +define-item "Magnifying glass" cost 20 -define-item Telescope +define-item "Telescope" cost 40 -define-item Rope ladder +define-item "Rope ladder" cost 15 -define-item Torches (3x) +define-item "Torches (3x)" cost 10 -define-item Staff +define-item "Staff" cost 10 -define-item Cooking pot +define-item "Cooking pot" cost 8 -define-item Soap +define-item "Soap" cost 2 -define-item Towel +define-item "Towel" cost 5 -define-item Boots +define-item "Boots" cost 10 \ No newline at end of file diff --git a/ATL/game-objects.atl b/ATL/game-objects.atl index a860e54..5e29634 100644 --- a/ATL/game-objects.atl +++ b/ATL/game-objects.atl @@ -4,7 +4,7 @@ ; @date 02/06/2015 define-monster "Fury" - description "Hades messengers, torturers, assassins. Beware!" + description "Hades' messengers, torturers, assassins. Beware!" strength 10 aggression 30 armour-class 3 @@ -28,4 +28,11 @@ define-npc "Charon" description "A robe-clad ghoul, dread ferryman of the Styx." - says "..." \ No newline at end of file + says "..." + +define-npc "Persephone" ;testing the shop system + description "Hades' beautiful wife, bringer of summer." + says "Welcome, my friend from the upper world!" + sells "Sleeping potion" + sells "Handmirror" + sells "Book of Lore" \ No newline at end of file diff --git a/ATL/lisp-test.atl b/ATL/lisp-test.atl index 5687b44..a89aa59 100644 --- a/ATL/lisp-test.atl +++ b/ATL/lisp-test.atl @@ -15,6 +15,7 @@ neighbour "Styx" neighbour "Fields of Punishment" neighbour "Fields of Asphodel" + npc "Persephone" define-place "Fields of Punishment" description "Precisely where you do NOT want to end up..." @@ -43,4 +44,5 @@ load-file game-objects.atl load-file creator-test.atl -start-place "Styx" \ No newline at end of file +start-place "Styx" +start-money 50 \ No newline at end of file diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 2d248a4..65594ad 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -25,10 +25,10 @@ (load-file "../ATL/lisp-test.atl") (let ((player (make-player :name "Bilbo" :race "Hobbit" :class "Burglar" - :place (world-starting-place *world*) + :place "Elysium" :strength 6 :constitution 12 :dexterity 19 :intelligence 14 - :game-admin T))) + :money 100 :game-admin T))) (add-game-object player) (set-object-attribute (get-game-object 'place (player-place player)) 'player (player-name player)) diff --git a/lisp/creator.lisp b/lisp/creator.lisp index e0bb854..cfd82ca 100644 --- a/lisp/creator.lisp +++ b/lisp/creator.lisp @@ -40,7 +40,8 @@ (setf atl-code (format NIL "~A~&~%~A" atl-code (concatenate 'string "define-" (string-downcase (to-string object-type)) - " " (first line-values)))) + " " (to-string #\") (first line-values) + (to-string #\")))) ;; Enter the value for each characteristic (dotimes (i (1- (length object-characteristics))) (setf atl-code (format NIL "~A~&~A" atl-code @@ -53,4 +54,16 @@ (defun world-creator () "The UI for the functions in this module" - (format t "~&Sorry, not yet available!")) + (clear-screen) + (format t "~&Welcome to the Atlantis world creator!") + (format t "~&~%What do you want to do?") + (case (choose-number-option '("Import a spreadsheet" "Nothing")) + (0 (progn + (format t "~&What OpenDocument spreadsheet do you want to import?") + (input-string s) + (format t "~&What ATL file do you want to export it to?") + (input-string a) + (import-spreadsheet s a) + (if (y-or-n-p "Done. Create something else?") + (world-creator) (start-menu)))) + (1 (start-menu)))) diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 47e400c..6fbcee5 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -25,12 +25,14 @@ (defstruct npc (name "") (description "") - (says "")) + (says "") + (sells NIL)) (defstruct monster (name "") (description "") (strength 0) + (dexterity 0) (aggression 0) (weapon "") (armour-class 0)) diff --git a/lisp/interpreter.lisp b/lisp/interpreter.lisp index f5d5656..8f69337 100644 --- a/lisp/interpreter.lisp +++ b/lisp/interpreter.lisp @@ -12,7 +12,7 @@ ;; A list of ATL language constructs ;; (Note: not complete - each (defcommand) appends to this list) (defvar *atl-commands* - '(load-file start-place name-world)) + '(load-file start-place start-money name-world)) (defun build-define-command (object-type) "Build a new define command function for the specified object type" @@ -43,6 +43,11 @@ (setf (world-starting-place *world*) place) NIL) +(defun start-money (amount) + (debugging "~&Starting money is ~A gold pieces" amount) + (setf (world-starting-money *world*) amount) + NIL) + (let ((world-directory NIL) (loaded-files NIL)) diff --git a/ATL/atl-mode.el b/ATL/atl-mode.el index efab9cf..598c28c 100644 --- a/ATL/atl-mode.el +++ b/ATL/atl-mode.el @@ -13,7 +13,8 @@ ;; define commands '("define-place" "define-item" "define-monster" "define-npc" "define-race" "define-place" "define-weapon" - "define-class" "name-world" "load-file" "start-place") + "define-class" "name-world" "load-file" + "start-place" "start-money") '() ;; other commands (adjust this?) '("\\.atl$") ;; files for which to activate this mode '(linum-mode) ;; other functions to call diff --git a/ATL/creator-test.atl b/ATL/creator-test.atl index fa40b88..6209e7c 100644 --- a/ATL/creator-test.atl +++ b/ATL/creator-test.atl @@ -1,185 +1,185 @@ ;; This code has been automatically generated by the ;; Atlantis world creator. -define-item Rope (20m) +define-item "Rope (20m)" cost 5 -define-item Backpack +define-item "Backpack" cost 5 -define-item Knife +define-item "Knife" cost 10 -define-item Short sword +define-item "Short sword" cost 40 -define-item Long sword +define-item "Long sword" cost 80 -define-item Dagger +define-item "Dagger" cost 20 -define-item Spear +define-item "Spear" cost 25 -define-item Short bow +define-item "Short bow" cost 30 -define-item Longbow +define-item "Longbow" cost 60 -define-item Slingshot +define-item "Slingshot" cost 15 -define-item Throwing knife +define-item "Throwing knife" cost 15 -define-item Quiver of arrows +define-item "Quiver of arrows" cost 20 -define-item Leather armour +define-item "Leather armour" cost 60 -define-item Chain mail +define-item "Chain mail" cost 120 -define-item Plate armour +define-item "Plate armour" cost 200 -define-item Buckler +define-item "Buckler" cost 35 -define-item Full shield +define-item "Full shield" cost 45 -define-item Candles (3x) +define-item "Candles (3x)" cost 5 -define-item Matches +define-item "Matches" cost 1 -define-item Food rations (5x) +define-item "Food rations (5x)" cost 10 -define-item Grappling hook +define-item "Grappling hook" cost 15 -define-item Fishing net +define-item "Fishing net" cost 25 -define-item Fishing rod +define-item "Fishing rod" cost 15 -define-item Tent (2 people) +define-item "Tent (2 people)" cost 30 -define-item Cloak +define-item "Cloak" cost 15 -define-item Hat +define-item "Hat" cost 10 -define-item Water bottle +define-item "Water bottle" cost 5 -define-item Compass +define-item "Compass" cost 20 -define-item Quill and ink +define-item "Quill and ink" cost 5 -define-item Parchment +define-item "Parchment" cost 5 -define-item Blanket +define-item "Blanket" cost 5 -define-item Book of Legends +define-item "Book of Legends" cost 55 -define-item Book of Lore +define-item "Book of Lore" cost 55 -define-item Medicinal herbs +define-item "Medicinal herbs" cost 10 -define-item Bandages (3x) +define-item "Bandages (3x)" cost 5 -define-item Tea leaves +define-item "Tea leaves" cost 5 -define-item Sleeping potion +define-item "Sleeping potion" cost 15 -define-item Leather pouch +define-item "Leather pouch" cost 2 -define-item Face mask +define-item "Face mask" cost 10 -define-item Dye +define-item "Dye" cost 5 -define-item Cloth +define-item "Cloth" cost 5 -define-item Scissors +define-item "Scissors" cost 15 -define-item Needle and thread +define-item "Needle and thread" cost 3 -define-item Canvas +define-item "Canvas" cost 8 -define-item String +define-item "String" cost 2 -define-item Hatchet +define-item "Hatchet" cost 20 -define-item Map +define-item "Map" cost 35 -define-item Pony +define-item "Pony" cost 100 -define-item Horse +define-item "Horse" cost 180 -define-item Saddle and bridle +define-item "Saddle and bridle" cost 45 -define-item Saddlebag +define-item "Saddlebag" cost 35 -define-item Handmirror +define-item "Handmirror" cost 20 -define-item Magnifying glass +define-item "Magnifying glass" cost 20 -define-item Telescope +define-item "Telescope" cost 40 -define-item Rope ladder +define-item "Rope ladder" cost 15 -define-item Torches (3x) +define-item "Torches (3x)" cost 10 -define-item Staff +define-item "Staff" cost 10 -define-item Cooking pot +define-item "Cooking pot" cost 8 -define-item Soap +define-item "Soap" cost 2 -define-item Towel +define-item "Towel" cost 5 -define-item Boots +define-item "Boots" cost 10 \ No newline at end of file diff --git a/ATL/game-objects.atl b/ATL/game-objects.atl index a860e54..5e29634 100644 --- a/ATL/game-objects.atl +++ b/ATL/game-objects.atl @@ -4,7 +4,7 @@ ; @date 02/06/2015 define-monster "Fury" - description "Hades messengers, torturers, assassins. Beware!" + description "Hades' messengers, torturers, assassins. Beware!" strength 10 aggression 30 armour-class 3 @@ -28,4 +28,11 @@ define-npc "Charon" description "A robe-clad ghoul, dread ferryman of the Styx." - says "..." \ No newline at end of file + says "..." + +define-npc "Persephone" ;testing the shop system + description "Hades' beautiful wife, bringer of summer." + says "Welcome, my friend from the upper world!" + sells "Sleeping potion" + sells "Handmirror" + sells "Book of Lore" \ No newline at end of file diff --git a/ATL/lisp-test.atl b/ATL/lisp-test.atl index 5687b44..a89aa59 100644 --- a/ATL/lisp-test.atl +++ b/ATL/lisp-test.atl @@ -15,6 +15,7 @@ neighbour "Styx" neighbour "Fields of Punishment" neighbour "Fields of Asphodel" + npc "Persephone" define-place "Fields of Punishment" description "Precisely where you do NOT want to end up..." @@ -43,4 +44,5 @@ load-file game-objects.atl load-file creator-test.atl -start-place "Styx" \ No newline at end of file +start-place "Styx" +start-money 50 \ No newline at end of file diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 2d248a4..65594ad 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -25,10 +25,10 @@ (load-file "../ATL/lisp-test.atl") (let ((player (make-player :name "Bilbo" :race "Hobbit" :class "Burglar" - :place (world-starting-place *world*) + :place "Elysium" :strength 6 :constitution 12 :dexterity 19 :intelligence 14 - :game-admin T))) + :money 100 :game-admin T))) (add-game-object player) (set-object-attribute (get-game-object 'place (player-place player)) 'player (player-name player)) diff --git a/lisp/creator.lisp b/lisp/creator.lisp index e0bb854..cfd82ca 100644 --- a/lisp/creator.lisp +++ b/lisp/creator.lisp @@ -40,7 +40,8 @@ (setf atl-code (format NIL "~A~&~%~A" atl-code (concatenate 'string "define-" (string-downcase (to-string object-type)) - " " (first line-values)))) + " " (to-string #\") (first line-values) + (to-string #\")))) ;; Enter the value for each characteristic (dotimes (i (1- (length object-characteristics))) (setf atl-code (format NIL "~A~&~A" atl-code @@ -53,4 +54,16 @@ (defun world-creator () "The UI for the functions in this module" - (format t "~&Sorry, not yet available!")) + (clear-screen) + (format t "~&Welcome to the Atlantis world creator!") + (format t "~&~%What do you want to do?") + (case (choose-number-option '("Import a spreadsheet" "Nothing")) + (0 (progn + (format t "~&What OpenDocument spreadsheet do you want to import?") + (input-string s) + (format t "~&What ATL file do you want to export it to?") + (input-string a) + (import-spreadsheet s a) + (if (y-or-n-p "Done. Create something else?") + (world-creator) (start-menu)))) + (1 (start-menu)))) diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 47e400c..6fbcee5 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -25,12 +25,14 @@ (defstruct npc (name "") (description "") - (says "")) + (says "") + (sells NIL)) (defstruct monster (name "") (description "") (strength 0) + (dexterity 0) (aggression 0) (weapon "") (armour-class 0)) diff --git a/lisp/interpreter.lisp b/lisp/interpreter.lisp index f5d5656..8f69337 100644 --- a/lisp/interpreter.lisp +++ b/lisp/interpreter.lisp @@ -12,7 +12,7 @@ ;; A list of ATL language constructs ;; (Note: not complete - each (defcommand) appends to this list) (defvar *atl-commands* - '(load-file start-place name-world)) + '(load-file start-place start-money name-world)) (defun build-define-command (object-type) "Build a new define command function for the specified object type" @@ -43,6 +43,11 @@ (setf (world-starting-place *world*) place) NIL) +(defun start-money (amount) + (debugging "~&Starting money is ~A gold pieces" amount) + (setf (world-starting-money *world*) amount) + NIL) + (let ((world-directory NIL) (loaded-files NIL)) diff --git a/lisp/player.lisp b/lisp/player.lisp index 66328bf..b96302c 100644 --- a/lisp/player.lisp +++ b/lisp/player.lisp @@ -18,6 +18,7 @@ (dexterity 0) (constitution 0) (intelligence 0) + (money 0) (item NIL) (weapon "") (place "") @@ -43,8 +44,8 @@ (special-ability NIL)) -;; This function is probably superfluous, as the player struct should only store -;; names of game objects (the actual objects are stored in *world*) +;; XXX This function is probably superfluous, as the player struct should only +;; store names of game objects (the actual objects are stored in *world*) (let ((list-function (make-list-function 'player NIL))) (defun list-player-objects (object-type player) "Get a list of the names of all the player's objects of this type." diff --git a/ATL/atl-mode.el b/ATL/atl-mode.el index efab9cf..598c28c 100644 --- a/ATL/atl-mode.el +++ b/ATL/atl-mode.el @@ -13,7 +13,8 @@ ;; define commands '("define-place" "define-item" "define-monster" "define-npc" "define-race" "define-place" "define-weapon" - "define-class" "name-world" "load-file" "start-place") + "define-class" "name-world" "load-file" + "start-place" "start-money") '() ;; other commands (adjust this?) '("\\.atl$") ;; files for which to activate this mode '(linum-mode) ;; other functions to call diff --git a/ATL/creator-test.atl b/ATL/creator-test.atl index fa40b88..6209e7c 100644 --- a/ATL/creator-test.atl +++ b/ATL/creator-test.atl @@ -1,185 +1,185 @@ ;; This code has been automatically generated by the ;; Atlantis world creator. -define-item Rope (20m) +define-item "Rope (20m)" cost 5 -define-item Backpack +define-item "Backpack" cost 5 -define-item Knife +define-item "Knife" cost 10 -define-item Short sword +define-item "Short sword" cost 40 -define-item Long sword +define-item "Long sword" cost 80 -define-item Dagger +define-item "Dagger" cost 20 -define-item Spear +define-item "Spear" cost 25 -define-item Short bow +define-item "Short bow" cost 30 -define-item Longbow +define-item "Longbow" cost 60 -define-item Slingshot +define-item "Slingshot" cost 15 -define-item Throwing knife +define-item "Throwing knife" cost 15 -define-item Quiver of arrows +define-item "Quiver of arrows" cost 20 -define-item Leather armour +define-item "Leather armour" cost 60 -define-item Chain mail +define-item "Chain mail" cost 120 -define-item Plate armour +define-item "Plate armour" cost 200 -define-item Buckler +define-item "Buckler" cost 35 -define-item Full shield +define-item "Full shield" cost 45 -define-item Candles (3x) +define-item "Candles (3x)" cost 5 -define-item Matches +define-item "Matches" cost 1 -define-item Food rations (5x) +define-item "Food rations (5x)" cost 10 -define-item Grappling hook +define-item "Grappling hook" cost 15 -define-item Fishing net +define-item "Fishing net" cost 25 -define-item Fishing rod +define-item "Fishing rod" cost 15 -define-item Tent (2 people) +define-item "Tent (2 people)" cost 30 -define-item Cloak +define-item "Cloak" cost 15 -define-item Hat +define-item "Hat" cost 10 -define-item Water bottle +define-item "Water bottle" cost 5 -define-item Compass +define-item "Compass" cost 20 -define-item Quill and ink +define-item "Quill and ink" cost 5 -define-item Parchment +define-item "Parchment" cost 5 -define-item Blanket +define-item "Blanket" cost 5 -define-item Book of Legends +define-item "Book of Legends" cost 55 -define-item Book of Lore +define-item "Book of Lore" cost 55 -define-item Medicinal herbs +define-item "Medicinal herbs" cost 10 -define-item Bandages (3x) +define-item "Bandages (3x)" cost 5 -define-item Tea leaves +define-item "Tea leaves" cost 5 -define-item Sleeping potion +define-item "Sleeping potion" cost 15 -define-item Leather pouch +define-item "Leather pouch" cost 2 -define-item Face mask +define-item "Face mask" cost 10 -define-item Dye +define-item "Dye" cost 5 -define-item Cloth +define-item "Cloth" cost 5 -define-item Scissors +define-item "Scissors" cost 15 -define-item Needle and thread +define-item "Needle and thread" cost 3 -define-item Canvas +define-item "Canvas" cost 8 -define-item String +define-item "String" cost 2 -define-item Hatchet +define-item "Hatchet" cost 20 -define-item Map +define-item "Map" cost 35 -define-item Pony +define-item "Pony" cost 100 -define-item Horse +define-item "Horse" cost 180 -define-item Saddle and bridle +define-item "Saddle and bridle" cost 45 -define-item Saddlebag +define-item "Saddlebag" cost 35 -define-item Handmirror +define-item "Handmirror" cost 20 -define-item Magnifying glass +define-item "Magnifying glass" cost 20 -define-item Telescope +define-item "Telescope" cost 40 -define-item Rope ladder +define-item "Rope ladder" cost 15 -define-item Torches (3x) +define-item "Torches (3x)" cost 10 -define-item Staff +define-item "Staff" cost 10 -define-item Cooking pot +define-item "Cooking pot" cost 8 -define-item Soap +define-item "Soap" cost 2 -define-item Towel +define-item "Towel" cost 5 -define-item Boots +define-item "Boots" cost 10 \ No newline at end of file diff --git a/ATL/game-objects.atl b/ATL/game-objects.atl index a860e54..5e29634 100644 --- a/ATL/game-objects.atl +++ b/ATL/game-objects.atl @@ -4,7 +4,7 @@ ; @date 02/06/2015 define-monster "Fury" - description "Hades messengers, torturers, assassins. Beware!" + description "Hades' messengers, torturers, assassins. Beware!" strength 10 aggression 30 armour-class 3 @@ -28,4 +28,11 @@ define-npc "Charon" description "A robe-clad ghoul, dread ferryman of the Styx." - says "..." \ No newline at end of file + says "..." + +define-npc "Persephone" ;testing the shop system + description "Hades' beautiful wife, bringer of summer." + says "Welcome, my friend from the upper world!" + sells "Sleeping potion" + sells "Handmirror" + sells "Book of Lore" \ No newline at end of file diff --git a/ATL/lisp-test.atl b/ATL/lisp-test.atl index 5687b44..a89aa59 100644 --- a/ATL/lisp-test.atl +++ b/ATL/lisp-test.atl @@ -15,6 +15,7 @@ neighbour "Styx" neighbour "Fields of Punishment" neighbour "Fields of Asphodel" + npc "Persephone" define-place "Fields of Punishment" description "Precisely where you do NOT want to end up..." @@ -43,4 +44,5 @@ load-file game-objects.atl load-file creator-test.atl -start-place "Styx" \ No newline at end of file +start-place "Styx" +start-money 50 \ No newline at end of file diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 2d248a4..65594ad 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -25,10 +25,10 @@ (load-file "../ATL/lisp-test.atl") (let ((player (make-player :name "Bilbo" :race "Hobbit" :class "Burglar" - :place (world-starting-place *world*) + :place "Elysium" :strength 6 :constitution 12 :dexterity 19 :intelligence 14 - :game-admin T))) + :money 100 :game-admin T))) (add-game-object player) (set-object-attribute (get-game-object 'place (player-place player)) 'player (player-name player)) diff --git a/lisp/creator.lisp b/lisp/creator.lisp index e0bb854..cfd82ca 100644 --- a/lisp/creator.lisp +++ b/lisp/creator.lisp @@ -40,7 +40,8 @@ (setf atl-code (format NIL "~A~&~%~A" atl-code (concatenate 'string "define-" (string-downcase (to-string object-type)) - " " (first line-values)))) + " " (to-string #\") (first line-values) + (to-string #\")))) ;; Enter the value for each characteristic (dotimes (i (1- (length object-characteristics))) (setf atl-code (format NIL "~A~&~A" atl-code @@ -53,4 +54,16 @@ (defun world-creator () "The UI for the functions in this module" - (format t "~&Sorry, not yet available!")) + (clear-screen) + (format t "~&Welcome to the Atlantis world creator!") + (format t "~&~%What do you want to do?") + (case (choose-number-option '("Import a spreadsheet" "Nothing")) + (0 (progn + (format t "~&What OpenDocument spreadsheet do you want to import?") + (input-string s) + (format t "~&What ATL file do you want to export it to?") + (input-string a) + (import-spreadsheet s a) + (if (y-or-n-p "Done. Create something else?") + (world-creator) (start-menu)))) + (1 (start-menu)))) diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 47e400c..6fbcee5 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -25,12 +25,14 @@ (defstruct npc (name "") (description "") - (says "")) + (says "") + (sells NIL)) (defstruct monster (name "") (description "") (strength 0) + (dexterity 0) (aggression 0) (weapon "") (armour-class 0)) diff --git a/lisp/interpreter.lisp b/lisp/interpreter.lisp index f5d5656..8f69337 100644 --- a/lisp/interpreter.lisp +++ b/lisp/interpreter.lisp @@ -12,7 +12,7 @@ ;; A list of ATL language constructs ;; (Note: not complete - each (defcommand) appends to this list) (defvar *atl-commands* - '(load-file start-place name-world)) + '(load-file start-place start-money name-world)) (defun build-define-command (object-type) "Build a new define command function for the specified object type" @@ -43,6 +43,11 @@ (setf (world-starting-place *world*) place) NIL) +(defun start-money (amount) + (debugging "~&Starting money is ~A gold pieces" amount) + (setf (world-starting-money *world*) amount) + NIL) + (let ((world-directory NIL) (loaded-files NIL)) diff --git a/lisp/player.lisp b/lisp/player.lisp index 66328bf..b96302c 100644 --- a/lisp/player.lisp +++ b/lisp/player.lisp @@ -18,6 +18,7 @@ (dexterity 0) (constitution 0) (intelligence 0) + (money 0) (item NIL) (weapon "") (place "") @@ -43,8 +44,8 @@ (special-ability NIL)) -;; This function is probably superfluous, as the player struct should only store -;; names of game objects (the actual objects are stored in *world*) +;; XXX This function is probably superfluous, as the player struct should only +;; store names of game objects (the actual objects are stored in *world*) (let ((list-function (make-list-function 'player NIL))) (defun list-player-objects (object-type player) "Get a list of the names of all the player's objects of this type." diff --git a/lisp/ui.lisp b/lisp/ui.lisp index f8cb7cf..e5abbbf 100644 --- a/lisp/ui.lisp +++ b/lisp/ui.lisp @@ -39,7 +39,8 @@ "The user creates a new player" ;; XXX This function feels somewhat ugly - any possibility of a cleanup? (let ((player (make-player :name player-name - :place (world-starting-place *world*))) + :place (world-starting-place *world*) + :money (world-starting-money *world*))) (char-attr '((strength 0) (dexterity 0) (constitution 0) (intelligence 0))) @@ -114,7 +115,8 @@ ;; A list of all in-game commands. Each new command must be registered here. (defvar *commands* '(help place player - goto pickup drop talk + goto pickup drop + talk trade equip fight shoot about save clear)) @@ -131,7 +133,7 @@ player - Describe your player goto - Go to a neighbouring location about - Show a description of this entity -talk - Talk to an NPC +talk to - Talk to an NPC pickup - Pick up an item lying around drop - Drop the item equip - Equip this item as your weapon @@ -170,7 +172,8 @@ (format t "~&=====") (format t "~&Max health: ~A~ACurrent health: ~A" (player-max-health p) tab (player-health p)) - (format t "~&Experience: ~A" (player-experience p)))) + (format t "~&Experience: ~A~AMoney: ~A" + (player-experience p) tab (player-money p)))) ;;; These next functions have to take two arguments (the argument ;;; to the function and a player instance). @@ -215,6 +218,9 @@ (unless object-name (format t "~&Please specify the object you wish to inspect!") (return-from about)) + ;; A bit of syntactic sugar... + (cond ((equalp object-name "me") (player player) (return-from about)) + ((equalp object-name "here") (place player) (return-from about))) ;; TODO What about objects that the player is carrying? ;; And there's probably a more elegant way of doing this... (let ((place (get-game-object 'place (player-place player))) @@ -240,13 +246,54 @@ (unless npc-name (format t "~&Please specify an NPC to talk to!") (return-from talk)) + ;; Allow for a bit of syntactic sugar (note: interface inconsistency?) + (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))) (npc (when (member npc-name (place-npc place) :test #'equalp) (get-game-object 'npc npc-name)))) (if npc - (format t "~&~A: ~A" (string-upcase npc-name) (npc-says npc)) + (progn + (format t "~&~A: ~A" (string-upcase npc-name) (npc-says npc)) + (when (and (npc-sells npc) + (y-or-n-p "Trade with ~A?" npc-name)) + (trade player npc))) (format t "~&~A is not here!" npc-name)))) +(defun trade (player npc) + "The player trades with this NPC" + ;; TODO Implement player-sells-to-npc feature + (when (and (stringp npc) + (member npc + (place-npc (get-game-object 'place (player-place player))) + :test #'equalp)) + (setf npc (get-game-object 'npc npc)) + (unless (npc-sells npc) + (format t "~&This NPC doesn't sell anything!") + (return-from trade))) + (format t "~&~%What do you want to buy? Your money: ~S" + (player-money player)) + (let* ((choice (choose-option (append (npc-sells npc) (list "None")))) + (item (get-game-object 'item choice)) + (cost (if item (item-cost item) NIL))) + (cond ((equalp choice "None") NIL) + ;; XXX Do we have to insure that every object referenced by the + ;; world exists, or is that the responsibility of the person + ;; who writes the ATL code? + ((not item) + (format t "~&This object does not exist!") + (format t "(Talk to the world creator)") + NIL) + ((< (player-money player) cost) + (format t "~&You do not have enough money!")) + ((y-or-n-p "Buy ~A for ~S?" choice cost) + (decf (player-money player) cost) + (set-object-attribute player 'item choice) + (format t "~&Bought ~A for ~A." choice cost)))) + (if (y-or-n-p "Buy something else?") + (trade player npc) (clear player))) + (defun pickup (player &optional item-name) "The player picks up an item" (unless item-name @@ -283,7 +330,7 @@ (when (or (not new-weapon) (equalp new-weapon "none")) (setf (player-weapon player) "") (format t "~&You no longer have any weapon equipped.") - (return-from weapon)) + (return-from equip)) (if (and (member new-weapon (player-item player) :test #'equalp) (equalp (item-weapon (get-game-object 'item new-weapon)) "yes")) (progn diff --git a/ATL/atl-mode.el b/ATL/atl-mode.el index efab9cf..598c28c 100644 --- a/ATL/atl-mode.el +++ b/ATL/atl-mode.el @@ -13,7 +13,8 @@ ;; define commands '("define-place" "define-item" "define-monster" "define-npc" "define-race" "define-place" "define-weapon" - "define-class" "name-world" "load-file" "start-place") + "define-class" "name-world" "load-file" + "start-place" "start-money") '() ;; other commands (adjust this?) '("\\.atl$") ;; files for which to activate this mode '(linum-mode) ;; other functions to call diff --git a/ATL/creator-test.atl b/ATL/creator-test.atl index fa40b88..6209e7c 100644 --- a/ATL/creator-test.atl +++ b/ATL/creator-test.atl @@ -1,185 +1,185 @@ ;; This code has been automatically generated by the ;; Atlantis world creator. -define-item Rope (20m) +define-item "Rope (20m)" cost 5 -define-item Backpack +define-item "Backpack" cost 5 -define-item Knife +define-item "Knife" cost 10 -define-item Short sword +define-item "Short sword" cost 40 -define-item Long sword +define-item "Long sword" cost 80 -define-item Dagger +define-item "Dagger" cost 20 -define-item Spear +define-item "Spear" cost 25 -define-item Short bow +define-item "Short bow" cost 30 -define-item Longbow +define-item "Longbow" cost 60 -define-item Slingshot +define-item "Slingshot" cost 15 -define-item Throwing knife +define-item "Throwing knife" cost 15 -define-item Quiver of arrows +define-item "Quiver of arrows" cost 20 -define-item Leather armour +define-item "Leather armour" cost 60 -define-item Chain mail +define-item "Chain mail" cost 120 -define-item Plate armour +define-item "Plate armour" cost 200 -define-item Buckler +define-item "Buckler" cost 35 -define-item Full shield +define-item "Full shield" cost 45 -define-item Candles (3x) +define-item "Candles (3x)" cost 5 -define-item Matches +define-item "Matches" cost 1 -define-item Food rations (5x) +define-item "Food rations (5x)" cost 10 -define-item Grappling hook +define-item "Grappling hook" cost 15 -define-item Fishing net +define-item "Fishing net" cost 25 -define-item Fishing rod +define-item "Fishing rod" cost 15 -define-item Tent (2 people) +define-item "Tent (2 people)" cost 30 -define-item Cloak +define-item "Cloak" cost 15 -define-item Hat +define-item "Hat" cost 10 -define-item Water bottle +define-item "Water bottle" cost 5 -define-item Compass +define-item "Compass" cost 20 -define-item Quill and ink +define-item "Quill and ink" cost 5 -define-item Parchment +define-item "Parchment" cost 5 -define-item Blanket +define-item "Blanket" cost 5 -define-item Book of Legends +define-item "Book of Legends" cost 55 -define-item Book of Lore +define-item "Book of Lore" cost 55 -define-item Medicinal herbs +define-item "Medicinal herbs" cost 10 -define-item Bandages (3x) +define-item "Bandages (3x)" cost 5 -define-item Tea leaves +define-item "Tea leaves" cost 5 -define-item Sleeping potion +define-item "Sleeping potion" cost 15 -define-item Leather pouch +define-item "Leather pouch" cost 2 -define-item Face mask +define-item "Face mask" cost 10 -define-item Dye +define-item "Dye" cost 5 -define-item Cloth +define-item "Cloth" cost 5 -define-item Scissors +define-item "Scissors" cost 15 -define-item Needle and thread +define-item "Needle and thread" cost 3 -define-item Canvas +define-item "Canvas" cost 8 -define-item String +define-item "String" cost 2 -define-item Hatchet +define-item "Hatchet" cost 20 -define-item Map +define-item "Map" cost 35 -define-item Pony +define-item "Pony" cost 100 -define-item Horse +define-item "Horse" cost 180 -define-item Saddle and bridle +define-item "Saddle and bridle" cost 45 -define-item Saddlebag +define-item "Saddlebag" cost 35 -define-item Handmirror +define-item "Handmirror" cost 20 -define-item Magnifying glass +define-item "Magnifying glass" cost 20 -define-item Telescope +define-item "Telescope" cost 40 -define-item Rope ladder +define-item "Rope ladder" cost 15 -define-item Torches (3x) +define-item "Torches (3x)" cost 10 -define-item Staff +define-item "Staff" cost 10 -define-item Cooking pot +define-item "Cooking pot" cost 8 -define-item Soap +define-item "Soap" cost 2 -define-item Towel +define-item "Towel" cost 5 -define-item Boots +define-item "Boots" cost 10 \ No newline at end of file diff --git a/ATL/game-objects.atl b/ATL/game-objects.atl index a860e54..5e29634 100644 --- a/ATL/game-objects.atl +++ b/ATL/game-objects.atl @@ -4,7 +4,7 @@ ; @date 02/06/2015 define-monster "Fury" - description "Hades messengers, torturers, assassins. Beware!" + description "Hades' messengers, torturers, assassins. Beware!" strength 10 aggression 30 armour-class 3 @@ -28,4 +28,11 @@ define-npc "Charon" description "A robe-clad ghoul, dread ferryman of the Styx." - says "..." \ No newline at end of file + says "..." + +define-npc "Persephone" ;testing the shop system + description "Hades' beautiful wife, bringer of summer." + says "Welcome, my friend from the upper world!" + sells "Sleeping potion" + sells "Handmirror" + sells "Book of Lore" \ No newline at end of file diff --git a/ATL/lisp-test.atl b/ATL/lisp-test.atl index 5687b44..a89aa59 100644 --- a/ATL/lisp-test.atl +++ b/ATL/lisp-test.atl @@ -15,6 +15,7 @@ neighbour "Styx" neighbour "Fields of Punishment" neighbour "Fields of Asphodel" + npc "Persephone" define-place "Fields of Punishment" description "Precisely where you do NOT want to end up..." @@ -43,4 +44,5 @@ load-file game-objects.atl load-file creator-test.atl -start-place "Styx" \ No newline at end of file +start-place "Styx" +start-money 50 \ No newline at end of file diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 2d248a4..65594ad 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -25,10 +25,10 @@ (load-file "../ATL/lisp-test.atl") (let ((player (make-player :name "Bilbo" :race "Hobbit" :class "Burglar" - :place (world-starting-place *world*) + :place "Elysium" :strength 6 :constitution 12 :dexterity 19 :intelligence 14 - :game-admin T))) + :money 100 :game-admin T))) (add-game-object player) (set-object-attribute (get-game-object 'place (player-place player)) 'player (player-name player)) diff --git a/lisp/creator.lisp b/lisp/creator.lisp index e0bb854..cfd82ca 100644 --- a/lisp/creator.lisp +++ b/lisp/creator.lisp @@ -40,7 +40,8 @@ (setf atl-code (format NIL "~A~&~%~A" atl-code (concatenate 'string "define-" (string-downcase (to-string object-type)) - " " (first line-values)))) + " " (to-string #\") (first line-values) + (to-string #\")))) ;; Enter the value for each characteristic (dotimes (i (1- (length object-characteristics))) (setf atl-code (format NIL "~A~&~A" atl-code @@ -53,4 +54,16 @@ (defun world-creator () "The UI for the functions in this module" - (format t "~&Sorry, not yet available!")) + (clear-screen) + (format t "~&Welcome to the Atlantis world creator!") + (format t "~&~%What do you want to do?") + (case (choose-number-option '("Import a spreadsheet" "Nothing")) + (0 (progn + (format t "~&What OpenDocument spreadsheet do you want to import?") + (input-string s) + (format t "~&What ATL file do you want to export it to?") + (input-string a) + (import-spreadsheet s a) + (if (y-or-n-p "Done. Create something else?") + (world-creator) (start-menu)))) + (1 (start-menu)))) diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 47e400c..6fbcee5 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -25,12 +25,14 @@ (defstruct npc (name "") (description "") - (says "")) + (says "") + (sells NIL)) (defstruct monster (name "") (description "") (strength 0) + (dexterity 0) (aggression 0) (weapon "") (armour-class 0)) diff --git a/lisp/interpreter.lisp b/lisp/interpreter.lisp index f5d5656..8f69337 100644 --- a/lisp/interpreter.lisp +++ b/lisp/interpreter.lisp @@ -12,7 +12,7 @@ ;; A list of ATL language constructs ;; (Note: not complete - each (defcommand) appends to this list) (defvar *atl-commands* - '(load-file start-place name-world)) + '(load-file start-place start-money name-world)) (defun build-define-command (object-type) "Build a new define command function for the specified object type" @@ -43,6 +43,11 @@ (setf (world-starting-place *world*) place) NIL) +(defun start-money (amount) + (debugging "~&Starting money is ~A gold pieces" amount) + (setf (world-starting-money *world*) amount) + NIL) + (let ((world-directory NIL) (loaded-files NIL)) diff --git a/lisp/player.lisp b/lisp/player.lisp index 66328bf..b96302c 100644 --- a/lisp/player.lisp +++ b/lisp/player.lisp @@ -18,6 +18,7 @@ (dexterity 0) (constitution 0) (intelligence 0) + (money 0) (item NIL) (weapon "") (place "") @@ -43,8 +44,8 @@ (special-ability NIL)) -;; This function is probably superfluous, as the player struct should only store -;; names of game objects (the actual objects are stored in *world*) +;; XXX This function is probably superfluous, as the player struct should only +;; store names of game objects (the actual objects are stored in *world*) (let ((list-function (make-list-function 'player NIL))) (defun list-player-objects (object-type player) "Get a list of the names of all the player's objects of this type." diff --git a/lisp/ui.lisp b/lisp/ui.lisp index f8cb7cf..e5abbbf 100644 --- a/lisp/ui.lisp +++ b/lisp/ui.lisp @@ -39,7 +39,8 @@ "The user creates a new player" ;; XXX This function feels somewhat ugly - any possibility of a cleanup? (let ((player (make-player :name player-name - :place (world-starting-place *world*))) + :place (world-starting-place *world*) + :money (world-starting-money *world*))) (char-attr '((strength 0) (dexterity 0) (constitution 0) (intelligence 0))) @@ -114,7 +115,8 @@ ;; A list of all in-game commands. Each new command must be registered here. (defvar *commands* '(help place player - goto pickup drop talk + goto pickup drop + talk trade equip fight shoot about save clear)) @@ -131,7 +133,7 @@ player - Describe your player goto - Go to a neighbouring location about - Show a description of this entity -talk - Talk to an NPC +talk to - Talk to an NPC pickup - Pick up an item lying around drop - Drop the item equip - Equip this item as your weapon @@ -170,7 +172,8 @@ (format t "~&=====") (format t "~&Max health: ~A~ACurrent health: ~A" (player-max-health p) tab (player-health p)) - (format t "~&Experience: ~A" (player-experience p)))) + (format t "~&Experience: ~A~AMoney: ~A" + (player-experience p) tab (player-money p)))) ;;; These next functions have to take two arguments (the argument ;;; to the function and a player instance). @@ -215,6 +218,9 @@ (unless object-name (format t "~&Please specify the object you wish to inspect!") (return-from about)) + ;; A bit of syntactic sugar... + (cond ((equalp object-name "me") (player player) (return-from about)) + ((equalp object-name "here") (place player) (return-from about))) ;; TODO What about objects that the player is carrying? ;; And there's probably a more elegant way of doing this... (let ((place (get-game-object 'place (player-place player))) @@ -240,13 +246,54 @@ (unless npc-name (format t "~&Please specify an NPC to talk to!") (return-from talk)) + ;; Allow for a bit of syntactic sugar (note: interface inconsistency?) + (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))) (npc (when (member npc-name (place-npc place) :test #'equalp) (get-game-object 'npc npc-name)))) (if npc - (format t "~&~A: ~A" (string-upcase npc-name) (npc-says npc)) + (progn + (format t "~&~A: ~A" (string-upcase npc-name) (npc-says npc)) + (when (and (npc-sells npc) + (y-or-n-p "Trade with ~A?" npc-name)) + (trade player npc))) (format t "~&~A is not here!" npc-name)))) +(defun trade (player npc) + "The player trades with this NPC" + ;; TODO Implement player-sells-to-npc feature + (when (and (stringp npc) + (member npc + (place-npc (get-game-object 'place (player-place player))) + :test #'equalp)) + (setf npc (get-game-object 'npc npc)) + (unless (npc-sells npc) + (format t "~&This NPC doesn't sell anything!") + (return-from trade))) + (format t "~&~%What do you want to buy? Your money: ~S" + (player-money player)) + (let* ((choice (choose-option (append (npc-sells npc) (list "None")))) + (item (get-game-object 'item choice)) + (cost (if item (item-cost item) NIL))) + (cond ((equalp choice "None") NIL) + ;; XXX Do we have to insure that every object referenced by the + ;; world exists, or is that the responsibility of the person + ;; who writes the ATL code? + ((not item) + (format t "~&This object does not exist!") + (format t "(Talk to the world creator)") + NIL) + ((< (player-money player) cost) + (format t "~&You do not have enough money!")) + ((y-or-n-p "Buy ~A for ~S?" choice cost) + (decf (player-money player) cost) + (set-object-attribute player 'item choice) + (format t "~&Bought ~A for ~A." choice cost)))) + (if (y-or-n-p "Buy something else?") + (trade player npc) (clear player))) + (defun pickup (player &optional item-name) "The player picks up an item" (unless item-name @@ -283,7 +330,7 @@ (when (or (not new-weapon) (equalp new-weapon "none")) (setf (player-weapon player) "") (format t "~&You no longer have any weapon equipped.") - (return-from weapon)) + (return-from equip)) (if (and (member new-weapon (player-item player) :test #'equalp) (equalp (item-weapon (get-game-object 'item new-weapon)) "yes")) (progn diff --git a/lisp/world.lisp b/lisp/world.lisp index c6f01fe..2e739eb 100644 --- a/lisp/world.lisp +++ b/lisp/world.lisp @@ -26,7 +26,8 @@ (npcs NIL) (items NIL) (weapons NIL) - (starting-place "")) + (starting-place "") + (starting-money 0)) (setf *world* (make-world)) ;XXX Move this to another module? diff --git a/ATL/atl-mode.el b/ATL/atl-mode.el index efab9cf..598c28c 100644 --- a/ATL/atl-mode.el +++ b/ATL/atl-mode.el @@ -13,7 +13,8 @@ ;; define commands '("define-place" "define-item" "define-monster" "define-npc" "define-race" "define-place" "define-weapon" - "define-class" "name-world" "load-file" "start-place") + "define-class" "name-world" "load-file" + "start-place" "start-money") '() ;; other commands (adjust this?) '("\\.atl$") ;; files for which to activate this mode '(linum-mode) ;; other functions to call diff --git a/ATL/creator-test.atl b/ATL/creator-test.atl index fa40b88..6209e7c 100644 --- a/ATL/creator-test.atl +++ b/ATL/creator-test.atl @@ -1,185 +1,185 @@ ;; This code has been automatically generated by the ;; Atlantis world creator. -define-item Rope (20m) +define-item "Rope (20m)" cost 5 -define-item Backpack +define-item "Backpack" cost 5 -define-item Knife +define-item "Knife" cost 10 -define-item Short sword +define-item "Short sword" cost 40 -define-item Long sword +define-item "Long sword" cost 80 -define-item Dagger +define-item "Dagger" cost 20 -define-item Spear +define-item "Spear" cost 25 -define-item Short bow +define-item "Short bow" cost 30 -define-item Longbow +define-item "Longbow" cost 60 -define-item Slingshot +define-item "Slingshot" cost 15 -define-item Throwing knife +define-item "Throwing knife" cost 15 -define-item Quiver of arrows +define-item "Quiver of arrows" cost 20 -define-item Leather armour +define-item "Leather armour" cost 60 -define-item Chain mail +define-item "Chain mail" cost 120 -define-item Plate armour +define-item "Plate armour" cost 200 -define-item Buckler +define-item "Buckler" cost 35 -define-item Full shield +define-item "Full shield" cost 45 -define-item Candles (3x) +define-item "Candles (3x)" cost 5 -define-item Matches +define-item "Matches" cost 1 -define-item Food rations (5x) +define-item "Food rations (5x)" cost 10 -define-item Grappling hook +define-item "Grappling hook" cost 15 -define-item Fishing net +define-item "Fishing net" cost 25 -define-item Fishing rod +define-item "Fishing rod" cost 15 -define-item Tent (2 people) +define-item "Tent (2 people)" cost 30 -define-item Cloak +define-item "Cloak" cost 15 -define-item Hat +define-item "Hat" cost 10 -define-item Water bottle +define-item "Water bottle" cost 5 -define-item Compass +define-item "Compass" cost 20 -define-item Quill and ink +define-item "Quill and ink" cost 5 -define-item Parchment +define-item "Parchment" cost 5 -define-item Blanket +define-item "Blanket" cost 5 -define-item Book of Legends +define-item "Book of Legends" cost 55 -define-item Book of Lore +define-item "Book of Lore" cost 55 -define-item Medicinal herbs +define-item "Medicinal herbs" cost 10 -define-item Bandages (3x) +define-item "Bandages (3x)" cost 5 -define-item Tea leaves +define-item "Tea leaves" cost 5 -define-item Sleeping potion +define-item "Sleeping potion" cost 15 -define-item Leather pouch +define-item "Leather pouch" cost 2 -define-item Face mask +define-item "Face mask" cost 10 -define-item Dye +define-item "Dye" cost 5 -define-item Cloth +define-item "Cloth" cost 5 -define-item Scissors +define-item "Scissors" cost 15 -define-item Needle and thread +define-item "Needle and thread" cost 3 -define-item Canvas +define-item "Canvas" cost 8 -define-item String +define-item "String" cost 2 -define-item Hatchet +define-item "Hatchet" cost 20 -define-item Map +define-item "Map" cost 35 -define-item Pony +define-item "Pony" cost 100 -define-item Horse +define-item "Horse" cost 180 -define-item Saddle and bridle +define-item "Saddle and bridle" cost 45 -define-item Saddlebag +define-item "Saddlebag" cost 35 -define-item Handmirror +define-item "Handmirror" cost 20 -define-item Magnifying glass +define-item "Magnifying glass" cost 20 -define-item Telescope +define-item "Telescope" cost 40 -define-item Rope ladder +define-item "Rope ladder" cost 15 -define-item Torches (3x) +define-item "Torches (3x)" cost 10 -define-item Staff +define-item "Staff" cost 10 -define-item Cooking pot +define-item "Cooking pot" cost 8 -define-item Soap +define-item "Soap" cost 2 -define-item Towel +define-item "Towel" cost 5 -define-item Boots +define-item "Boots" cost 10 \ No newline at end of file diff --git a/ATL/game-objects.atl b/ATL/game-objects.atl index a860e54..5e29634 100644 --- a/ATL/game-objects.atl +++ b/ATL/game-objects.atl @@ -4,7 +4,7 @@ ; @date 02/06/2015 define-monster "Fury" - description "Hades messengers, torturers, assassins. Beware!" + description "Hades' messengers, torturers, assassins. Beware!" strength 10 aggression 30 armour-class 3 @@ -28,4 +28,11 @@ define-npc "Charon" description "A robe-clad ghoul, dread ferryman of the Styx." - says "..." \ No newline at end of file + says "..." + +define-npc "Persephone" ;testing the shop system + description "Hades' beautiful wife, bringer of summer." + says "Welcome, my friend from the upper world!" + sells "Sleeping potion" + sells "Handmirror" + sells "Book of Lore" \ No newline at end of file diff --git a/ATL/lisp-test.atl b/ATL/lisp-test.atl index 5687b44..a89aa59 100644 --- a/ATL/lisp-test.atl +++ b/ATL/lisp-test.atl @@ -15,6 +15,7 @@ neighbour "Styx" neighbour "Fields of Punishment" neighbour "Fields of Asphodel" + npc "Persephone" define-place "Fields of Punishment" description "Precisely where you do NOT want to end up..." @@ -43,4 +44,5 @@ load-file game-objects.atl load-file creator-test.atl -start-place "Styx" \ No newline at end of file +start-place "Styx" +start-money 50 \ No newline at end of file diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 2d248a4..65594ad 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -25,10 +25,10 @@ (load-file "../ATL/lisp-test.atl") (let ((player (make-player :name "Bilbo" :race "Hobbit" :class "Burglar" - :place (world-starting-place *world*) + :place "Elysium" :strength 6 :constitution 12 :dexterity 19 :intelligence 14 - :game-admin T))) + :money 100 :game-admin T))) (add-game-object player) (set-object-attribute (get-game-object 'place (player-place player)) 'player (player-name player)) diff --git a/lisp/creator.lisp b/lisp/creator.lisp index e0bb854..cfd82ca 100644 --- a/lisp/creator.lisp +++ b/lisp/creator.lisp @@ -40,7 +40,8 @@ (setf atl-code (format NIL "~A~&~%~A" atl-code (concatenate 'string "define-" (string-downcase (to-string object-type)) - " " (first line-values)))) + " " (to-string #\") (first line-values) + (to-string #\")))) ;; Enter the value for each characteristic (dotimes (i (1- (length object-characteristics))) (setf atl-code (format NIL "~A~&~A" atl-code @@ -53,4 +54,16 @@ (defun world-creator () "The UI for the functions in this module" - (format t "~&Sorry, not yet available!")) + (clear-screen) + (format t "~&Welcome to the Atlantis world creator!") + (format t "~&~%What do you want to do?") + (case (choose-number-option '("Import a spreadsheet" "Nothing")) + (0 (progn + (format t "~&What OpenDocument spreadsheet do you want to import?") + (input-string s) + (format t "~&What ATL file do you want to export it to?") + (input-string a) + (import-spreadsheet s a) + (if (y-or-n-p "Done. Create something else?") + (world-creator) (start-menu)))) + (1 (start-menu)))) diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 47e400c..6fbcee5 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -25,12 +25,14 @@ (defstruct npc (name "") (description "") - (says "")) + (says "") + (sells NIL)) (defstruct monster (name "") (description "") (strength 0) + (dexterity 0) (aggression 0) (weapon "") (armour-class 0)) diff --git a/lisp/interpreter.lisp b/lisp/interpreter.lisp index f5d5656..8f69337 100644 --- a/lisp/interpreter.lisp +++ b/lisp/interpreter.lisp @@ -12,7 +12,7 @@ ;; A list of ATL language constructs ;; (Note: not complete - each (defcommand) appends to this list) (defvar *atl-commands* - '(load-file start-place name-world)) + '(load-file start-place start-money name-world)) (defun build-define-command (object-type) "Build a new define command function for the specified object type" @@ -43,6 +43,11 @@ (setf (world-starting-place *world*) place) NIL) +(defun start-money (amount) + (debugging "~&Starting money is ~A gold pieces" amount) + (setf (world-starting-money *world*) amount) + NIL) + (let ((world-directory NIL) (loaded-files NIL)) diff --git a/lisp/player.lisp b/lisp/player.lisp index 66328bf..b96302c 100644 --- a/lisp/player.lisp +++ b/lisp/player.lisp @@ -18,6 +18,7 @@ (dexterity 0) (constitution 0) (intelligence 0) + (money 0) (item NIL) (weapon "") (place "") @@ -43,8 +44,8 @@ (special-ability NIL)) -;; This function is probably superfluous, as the player struct should only store -;; names of game objects (the actual objects are stored in *world*) +;; XXX This function is probably superfluous, as the player struct should only +;; store names of game objects (the actual objects are stored in *world*) (let ((list-function (make-list-function 'player NIL))) (defun list-player-objects (object-type player) "Get a list of the names of all the player's objects of this type." diff --git a/lisp/ui.lisp b/lisp/ui.lisp index f8cb7cf..e5abbbf 100644 --- a/lisp/ui.lisp +++ b/lisp/ui.lisp @@ -39,7 +39,8 @@ "The user creates a new player" ;; XXX This function feels somewhat ugly - any possibility of a cleanup? (let ((player (make-player :name player-name - :place (world-starting-place *world*))) + :place (world-starting-place *world*) + :money (world-starting-money *world*))) (char-attr '((strength 0) (dexterity 0) (constitution 0) (intelligence 0))) @@ -114,7 +115,8 @@ ;; A list of all in-game commands. Each new command must be registered here. (defvar *commands* '(help place player - goto pickup drop talk + goto pickup drop + talk trade equip fight shoot about save clear)) @@ -131,7 +133,7 @@ player - Describe your player goto - Go to a neighbouring location about - Show a description of this entity -talk - Talk to an NPC +talk to - Talk to an NPC pickup - Pick up an item lying around drop - Drop the item equip - Equip this item as your weapon @@ -170,7 +172,8 @@ (format t "~&=====") (format t "~&Max health: ~A~ACurrent health: ~A" (player-max-health p) tab (player-health p)) - (format t "~&Experience: ~A" (player-experience p)))) + (format t "~&Experience: ~A~AMoney: ~A" + (player-experience p) tab (player-money p)))) ;;; These next functions have to take two arguments (the argument ;;; to the function and a player instance). @@ -215,6 +218,9 @@ (unless object-name (format t "~&Please specify the object you wish to inspect!") (return-from about)) + ;; A bit of syntactic sugar... + (cond ((equalp object-name "me") (player player) (return-from about)) + ((equalp object-name "here") (place player) (return-from about))) ;; TODO What about objects that the player is carrying? ;; And there's probably a more elegant way of doing this... (let ((place (get-game-object 'place (player-place player))) @@ -240,13 +246,54 @@ (unless npc-name (format t "~&Please specify an NPC to talk to!") (return-from talk)) + ;; Allow for a bit of syntactic sugar (note: interface inconsistency?) + (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))) (npc (when (member npc-name (place-npc place) :test #'equalp) (get-game-object 'npc npc-name)))) (if npc - (format t "~&~A: ~A" (string-upcase npc-name) (npc-says npc)) + (progn + (format t "~&~A: ~A" (string-upcase npc-name) (npc-says npc)) + (when (and (npc-sells npc) + (y-or-n-p "Trade with ~A?" npc-name)) + (trade player npc))) (format t "~&~A is not here!" npc-name)))) +(defun trade (player npc) + "The player trades with this NPC" + ;; TODO Implement player-sells-to-npc feature + (when (and (stringp npc) + (member npc + (place-npc (get-game-object 'place (player-place player))) + :test #'equalp)) + (setf npc (get-game-object 'npc npc)) + (unless (npc-sells npc) + (format t "~&This NPC doesn't sell anything!") + (return-from trade))) + (format t "~&~%What do you want to buy? Your money: ~S" + (player-money player)) + (let* ((choice (choose-option (append (npc-sells npc) (list "None")))) + (item (get-game-object 'item choice)) + (cost (if item (item-cost item) NIL))) + (cond ((equalp choice "None") NIL) + ;; XXX Do we have to insure that every object referenced by the + ;; world exists, or is that the responsibility of the person + ;; who writes the ATL code? + ((not item) + (format t "~&This object does not exist!") + (format t "(Talk to the world creator)") + NIL) + ((< (player-money player) cost) + (format t "~&You do not have enough money!")) + ((y-or-n-p "Buy ~A for ~S?" choice cost) + (decf (player-money player) cost) + (set-object-attribute player 'item choice) + (format t "~&Bought ~A for ~A." choice cost)))) + (if (y-or-n-p "Buy something else?") + (trade player npc) (clear player))) + (defun pickup (player &optional item-name) "The player picks up an item" (unless item-name @@ -283,7 +330,7 @@ (when (or (not new-weapon) (equalp new-weapon "none")) (setf (player-weapon player) "") (format t "~&You no longer have any weapon equipped.") - (return-from weapon)) + (return-from equip)) (if (and (member new-weapon (player-item player) :test #'equalp) (equalp (item-weapon (get-game-object 'item new-weapon)) "yes")) (progn diff --git a/lisp/world.lisp b/lisp/world.lisp index c6f01fe..2e739eb 100644 --- a/lisp/world.lisp +++ b/lisp/world.lisp @@ -26,7 +26,8 @@ (npcs NIL) (items NIL) (weapons NIL) - (starting-place "")) + (starting-place "") + (starting-money 0)) (setf *world* (make-world)) ;XXX Move this to another module? diff --git a/notes b/notes deleted file mode 100644 index 4a0c6d9..0000000 --- a/notes +++ /dev/null @@ -1,9 +0,0 @@ -====================== -|| Project ATLANTIS || -====================== - -DEVELOPMENT NOTES - -- need to add unified error handling - -- need to add a lock file for the server \ No newline at end of file diff --git a/ATL/atl-mode.el b/ATL/atl-mode.el index efab9cf..598c28c 100644 --- a/ATL/atl-mode.el +++ b/ATL/atl-mode.el @@ -13,7 +13,8 @@ ;; define commands '("define-place" "define-item" "define-monster" "define-npc" "define-race" "define-place" "define-weapon" - "define-class" "name-world" "load-file" "start-place") + "define-class" "name-world" "load-file" + "start-place" "start-money") '() ;; other commands (adjust this?) '("\\.atl$") ;; files for which to activate this mode '(linum-mode) ;; other functions to call diff --git a/ATL/creator-test.atl b/ATL/creator-test.atl index fa40b88..6209e7c 100644 --- a/ATL/creator-test.atl +++ b/ATL/creator-test.atl @@ -1,185 +1,185 @@ ;; This code has been automatically generated by the ;; Atlantis world creator. -define-item Rope (20m) +define-item "Rope (20m)" cost 5 -define-item Backpack +define-item "Backpack" cost 5 -define-item Knife +define-item "Knife" cost 10 -define-item Short sword +define-item "Short sword" cost 40 -define-item Long sword +define-item "Long sword" cost 80 -define-item Dagger +define-item "Dagger" cost 20 -define-item Spear +define-item "Spear" cost 25 -define-item Short bow +define-item "Short bow" cost 30 -define-item Longbow +define-item "Longbow" cost 60 -define-item Slingshot +define-item "Slingshot" cost 15 -define-item Throwing knife +define-item "Throwing knife" cost 15 -define-item Quiver of arrows +define-item "Quiver of arrows" cost 20 -define-item Leather armour +define-item "Leather armour" cost 60 -define-item Chain mail +define-item "Chain mail" cost 120 -define-item Plate armour +define-item "Plate armour" cost 200 -define-item Buckler +define-item "Buckler" cost 35 -define-item Full shield +define-item "Full shield" cost 45 -define-item Candles (3x) +define-item "Candles (3x)" cost 5 -define-item Matches +define-item "Matches" cost 1 -define-item Food rations (5x) +define-item "Food rations (5x)" cost 10 -define-item Grappling hook +define-item "Grappling hook" cost 15 -define-item Fishing net +define-item "Fishing net" cost 25 -define-item Fishing rod +define-item "Fishing rod" cost 15 -define-item Tent (2 people) +define-item "Tent (2 people)" cost 30 -define-item Cloak +define-item "Cloak" cost 15 -define-item Hat +define-item "Hat" cost 10 -define-item Water bottle +define-item "Water bottle" cost 5 -define-item Compass +define-item "Compass" cost 20 -define-item Quill and ink +define-item "Quill and ink" cost 5 -define-item Parchment +define-item "Parchment" cost 5 -define-item Blanket +define-item "Blanket" cost 5 -define-item Book of Legends +define-item "Book of Legends" cost 55 -define-item Book of Lore +define-item "Book of Lore" cost 55 -define-item Medicinal herbs +define-item "Medicinal herbs" cost 10 -define-item Bandages (3x) +define-item "Bandages (3x)" cost 5 -define-item Tea leaves +define-item "Tea leaves" cost 5 -define-item Sleeping potion +define-item "Sleeping potion" cost 15 -define-item Leather pouch +define-item "Leather pouch" cost 2 -define-item Face mask +define-item "Face mask" cost 10 -define-item Dye +define-item "Dye" cost 5 -define-item Cloth +define-item "Cloth" cost 5 -define-item Scissors +define-item "Scissors" cost 15 -define-item Needle and thread +define-item "Needle and thread" cost 3 -define-item Canvas +define-item "Canvas" cost 8 -define-item String +define-item "String" cost 2 -define-item Hatchet +define-item "Hatchet" cost 20 -define-item Map +define-item "Map" cost 35 -define-item Pony +define-item "Pony" cost 100 -define-item Horse +define-item "Horse" cost 180 -define-item Saddle and bridle +define-item "Saddle and bridle" cost 45 -define-item Saddlebag +define-item "Saddlebag" cost 35 -define-item Handmirror +define-item "Handmirror" cost 20 -define-item Magnifying glass +define-item "Magnifying glass" cost 20 -define-item Telescope +define-item "Telescope" cost 40 -define-item Rope ladder +define-item "Rope ladder" cost 15 -define-item Torches (3x) +define-item "Torches (3x)" cost 10 -define-item Staff +define-item "Staff" cost 10 -define-item Cooking pot +define-item "Cooking pot" cost 8 -define-item Soap +define-item "Soap" cost 2 -define-item Towel +define-item "Towel" cost 5 -define-item Boots +define-item "Boots" cost 10 \ No newline at end of file diff --git a/ATL/game-objects.atl b/ATL/game-objects.atl index a860e54..5e29634 100644 --- a/ATL/game-objects.atl +++ b/ATL/game-objects.atl @@ -4,7 +4,7 @@ ; @date 02/06/2015 define-monster "Fury" - description "Hades messengers, torturers, assassins. Beware!" + description "Hades' messengers, torturers, assassins. Beware!" strength 10 aggression 30 armour-class 3 @@ -28,4 +28,11 @@ define-npc "Charon" description "A robe-clad ghoul, dread ferryman of the Styx." - says "..." \ No newline at end of file + says "..." + +define-npc "Persephone" ;testing the shop system + description "Hades' beautiful wife, bringer of summer." + says "Welcome, my friend from the upper world!" + sells "Sleeping potion" + sells "Handmirror" + sells "Book of Lore" \ No newline at end of file diff --git a/ATL/lisp-test.atl b/ATL/lisp-test.atl index 5687b44..a89aa59 100644 --- a/ATL/lisp-test.atl +++ b/ATL/lisp-test.atl @@ -15,6 +15,7 @@ neighbour "Styx" neighbour "Fields of Punishment" neighbour "Fields of Asphodel" + npc "Persephone" define-place "Fields of Punishment" description "Precisely where you do NOT want to end up..." @@ -43,4 +44,5 @@ load-file game-objects.atl load-file creator-test.atl -start-place "Styx" \ No newline at end of file +start-place "Styx" +start-money 50 \ No newline at end of file diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 2d248a4..65594ad 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -25,10 +25,10 @@ (load-file "../ATL/lisp-test.atl") (let ((player (make-player :name "Bilbo" :race "Hobbit" :class "Burglar" - :place (world-starting-place *world*) + :place "Elysium" :strength 6 :constitution 12 :dexterity 19 :intelligence 14 - :game-admin T))) + :money 100 :game-admin T))) (add-game-object player) (set-object-attribute (get-game-object 'place (player-place player)) 'player (player-name player)) diff --git a/lisp/creator.lisp b/lisp/creator.lisp index e0bb854..cfd82ca 100644 --- a/lisp/creator.lisp +++ b/lisp/creator.lisp @@ -40,7 +40,8 @@ (setf atl-code (format NIL "~A~&~%~A" atl-code (concatenate 'string "define-" (string-downcase (to-string object-type)) - " " (first line-values)))) + " " (to-string #\") (first line-values) + (to-string #\")))) ;; Enter the value for each characteristic (dotimes (i (1- (length object-characteristics))) (setf atl-code (format NIL "~A~&~A" atl-code @@ -53,4 +54,16 @@ (defun world-creator () "The UI for the functions in this module" - (format t "~&Sorry, not yet available!")) + (clear-screen) + (format t "~&Welcome to the Atlantis world creator!") + (format t "~&~%What do you want to do?") + (case (choose-number-option '("Import a spreadsheet" "Nothing")) + (0 (progn + (format t "~&What OpenDocument spreadsheet do you want to import?") + (input-string s) + (format t "~&What ATL file do you want to export it to?") + (input-string a) + (import-spreadsheet s a) + (if (y-or-n-p "Done. Create something else?") + (world-creator) (start-menu)))) + (1 (start-menu)))) diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 47e400c..6fbcee5 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -25,12 +25,14 @@ (defstruct npc (name "") (description "") - (says "")) + (says "") + (sells NIL)) (defstruct monster (name "") (description "") (strength 0) + (dexterity 0) (aggression 0) (weapon "") (armour-class 0)) diff --git a/lisp/interpreter.lisp b/lisp/interpreter.lisp index f5d5656..8f69337 100644 --- a/lisp/interpreter.lisp +++ b/lisp/interpreter.lisp @@ -12,7 +12,7 @@ ;; A list of ATL language constructs ;; (Note: not complete - each (defcommand) appends to this list) (defvar *atl-commands* - '(load-file start-place name-world)) + '(load-file start-place start-money name-world)) (defun build-define-command (object-type) "Build a new define command function for the specified object type" @@ -43,6 +43,11 @@ (setf (world-starting-place *world*) place) NIL) +(defun start-money (amount) + (debugging "~&Starting money is ~A gold pieces" amount) + (setf (world-starting-money *world*) amount) + NIL) + (let ((world-directory NIL) (loaded-files NIL)) diff --git a/lisp/player.lisp b/lisp/player.lisp index 66328bf..b96302c 100644 --- a/lisp/player.lisp +++ b/lisp/player.lisp @@ -18,6 +18,7 @@ (dexterity 0) (constitution 0) (intelligence 0) + (money 0) (item NIL) (weapon "") (place "") @@ -43,8 +44,8 @@ (special-ability NIL)) -;; This function is probably superfluous, as the player struct should only store -;; names of game objects (the actual objects are stored in *world*) +;; XXX This function is probably superfluous, as the player struct should only +;; store names of game objects (the actual objects are stored in *world*) (let ((list-function (make-list-function 'player NIL))) (defun list-player-objects (object-type player) "Get a list of the names of all the player's objects of this type." diff --git a/lisp/ui.lisp b/lisp/ui.lisp index f8cb7cf..e5abbbf 100644 --- a/lisp/ui.lisp +++ b/lisp/ui.lisp @@ -39,7 +39,8 @@ "The user creates a new player" ;; XXX This function feels somewhat ugly - any possibility of a cleanup? (let ((player (make-player :name player-name - :place (world-starting-place *world*))) + :place (world-starting-place *world*) + :money (world-starting-money *world*))) (char-attr '((strength 0) (dexterity 0) (constitution 0) (intelligence 0))) @@ -114,7 +115,8 @@ ;; A list of all in-game commands. Each new command must be registered here. (defvar *commands* '(help place player - goto pickup drop talk + goto pickup drop + talk trade equip fight shoot about save clear)) @@ -131,7 +133,7 @@ player - Describe your player goto - Go to a neighbouring location about - Show a description of this entity -talk - Talk to an NPC +talk to - Talk to an NPC pickup - Pick up an item lying around drop - Drop the item equip - Equip this item as your weapon @@ -170,7 +172,8 @@ (format t "~&=====") (format t "~&Max health: ~A~ACurrent health: ~A" (player-max-health p) tab (player-health p)) - (format t "~&Experience: ~A" (player-experience p)))) + (format t "~&Experience: ~A~AMoney: ~A" + (player-experience p) tab (player-money p)))) ;;; These next functions have to take two arguments (the argument ;;; to the function and a player instance). @@ -215,6 +218,9 @@ (unless object-name (format t "~&Please specify the object you wish to inspect!") (return-from about)) + ;; A bit of syntactic sugar... + (cond ((equalp object-name "me") (player player) (return-from about)) + ((equalp object-name "here") (place player) (return-from about))) ;; TODO What about objects that the player is carrying? ;; And there's probably a more elegant way of doing this... (let ((place (get-game-object 'place (player-place player))) @@ -240,13 +246,54 @@ (unless npc-name (format t "~&Please specify an NPC to talk to!") (return-from talk)) + ;; Allow for a bit of syntactic sugar (note: interface inconsistency?) + (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))) (npc (when (member npc-name (place-npc place) :test #'equalp) (get-game-object 'npc npc-name)))) (if npc - (format t "~&~A: ~A" (string-upcase npc-name) (npc-says npc)) + (progn + (format t "~&~A: ~A" (string-upcase npc-name) (npc-says npc)) + (when (and (npc-sells npc) + (y-or-n-p "Trade with ~A?" npc-name)) + (trade player npc))) (format t "~&~A is not here!" npc-name)))) +(defun trade (player npc) + "The player trades with this NPC" + ;; TODO Implement player-sells-to-npc feature + (when (and (stringp npc) + (member npc + (place-npc (get-game-object 'place (player-place player))) + :test #'equalp)) + (setf npc (get-game-object 'npc npc)) + (unless (npc-sells npc) + (format t "~&This NPC doesn't sell anything!") + (return-from trade))) + (format t "~&~%What do you want to buy? Your money: ~S" + (player-money player)) + (let* ((choice (choose-option (append (npc-sells npc) (list "None")))) + (item (get-game-object 'item choice)) + (cost (if item (item-cost item) NIL))) + (cond ((equalp choice "None") NIL) + ;; XXX Do we have to insure that every object referenced by the + ;; world exists, or is that the responsibility of the person + ;; who writes the ATL code? + ((not item) + (format t "~&This object does not exist!") + (format t "(Talk to the world creator)") + NIL) + ((< (player-money player) cost) + (format t "~&You do not have enough money!")) + ((y-or-n-p "Buy ~A for ~S?" choice cost) + (decf (player-money player) cost) + (set-object-attribute player 'item choice) + (format t "~&Bought ~A for ~A." choice cost)))) + (if (y-or-n-p "Buy something else?") + (trade player npc) (clear player))) + (defun pickup (player &optional item-name) "The player picks up an item" (unless item-name @@ -283,7 +330,7 @@ (when (or (not new-weapon) (equalp new-weapon "none")) (setf (player-weapon player) "") (format t "~&You no longer have any weapon equipped.") - (return-from weapon)) + (return-from equip)) (if (and (member new-weapon (player-item player) :test #'equalp) (equalp (item-weapon (get-game-object 'item new-weapon)) "yes")) (progn diff --git a/lisp/world.lisp b/lisp/world.lisp index c6f01fe..2e739eb 100644 --- a/lisp/world.lisp +++ b/lisp/world.lisp @@ -26,7 +26,8 @@ (npcs NIL) (items NIL) (weapons NIL) - (starting-place "")) + (starting-place "") + (starting-money 0)) (setf *world* (make-world)) ;XXX Move this to another module? diff --git a/notes b/notes deleted file mode 100644 index 4a0c6d9..0000000 --- a/notes +++ /dev/null @@ -1,9 +0,0 @@ -====================== -|| Project ATLANTIS || -====================== - -DEVELOPMENT NOTES - -- need to add unified error handling - -- need to add a lock file for the server \ No newline at end of file diff --git a/test b/test deleted file mode 100644 index 800a605..0000000 --- a/test +++ /dev/null @@ -1 +0,0 @@ -python/atlantis.py --server 88 --world worlds/Example/test.atl