Skip to content

Commit

Permalink
teleporting lich
Browse files Browse the repository at this point in the history
  • Loading branch information
David O'Toole committed Dec 17, 2009
1 parent 7b53ca8 commit da04ecf
Show file tree
Hide file tree
Showing 13 changed files with 95 additions and 12 deletions.
5 changes: 5 additions & 0 deletions forest/README
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ eventually die. All progress is lost when a character dies, and a new
game is generated for the next play. Press ESCAPE to restart after
dying.

You have a long distance to travel, and a limited amount of food and
ammunition. Don't fight everything you see if you need to conserve
arrows. Use your map (by default, inventory slot 1) to orient yourself
toward the path to the Monastery.

Your measure of health is the red HIT POINTS bar at the top of the
screen; when this reaches zero, you die. Use healing herbs, scattered
around the forest and scavenged from victims of the undead, to restore
Expand Down
Binary file added forest/chimes-2.wav
Binary file not shown.
Binary file added forest/chimes-3.wav
Binary file not shown.
36 changes: 35 additions & 1 deletion forest/enemy.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,19 @@
(weight :initform 3000)
(equip-for :initform '(:left-hand :right-hand)))

(defcell sparkles
(tile :initform "sparkles-1")
(categories :initform '(:actor))
(clock :initform 8))

(define-method run sparkles ()
(decf <clock>)
(if (plusp <clock>)
(progn [move self (random-direction)]
(setf <tile> (car (one-of '("sparkles-1" "sparkles-2"))))
[play-sample self (car (one-of '("chimes-2" "chimes-3")))])
[die self]))

(define-prototype lich (:parent xe2:=cell=)
(name :initform "Lich")
(strength :initform (make-stat :base 29 :min 0 :max 40))
Expand Down Expand Up @@ -206,6 +219,27 @@
(let ((blade (clone =lichblade=)))
[equip self [add-item self blade]]))

(define-method teleport lich ()
(dotimes (i 10)
[drop self (clone =sparkles=)])
(let ((row [player-row *world*])
(column [player-column *world*]))
(let ((coords
(block searching
(dolist (dir '(:north :south :east :west))
(multiple-value-bind (r c) (step-in-direction row column dir)
(unless (and [obstacle-at-p *world* r c]
(< [distance-to-player self] 8))
[say self "The lich teleports right in front of you!"]
(return-from searching (list r c))))))))
(when coords
(destructuring-bind (r c) coords
[delete-from-world self]
[drop-cell *world* self r c]
(dotimes (i 10)
[drop self (clone =sparkles=)]))))))


(define-method attack lich (target)
[damage [get-player *world*] 10]
[expend-action-points self 40]
Expand All @@ -227,7 +261,7 @@
(if [obstacle-in-direction-p world row column direction]
(let ((target [target-in-direction-p world row column direction]))
(if (and target (not [in-category target :enemy]))
[>>attack self direction]
(percent-of-time 10 [teleport self])
(progn (setf <direction> (random-direction))
[>>move self direction])))
(progn (when (< 7 (random 10))
Expand Down
2 changes: 1 addition & 1 deletion forest/forest.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
(defcell tree
(tile :initform (car (one-of '("tree-2" "tree-2" "tree-2" "tree-3"))))
(description :initform "These trees are still green. Perhaps the land is coming back?")
(categories :initform '(:obstacle :opaque :nosnow :exclusive)))
(categories :initform '(:obstacle :opaque :nosnow :exclusive :target)))

;;; The snow

Expand Down
13 changes: 8 additions & 5 deletions forest/forest.org
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
** TODO [#A] don't spawn player on tree
** TODO THE BLACK TABLETS INSCRIBED WITH PROPHECY
** TODO [#A] FIX numlock being on breaks shift keybinding
** TODO [#A] treasure on enemies (gold)
** TODO [#C] joypad support
** TODO [#A] sheet music in-game
** TODO [#A] don't spawn player on tree
** TODO [#A] fix bubbles to stay onscreen, Lothaine etc
** TODO [#A] forest exits should be able to be in any column
** TODO [#A] lich incantation distance attackk?
** TODO [#A] move lich a little more quickly?
** TODO [#A] sheet music in-game
** TODO [#A] treasure on enemies (gold)
** TODO [#A] you hear rushing water to the east, fix not being able to find exits.
** TODO [#B] alpha transparency
** TODO [#B] don't have enemies attack when you dead
** TODO [#C] add emote code to XE2 and cells
** TODO [#B] find in-game notes with same color scheme text as scroll
** TODO [#B] ghouls that pop out of the ground
** TODO [#B] magic missile (sparkly trails.)
** TODO [#B] more story stuff
** TODO [#B] oil flask bomb
** TODO [#B] rose found in the forest
** TODO [#B] teleporting lich next to player!
** TODO [#B] wolves are annoying
** TODO [#C] Command-Q should quit on mac ?
** TODO [#C] add emote code to XE2 and cells
** TODO [#C] cremating the mountain body
** TODO [#C] enemies search for dark spots
** TODO [#C] fix 100% cpu usage
** TODO [#C] fix in-game map scrolling off bottom of viewport
** TODO [#C] fix scrolling
** TODO [#C] indicate edge of map with chevrons. piece together maps.
** TODO [#C] joypad support
** TODO [#C] longer level approach to monastery, talk to a few npcs, follow a road and cross fences
** TODO [#C] magic barrier shield (flickering sprites)
** TODO [#C] overworld map? (FUTURE)
8 changes: 8 additions & 0 deletions forest/forest.pak
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
(:name "tree-4" :type :image :file "tree-4.png")
(:name "tree-5" :type :image :file "tree-5.png")

(:name "rose" :type :image :file "rose.png")
(:name "mountain-body" :type :image :file "mountain-body.png")

(:name "sparkles-1" :type :image :file "sparkles-1.png")
(:name "sparkles-2" :type :image :file "sparkles-2.png")

(:name "snow-1" :type :image :file "snow-1.png")
(:name "snow-2" :type :image :file "snow-2.png")
(:name "snow-3" :type :image :file "snow-3.png")
Expand All @@ -56,6 +62,8 @@
(:name "chimes" :type :sample :file "chimes.wav" :properties (:volume 20))
(:name "path" :type :sample :file "path.wav" :properties (:volume 20))
(:name "flutism" :type :sample :file "flutism.wav" :properties (:volume 13))
(:name "chimes-2" :type :sample :file "chimes-2.wav" :properties (:volume 13))
(:name "chimes-3" :type :sample :file "chimes-3.wav" :properties (:volume 13))
(:name "bark" :type :sample :file "bark.wav" :properties (:volume 30))
(:name "yelp" :type :sample :file "yelp.wav" :properties (:volume 30))

Expand Down
9 changes: 7 additions & 2 deletions forest/monastery.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,27 @@

(defcell hill-1
(description :initform "This gentle slope heads down toward the Monastery.")
(name :initform "Hillside")
(tile :initform "hill-1"))

(defcell hill-2
(description :initform "This gentle slope heads down toward the Monastery.")
(name :initform "Hillside")
(tile :initform "hill-2"))

(defcell hill-3
(description :initform "This gentle slope heads down toward the Monastery.")
(name :initform "Hillside")
(tile :initform "hill-3"))

(defcell flowers-1
(description :initform "Gorgeous wildflowers.")
(description :initform "Gorgeous wildflowers like you never saw in Nothbess town.")
(name :initform "Wildflowers")
(tile :initform "flowers-1"))

(define-prototype flowers-2 (:parent =flowers-1=)
(description :initform "Wildflowers of every description.")
(description :initform "Wildflowers of every description. This land is precious.")
(name :initform "Wildflowers")
(tile :initform "flowers-2")
(categories :initform '(:actor)))

Expand Down
Binary file added forest/mountain-body.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 30 additions & 2 deletions forest/mountain.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,29 @@
(description :initform "The walls of the passageway are slick with ice.")
(categories :initform '(:obstacle :opaque)))

(defcell rose
(tile :initform "rose")
(description :initform
"This rose appears fresh despite the cold.
Perhaps it was laid beside the body?")
(categories :initform '(:story :item)))

(define-method step rose (stepper)
(when [is-player stepper]
(if [take stepper :direction :here :category :item]
(progn [say self "You take the rose."]
[play-sample self "chimes"])
[say self "Your satchel is full."])))

(defcell mountain-body
(tile :initform "mountain-body")
(name :initform "Frozen body")
(description :initform
"This is the dead body of a Sanctuary Order monk.
We'll have to send out a party later to recover the body and
prepare it for cremation."))


;;; Mountain passage world

(defparameter *passage-width* 49)
Expand All @@ -24,18 +47,23 @@

(define-method drop-mountains passage ()
(let* ((offset 10)
(right (- <width> 17 )))
(right (- <width> 17 ))
(rose-row (+ 30 (random 20))))
(dotimes (i <height>)
(setf offset (min right (max 0 (incf offset (if (= 0 (random 2))
1 -1)))))
(labels ((drop-mountain (r c)
(prog1 nil
[drop-cell *world* (clone =mountain=) r c])))
(trace-row #'drop-mountain i 0 (+ offset (random 4)))
(when (= i rose-row)
(let ((rose-col (+ offset 10 (random 5))))
[drop-cell self (clone =mountain-body=) i rose-col]
[drop-cell self (clone =rose=) i (+ 1 rose-col)]))
(percent-of-time 10 [drop-cell self (clone =wolf=) i (+ offset (random 4))])
(trace-row #'drop-mountain i (+ offset (random 4) 20) <width>)))
;; drop monastery gateway
(let ((column (+ 1 offset (random 10)))
(let ((column (+ 12 offset (random 10)))
(row (- <height> 2)))
[replace-cells-at self row column (clone =monastery-gateway=)])))

Expand Down
Binary file added forest/path-old1.wav
Binary file not shown.
Binary file added forest/rose.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion forest/startup.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@
(defparameter *room-window-width* 800)
(defparameter *room-window-height* 600)

(defparameter *start-level* 1)
(defparameter *start-level* 3)

(defun init-forest ()
(xe2:message "Initializing Forest...")
Expand Down

0 comments on commit da04ecf

Please sign in to comment.