Skip to content

Commit

Permalink
added lich boss
Browse files Browse the repository at this point in the history
  • Loading branch information
David O'Toole committed Dec 15, 2009
1 parent 3722f81 commit 6e73365
Show file tree
Hide file tree
Showing 13 changed files with 182 additions and 60 deletions.
7 changes: 5 additions & 2 deletions COPYING
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ in XE2. XE2 is provided under the terms of the GNU General Public
License, version 3.

The game subdirectories include MEDIA-COPYING files which place the
included GRAPHICS AND SOUND files under a Creative Commons
License. See each game's MEDIA-COPYING file for details.
included GRAPHICS AND SOUND files under various licenses, including
Creative Commons licenses. See each game's MEDIA-COPYING file for
details. NOTE. SOME OF THE GAMES ARE LICENSED WITH ONE CC LICENSE,
SOME WITH ANOTHER. CHECK THE MEDIA-COPYING FILE IN EACH GAME'S
SUBDIRECTORY.

The X11 color data is reproduced here in rgb.lisp under the MIT
License; see rgb.lisp for details.
Expand Down
Binary file added forest/ascent-gateway.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 21 additions & 2 deletions forest/base.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,27 @@ It has begun to snow."
:water-grain 0.5
:water-density 80
:water-cutoff 0.3))
(3 (list '=passage=))
(4 (list '=monastery=))))
(3 (list '=forest=
:level n
:description
"The trees thin here as you ascend toward the mountain pass."
:sequence-number (xe2:genseq)
:height *forest-height*
:width *forest-width*
:fireflies 20
:graveyards 0
:ruins 0
:terrain-type :tundra
:snowing t
:firewood 25
:archer-skeletons 8
:tree-grain 0.9
:tree-density 20
:water-grain 0.5
:water-density 0
:water-cutoff 0.3))
(4 (list '=passage=))
(5 (list '=monastery=))))

;;; Text overlay balloons

Expand Down
79 changes: 76 additions & 3 deletions forest/enemy.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
(direction :initform nil)
(speed :initform (make-stat :base 3))
(movement-cost :initform (make-stat :base 6))
(hit-points :initform (make-stat :base 16 :min 0))
(hit-points :initform (make-stat :base 12 :min 0))
(equipment-slots :initform '(:left-hand :right-hand))
(arrows :initform (make-stat :base 15 :min 0))
(max-items :initform (make-stat :base 3))
Expand Down Expand Up @@ -151,18 +151,91 @@
[expend-action-points self 10])
(multiple-value-bind (r c)
(step-in-direction <row> <column> <direction>)
[expend-action-points self 8]
[expend-action-points self 12]
(when [obstacle-at-p world r c]
[choose-new-direction self])
[move self <direction>])))))

(define-method die archer-skeleton ()
(unless <dead>
(setf <dead> t)
[drop self (clone =arrows= :count [stat-value self :arrows])]
(when (plusp [stat-value self :arrows])
[drop self (clone =arrows= :count [stat-value self :arrows])])
[play-sample self "death-alien"]
[delete-from-world self]))

;;; The horrifying Lich

(defcell lichblade
(name :initform "lichblade")
(categories :initform '(:item :weapon :equipment))
(tile :initform "dagger")
(attack-power :initform (make-stat :base 30))
(attack-cost :initform (make-stat :base 30))
(accuracy :initform (make-stat :base 90))
(stepping :initform t)
(weight :initform 3000)
(equip-for :initform '(:left-hand :right-hand)))

(define-prototype lich (:parent xe2:=cell=)
(name :initform "Lich")
(strength :initform (make-stat :base 29 :min 0 :max 40))
(dexterity :initform (make-stat :base 15 :min 0 :max 30))
(intelligence :initform (make-stat :base 19 :min 0 :max 30))
(categories :initform '(:actor :target :obstacle :opaque :enemy :equipper))
(equipment-slots :initform '(:left-hand :right-hand))
(max-items :initform (make-stat :base 3))
(stepping :initform t)
(speed :initform (make-stat :base 2))
(movement-cost :initform (make-stat :base 8))
(attacking-with :initform :left-hand)
(screamed :initform nil)
(max-weight :initform (make-stat :base 25))
(hit-points :initform (make-stat :base 60 :min 0 :max 10))
(tile :initform "lich")
(description :initform "The Lich is a rotting skeletal horror in red velvet robes."))

(define-method initialize lich ()
[make-inventory self]
[make-equipment self])

(define-method loadout lich ()
(let ((blade (clone =lichblade=)))
[equip self [add-item self blade]]))

(define-method attack lich (target)
[damage [get-player *world*] 10]
[expend-action-points self 40]
[play-sample self "lichdie"]
[say self "The Lich screams 'DIE!' as it stabs at you."])

(define-method run lich ()
(when (and (null <screamed>)
(< [distance-to-player self] 15))
(setf <screamed> t)
[play-sample self "lichscream"])
(clon:with-field-values (row column) self
(let* ((world *world*)
(direction [direction-to-player *world* row column]))
(if [adjacent-to-player world row column]
[>>attack self direction]
(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]
(progn (setf <direction> (random-direction))
[>>move self direction])))
(progn (when (< 7 (random 10))
(setf <direction> (random-direction)))
[>>move self direction]))))))

(define-method die lich ()
[say self "The lich dies!"]
[play-sample self "lichdeath"]
[parent>>die self])



;;; Wolves are the most difficult enemies.

(defcell wolf
Expand Down
Binary file modified forest/forest.fasl
Binary file not shown.
75 changes: 68 additions & 7 deletions forest/forest.lisp
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
(in-package :forest)

;;; Icy tundra

(defparameter *tundra-tiles* '("tundra-1"
"tundra-2"
"tundra-3"
"tundra-4"
"tundra-5"
"tundra-6"
"floor"))

(defparameter *tundra-light-radius* 14)


(defcell tundra
(tile :initform "floor")
(description :initform "This frozen surface is treacherous.")
(categories :initform '(:actor :reflective)))

(define-method blow tundra (dark)
(let ((snow [category-at-p *world* <row> <column> :snow]))
(when snow
[update-tile snow dark])
(if (minusp <snow-clock>)
(progn (setf <snow-clock> *snow-clock*)
(if (null snow)
(percent-of-time 3
(setf snow (clone =snow=))
[drop self snow])
(percent-of-time 10
[collect snow 1 dark])))
(decf <snow-clock>))))

(define-method run tundra ()
(let* ((dist [distance-to-player self]))
(setf <tile> (if (< dist *tundra-light-radius*)
(nth (truncate (/ dist 2)) *tundra-tiles*)
"floor"))))

;;; Water

(defcell foam
Expand Down Expand Up @@ -58,7 +96,7 @@
(defcell tree
(tile :initform "tree-1")
(description :initform "These trees are still green. Perhaps the land is coming back?")
(categories :initform '(:obstacle :opaque :nosnow)))
(categories :initform '(:obstacle :opaque :nosnow :exclusive)))

;;; The snow

Expand Down Expand Up @@ -151,7 +189,7 @@
(defcell wall
(tile :initform "wall")
(description :initform "These crumbling walls are all that remain of some old town.")
(categories :initform '(:obstacle :opaque)))
(categories :initform '(:obstacle :opaque :exclusive)))

(defcell debris
(tile :initform "debris"))
Expand Down Expand Up @@ -214,7 +252,6 @@
(setf clock (+ 5 (random 5)))))))
[move self (random-direction)]))


;;; Bodies of other adventurers

(defcell body
Expand All @@ -225,7 +262,7 @@
(define-method step body (stepper)
(when [is-player stepper]
[say self "You search the body."]
(unless (percent-of-time 30
(unless (percent-of-time 40
(prog1 t
[drop self (clone (car (one-of (list =herb= =arrows=))))]))
[say self "Nothing was found."])
Expand Down Expand Up @@ -260,6 +297,11 @@
(dotimes (j <width>)
[drop-cell self (clone =earth=) i j])))

(define-method drop-tundra forest ()
(dotimes (i <height>)
(dotimes (j <width>)
[drop-cell self (clone =tundra=) i j])))

(define-method drop-trees forest (&optional &key (object =tree=)
distance
(row 0) (column 0)
Expand Down Expand Up @@ -302,6 +344,16 @@
(define-method step river-gateway (stepper)
[say self "The river meets the forest here. Press ENTER to continue on."])

(define-prototype ascent-gateway (:parent =gateway=)
(tile :initform "ascent-gateway")
(name :initform "To the Ascent")
(description :initform "The trees thin here and the land becomes more icy.")
(sequence-number :initform (genseq))
(address :initform (generate-level-address 3)))

(define-method step ascent-gateway (stepper)
[say self "The climb begins here. Press ENTER to continue on."])

(define-prototype passage-gateway (:parent =gateway=)
(tile :initform "passage-gateway")
(name :initform "Passage to the mountains")
Expand Down Expand Up @@ -395,6 +447,7 @@
(ruins 15)
(herbs 2)
(firewood 14)
(terrain-type :earth)
level snowing raining
(tree-grain 0.3)
(tree-density 30)
Expand All @@ -409,7 +462,9 @@
(setf <snowing> snowing <raining> raining)
(setf <level> level)
[create-default-grid self]
[drop-earth self]
(ecase terrain-type
(:earth [drop-earth self])
(:tundra [drop-tundra self]))
[drop-cell self (clone =storm=) 0 0]
(dotimes (i fireflies)
(let ((firefly (clone =firefly=)))
Expand Down Expand Up @@ -439,11 +494,17 @@
[drop-cell self (clone =archer-skeleton=) r c :exclusive t :probe t :loadout t]))
(let* ((gateway (clone (ecase level
(1 =river-gateway=)
(2 =passage-gateway=))))
(2 =ascent-gateway=)
(3 =passage-gateway=))))
(row (+ (- height 10) (random 10))) ;; 20 FIXME
(column (random 10)))
[replace-cells-at *world* row column gateway]
[set-location gateway row column]))
[set-location gateway row column])
;; drop Lich if needed
(let ((lich (clone =lich=)))
(when (= level 3)
[drop-cell self lich (+ 60 (random 20)) (random width) :loadout t])))


(define-method begin-ambient-loop forest ()
(play-sample "lutey")
Expand Down
14 changes: 6 additions & 8 deletions forest/forest.org
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
** TODO edible fruits to find
** TODO Catacombs
** TODO rose found in the forest
** TODO [#A] make wolves less annoying
** TODO more herbs on dead bodies'
** TODO [#A] fix 100% cpu usage
*** WAITING talk to luke
** TODO rest and shelter
** TODO magic barrier shield (flickering sprites)
** TODO magic missile (sparkly trails.)
** TODO enemies search for dark spots
** TODO [#B] fix scrolling
** TODO [#C] Command-Q should quit on mac ?
** TODO [#A] don't place bodies in walls OR ITEMS
** TODO [#C] indicate edge of map with chevrons. piece together maps.
** TODO [#C] overworld map? (FUTURE)
** TODO [#B] fix in-game map scrolling off bottom of viewport
** TODO [#B] find in-game notes with same color scheme text as scroll
** TODO [#B] longer level approach to monastery, talk to a few npcs, follow a road and cross fences
** TODO [#C] fix scrolling
** TODO [#C] Command-Q should quit on mac ?
** TODO [#C] indicate edge of map with chevrons. piece together maps.
** TODO [#C] overworld map? (FUTURE)
6 changes: 6 additions & 0 deletions forest/forest.pak
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@
(:name "help-message" :type :formatted-text :file "README")

(:name "snowflake" :type :image :file "snowflake.png")
(:name "lich" :type :image :file "lich.png")
(:name "lichblade" :type :image :file "lichblade.png")
(:name "monastery" :type :image :file "monastery.png")
(:name "monastery-gateway" :type :image :file "monastery-gateway.png")
(:name "ascent-gateway" :type :image :file "ascent-gateway.png")

(:name "water-1" :type :image :file "water-1.png")
(:name "water-2" :type :image :file "water-2.png")
Expand Down Expand Up @@ -98,6 +101,9 @@
(:name "wall" :type :image :file "wall.png")
(:name "dandelion" :type :image :file "dandelion.png")
(:name "death" :type :sample :file "death.wav" :properties (:volume 40))
(:name "lichdeath" :type :sample :file "lichdeath.wav" :properties (:volume 40))
(:name "lichdie" :type :sample :file "lichdie.wav" :properties (:volume 40))
(:name "lichscream" :type :sample :file "lichscream.wav" :properties (:volume 40))
(:name "death-alien" :type :sample :file "death-alien.wav" :properties (:volume 30))
(:name "knock" :type :sample :file "knock.wav" :properties (:volume 50))
(:name "monks" :type :sample :file "monks.wav" :properties (:volume 25))
Expand Down
Binary file added forest/lich.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added forest/lichdeath.wav
Binary file not shown.
Binary file added forest/lichdie.wav
Binary file not shown.
Binary file added forest/lichscream.wav
Binary file not shown.
38 changes: 0 additions & 38 deletions forest/mountain.lisp
Original file line number Diff line number Diff line change
@@ -1,43 +1,5 @@
(in-package :forest)

;;; Icy tundra

(defparameter *tundra-tiles* '("tundra-1"
"tundra-2"
"tundra-3"
"tundra-4"
"tundra-5"
"tundra-6"
"floor"))

(defparameter *tundra-light-radius* 14)


(defcell tundra
(tile :initform "floor")
(description :initform "This frozen surface is treacherous.")
(categories :initform '(:actor :reflective)))

(define-method blow tundra (dark)
(let ((snow [category-at-p *world* <row> <column> :snow]))
(when snow
[update-tile snow dark])
(if (minusp <snow-clock>)
(progn (setf <snow-clock> *snow-clock*)
(if (null snow)
(percent-of-time 3
(setf snow (clone =snow=))
[drop self snow])
(percent-of-time 10
[collect snow 1 dark])))
(decf <snow-clock>))))

(define-method run tundra ()
(let* ((dist [distance-to-player self]))
(setf <tile> (if (< dist *tundra-light-radius*)
(nth (truncate (/ dist 2)) *tundra-tiles*)
"floor"))))

(defcell mountain
(tile :initform "mountain")
(description :initform "The walls of the passageway are slick with ice.")
Expand Down

0 comments on commit 6e73365

Please sign in to comment.