diff options
-rwxr-xr-x | crpg.lisp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/crpg.lisp b/crpg.lisp index 6f37799..ed56e31 100755 --- a/crpg.lisp +++ b/crpg.lisp @@ -63,15 +63,15 @@ (make-instance (find-class c) 'n n 'v v)) (defconstant +items+ (vector - (create-item "apple" '<food> 1) - (create-item "bread" '<food> 2) - (create-item "chicken" '<food> 3) - (create-item "dagger" '<weapon> 2) - (create-item "sword" '<weapon> 3) - (create-item "halberd" '<weapon> 4) - (create-item "smoke" '<trap> 1) + (create-item "apple " '<food> 1) + (create-item "bread " '<food> 2) + (create-item "chicken " '<food> 3) + (create-item "dagger " '<weapon> 2) + (create-item "sword " '<weapon> 3) + (create-item "halberd " '<weapon> 4) + (create-item "smoke " '<trap> 1) (create-item "noose trap" '<trap> 2) - (create-item "pit trap" '<trap> 3))) + (create-item "pit trap " '<trap> 3))) (defgeneric copy (obj)) (defmethod copy ((obj <monster>)) (create-monster (name obj) (attack obj) (health obj))) @@ -158,7 +158,7 @@ (setf (health *the-player*) (- (health *the-player*) 1)))) (my-print +press-key+) (read-line))) - (cursor 10 1) + (cursor 10 1) (clrtoeol) (if (> (health *the-player*) 0) (progn (my-print "You won the fight!") (format *standard-output* "You found ~A pieces of gold!~%" *monster-gold*) @@ -193,7 +193,7 @@ (format *standard-output* "Your weapon rating is now ~A.~%" (weapon *the-player)))))) (my-print +press-key+) (read-line) - (setf (item (aref *map* (row *curr-coord*) (col *curr-coord))) nil)))) + (setf (item (aref *map* (row *curr-coord*) (col *curr-coord*))) nil)))) ((string= cmd "q") (my-print "Bye!") (throw 'quit nil)))) @@ -218,15 +218,16 @@ (clrtoeol) (let ((monster-type (monster (aref *map* (row *curr-coord*) (col *curr-coord*))))) (if (null monster-type) - (progn (setq *curr-monster* nil) - (setq *monster-gold* 0)) - (progn (setq *curr-monster* (copy (elt +monsters+ monster-type))) - (format *standard-output* "Monster: ~A~%" *curr-monster*) - (setq *monster-gold* (* monster-type (random 6)))))) + (progn (setq *curr-monster* nil) + (format *standard-output* "Monster: nothing~%") + (setq *monster-gold* 0)) + (progn (setq *curr-monster* (copy (elt +monsters+ monster-type))) + (format *standard-output* "Monster: ~A~%" *curr-monster*) + (setq *monster-gold* (* monster-type (random 6)))))) (let ((item-type (item (aref *map* (row *curr-coord*) (col *curr-coord*))))) (if (null item-type) (progn (cursor 15 41) - (my-print "nothing")) + (my-print "nothing ")) (progn (setq *curr-item* (elt +items+ item-type)) (cursor 15 41) (my-print (name *curr-item*)) |