ae09c71d52e8

Fix ruin gen, add some flavor
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sun, 08 Jan 2017 12:25:16 +0000
parents 7e4af1a01d82
children 948b58e1569a
branches/tags (none)
files src/entities/ruin.lisp src/main.lisp

Changes

diff -r 7e4af1a01d82 -r ae09c71d52e8 src/entities/ruin.lisp
--- a/src/entities/ruin.lisp	Sun Jan 08 12:14:55 2017 +0000
+++ b/src/entities/ruin.lisp	Sun Jan 08 12:25:16 2017 +0000
@@ -3,6 +3,40 @@
 (defparameter *venues*
   (read-file-into-form "data/venues.lisp"))
 
+(defparameter *graffiti*
+  #("give up"
+    "why me?"
+    "tom <3 alice"
+    "dave was here"
+    "420"
+    "goodbye"
+    "5823"
+    "jesus saves"
+    "your next"
+    "hail satan"
+    "run"
+    "head north"
+    "head south"
+    "were damned"
+    "hope is lost"
+    "turn back"))
+
+(defparameter *ruin-flavor*
+  #("Maybe there's something useful left."
+    "You're surprised it's still standing."
+    "Maybe it's worth taking a look."
+    "Perhaps you should scavenge?"
+    "You have a bad feeling about it."
+    "It brings back fond memories."
+    "The walls are crumbling."
+    "Sickly-looking leaves cover its walls."
+    "It looks like someone has been here recently."
+    "The walls are charred from a fire."
+    "A small animal scurries into a hold under the wall."
+    "Your parents used to live near one of these."
+    "The world has suddenly gotten quiet."
+    "A remnant of a happier time."))
+
 (define-entity ruin (coords trigger))
 
 (defun random-ruin-text ()
@@ -10,27 +44,8 @@
           (random-elt *venues*)
           (if (randomp ap::*graffiti-chance*)
             (format nil "Someone has graffitied \"~A\" on the wall."
-                    (string-upcase (random-elt #("give up"
-                                                 "why me?"
-                                                 "tom <3 alice"
-                                                 "dave was here"
-                                                 "420"
-                                                 "goodbye"
-                                                 "5823"
-                                                 "jesus saves"
-                                                 "hail satan"
-                                                 "run"
-                                                 "head north"
-                                                 "head south"
-                                                 "were damned"
-                                                 "hope is lost"
-                                                 "turn back"))))
-            (random-elt #("Maybe there's something useful left."
-                          "Perhaps you should scavenge?"
-                          "It brings back fond memories."
-                          "Your parents used to live near one of these."
-                          "The world has suddenly gotten quiet."
-                          "A remnant of a happier time.")))))
+                    (string-upcase (random-elt *graffiti*)))
+            (random-elt *ruin-flavor*))))
 
 (defun make-ruin (x y)
   (create-entity 'ruin
diff -r 7e4af1a01d82 -r ae09c71d52e8 src/main.lisp
--- a/src/main.lisp	Sun Jan 08 12:14:55 2017 +0000
+++ b/src/main.lisp	Sun Jan 08 12:25:16 2017 +0000
@@ -92,7 +92,7 @@
 (defun decay-ruin (width height start-x start-y condition)
   (iterate (for-nested ((x :from start-x :to (+ start-x width))
                         (y :from start-y :below (+ start-y height))))
-           (when (or (randomp condition)
+           (when (or (randomp (- 1.0 condition))
                      (and (deepwaterp (aref *terrain* x y))
                           (not (eq :wall (aref *structures* x y)))))
              (setf (aref *structures* x y) nil))))
@@ -123,7 +123,7 @@
         (y (clamp 0 (- *map-size* 50) (random-coord)))
         (width (max 5 (truncate (random-gaussian *ruin-size-mean* *ruin-size-dev*))))
         (height (max 5 (truncate (random-gaussian *ruin-size-mean* *ruin-size-dev*))))
-        (condition (random-range 0.1 1.0)))
+        (condition (random-range 0.2 1.0)))
     (add-intact-ruin width height x y)
     (add-ruin-door width height x y)
     (decay-ruin width height x y condition)