Skip to content

Commit

Permalink
added missing pngs
Browse files Browse the repository at this point in the history
  • Loading branch information
David O'Toole committed Dec 14, 2009
1 parent e95fd77 commit a869bb5
Show file tree
Hide file tree
Showing 15 changed files with 112 additions and 50 deletions.
Binary file added forest/arrow-diagonal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions forest/base.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ It has begun to snow."
:snowing t
:tree-grain 0.2
:tree-density 30
:water-grain 0.2
:water-density 90
:water-cutoff 0.2))
:water-grain 0.5
:water-density 80
:water-cutoff 0.3))
(3 (list '=passage=))
(4 (list '=monastery=))))

Expand Down
Binary file added forest/dandelion.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/fire-1.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/fire-2.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/fire-3.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/firewood-1.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/firewood-2.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 modified forest/forest.fasl
Binary file not shown.
36 changes: 6 additions & 30 deletions forest/forest.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
(percent-of-time 1 [drop self (clone =foam=)]))
"floor"))))

(define-method step water (stepper)
(when [is-player stepper]
[wet stepper]))

;;; The storm is an invisible cell that sits in the corner and plays thunder

(defcell storm
Expand Down Expand Up @@ -213,34 +217,6 @@

;;; Bodies of other adventurers

(defcell arrows
(tile :initform "arrows")
(count :initform (+ 6 (random 18))))

(define-method step arrows (stepper)
(when [is-player stepper]
[say self "You found ~S arrows." <count>]
[stat-effect stepper :arrows <count>]
[die self]))

(defcell herb
(tile :initform "herb")
(description :initform "This healing herb will restore some of your health.")
(categories :initform '(:item))
(equip-for :initform '(:right-hand :left-hand)))

(define-method step herb (stepper)
(when [is-player stepper]
(if [take stepper :direction :here :category :item]
[say self "You found a healing herb."]
[say self "Your satchel is full."])))

(define-method use herb (user)
(when (and user (has-field :hit-points user))
(prog1 t
[stat-effect user :hit-points 12]
[say self "You consume the healing herb and quickly feel better."])))

(defcell body
(tile :initform "body")
(description :initform "This long-dead body may yet hold usable supplies.")
Expand Down Expand Up @@ -407,7 +383,7 @@
(trace-rectangle #'drop-floor (1+ row) (1+ column) (- height 2) (- width 2) :fill))
(dotimes (n (random 3))
(percent-of-time 70
[drop-cell self (clone =body=) (+ 1 row (random (- height 1))) (+ column (random (- width 1)))
[drop-cell self (clone =body=) (+ 2 row (random (- height 2))) (+ 2 column (random (- width 2)))
:exclusive t :probe t])))))

(define-method generate forest (&key (height *forest-height*)
Expand Down Expand Up @@ -452,7 +428,7 @@
:exclusive t :probe t]
(dotimes (n herbs)
(multiple-value-bind (r c) [random-place self]
[drop-cell self (clone =herb=) r c])))
[drop-cell self (clone =herb=) r c :exclusive t :probe t])))
(let* ((gateway (clone (ecase level
(1 =river-gateway=)
(2 =passage-gateway=))))
Expand Down
4 changes: 0 additions & 4 deletions forest/forest.org
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
** TODO [#A] fix being able to travel easily thru water
*** TODO add wetness stat and soaking limit
*** TODO firewood supply stat
*** TODO firewood tiles
*** TODO add 4 campfire tiles (3 lit, 1 out)
*** TODO smother fire with dirt
*** TODO freezing death
*** TODO hungry/soaked/freezing display in status
Expand Down
7 changes: 7 additions & 0 deletions forest/forest.pak
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
(
(:name ".default-font" :type :font :properties (:height 14 :width 7) :data "7x14b")

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

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

(:name "earth-1" :type :image :file "earth-1.png")
(:name "earth-2" :type :image :file "earth-1.png")
(:name "earth-3" :type :image :file "earth-2.png")
Expand Down
102 changes: 91 additions & 11 deletions forest/player.lisp
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
(in-package :forest)

;;; Fire

(defparameter *fire-tiles* '("fire-1" "fire-2" "fire-3"))

(defcell fire
(tile :initform "fire-1")
(categories :initform '(:actor :light-source))
(light-radius :initform 16))

(define-method step fire (stepper)
(when [is-player stepper]
(when (plusp [stat-value stepper :freezing])
[say self "You dry yourself by the fire."]
[dry stepper])
(when (zerop [stat-value stepper :freezing])
[say self "You are dry now."])))

(define-method run fire ()
(setf <tile> (car (one-of *fire-tiles*))))

;;; Supplies

(defcell arrows
Expand All @@ -15,7 +35,7 @@
(defcell herb
(tile :initform "herb")
(description :initform "This healing herb will restore some of your health.")
(categories :initform '(:item))
(categories :initform '(:item :exclusive))
(equip-for :initform '(:right-hand :left-hand)))

(define-method step herb (stepper)
Expand All @@ -30,6 +50,16 @@
[stat-effect user :hit-points 12]
[say self "You consume the healing herb and quickly feel better."])))

(defcell firewood
(tile :initform (car (one-of '("firewood-1" "firewood-2"))))
(description :initform "Five pieces of firewood are enough to make a campfire."))

(define-method step firewood (stepper)
(when [is-player stepper]
[say self "You collect the firewood."]
[stat-effect stepper :firewood 1]
[delete-from-world self]))

;;; A map of the journey

(defcell sanctuary-map
Expand Down Expand Up @@ -87,10 +117,9 @@

(define-method step arrow (stepper)
(when [is-player stepper]
(assert [is-located self])
[say self "This arrow is still good. You add it to your quiver."]
[stat-effect stepper :arrows 1]
[die self]))
[delete-from-world self]))

(defcell wooden-bow
(name :initform "Wooden bow")
Expand All @@ -117,6 +146,16 @@

(defparameter *hunger-max* 1000)

(defparameter *hunger-damage-clock* 20)

(defparameter *freezing-warn* 80)

(defparameter *freezing-warn-2* 160)

(defparameter *freezing-max* 300)

(defparameter *freezing-damage-clock* 12)

(defcell player
(tile :initform "player")
(description :initform "You are an archer and initiate monk of the Sanctuary Order.")
Expand All @@ -125,8 +164,7 @@
(hit-points :initform (make-stat :base 30 :min 0 :max 30))
(hunger :initform (make-stat :base 0 :min 0 :max 1000))
(hunger-damage-clock :initform 0)
(wetness :initform (make-stat :base 0 :min 0 :max 10))
(freezing :initform (make-stat :base 0 :min 0 :max 1000))
(freezing :initform (make-stat :base 0 :min 0 :max 300))
(freezing-damage-clock :initform 0)
(hearing-range :initform 1000)
(firing-with :initform :left-hand)
Expand Down Expand Up @@ -181,8 +219,10 @@
(xe2:quit :shutdown))

(define-method run player ()
(message "FREEZING: ~A" [stat-value self :freezing])
[stat-effect self :hunger 1]
(let ((hunger [stat-value self :hunger]))
(let ((hunger [stat-value self :hunger])
(freezing [stat-value self :freezing]))
(when (= *hunger-warn* hunger)
[say self "You are getting hungry. Press Control-E to eat a ration."])
(when (= *hunger-warn-2* hunger)
Expand All @@ -193,12 +233,26 @@
(progn
[say self "You are starving! You will die if you do not eat soon."]
[say self "Press Control-E to eat a ration."]
(setf <hunger-damage-clock> 20)
(setf <hunger-damage-clock> *hunger-damage-clock*)
[damage self 1])
(decf <hunger-damage-clock>))))
(when (zerop [stat-value self :hit-points])
[die self])
(when (and *status* <inventory>) [update *status*]))
(decf <hunger-damage-clock>)))
(when (= *freezing-warn* freezing)
[say self "You are beginning to get soaked."])
(when (= *freezing-warn-2* freezing)
[say self "You are getting soaked! You will begin to freeze soon."])
(when (= *freezing-max* freezing)
(if (minusp <freezing-damage-clock>)
(progn
[say self "You are freezing! You will die if you do not dry out soon."]
[say self "Press Control-C to make a campfire."]
(setf <freezing-damage-clock> *freezing-damage-clock*)
[damage self 1])
(decf <freezing-damage-clock>)))
(when (< [stat-value self :hit-points] 10)
[narrateln :narrator "LOW HEALTH WARNING! You will die soon if you do not heal." :foreground ".red"])
(when (zerop [stat-value self :hit-points])
[die self])
(when (and *status* <inventory>) [update *status*])))

(define-method restart player ()
(let ((player (clone =player=)))
Expand Down Expand Up @@ -228,3 +282,29 @@
[equip self [add-item self (clone =wooden-bow=)]]
[add-item self (clone =sanctuary-map=)]
[emote self '((("I'd better get moving.")) (("The monastery is to the south.")))])

(define-method wet player ()
[stat-effect self :freezing 20])

(define-method dry player ()
[stat-effect self :freezing -300])

(define-method camp player ()
(clon:with-field-values (row column) self
(let (found)
(if (>= [stat-value self :firewood] 5)
(progn (block placing
(dolist (dir '(:north :south :east :west))
(multiple-value-bind (r c) (step-in-direction row column dir)
(unless [category-at-p *world* r c '(:obstacle :water)]
(setf found t)
[drop-cell *world* (clone =fire=) r c]
[stat-effect self :firewood -5]
[stat-effect self :hit-points 10]
(return-from placing)))))
(if found
[say self "With the Spark incantation, the fire is soon burning."]
[say self "Couldn't find a place to build a fire."]))
[say self "You don't have enough firewood."]))))


Binary file added forest/sanctuary-mac-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions forest/startup.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
("4" (:control) "drop-item 3 .")
;;
("P" (:control) "pause .")
("C" (:control) "camp .")
("E" (:control) "eat .")
("PAUSE" nil "pause .")
("ESCAPE" nil "restart .")
Expand Down Expand Up @@ -248,7 +249,9 @@
[print self (format nil " ARROWS: ~S " [stat-value char :arrows])]
[print self nil :image "arrows"]
[print self (format nil " RATIONS: ~S " [stat-value char :rations])]
[println self nil :image "ration"]
[print self nil :image "ration"]
[print self (format nil " FIREWOOD: ~S " [stat-value char :firewood])]
[println self nil :image "firewood-1"]
[newline self]
[print self " Inventory: "]
[print-inventory-slot self 0 :show-as 1]
Expand Down Expand Up @@ -301,7 +304,7 @@
(defparameter *room-window-width* 800)
(defparameter *room-window-height* 600)

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

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

0 comments on commit a869bb5

Please sign in to comment.