Skip to content

Instantly share code, notes, and snippets.

@mohiji
Created November 15, 2011 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohiji/1367565 to your computer and use it in GitHub Desktop.
Save mohiji/1367565 to your computer and use it in GitHub Desktop.
Very early beginnings of a Legend of the Red Dragon style game.
(defparameter *locations* (make-hash-table :test 'eq))
(defclass location ()
((name :accessor location-name :initarg :name)
(description :accessor location-description :initarg :description)
(exits :accessor location-exits :initarg :exits)))
(defmacro define-location (symbol-name &key name description exits)
`(setf (gethash ',symbol-name *locations*)
(make-instance 'location
:name ,name
:description ,description
:exits ,exits)))
(define-location town
:name "Main Street"
:description
"Main street winds through the town, leading to the river at one end
and the forest at the other. Various homes, stores and other
buildings line it."
:exits '((inn inn "The INN looks inviting.")
(armory armory "Ironworks ARMORY is the place to go for weapons and armor.")
(store store "The General STORE is the place to go for groceries.")))
(define-location inn
:name "The Inn"
:description "You are in a well kept, though dimly lit inn."
:exits '((out town "A door leads OUT to the street.")))
(define-location armory
:name "Ironworks Armoury"
:description
"The armoury is filled near to bursting with racks of swords, staves,
breastplates, grieves, and all the other fun implements for maiming
others whilst avoiding being maimed yourself."
:exits '((out town "A door leads OUT to the street.")))
(define-location store
:name "General Store"
:description
"Shelves of sundries fill the general store."
:exits '((out town "A door leads OUT to the street.")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment