Steve Losh avatar Steve Losh committed f57db9d

Entity names.

Comments (0)

Files changed (5)

src/caves/entities/aspects/attacker.clj

       (->> world
         (take-damage target damage)
         (send-message this "You strike the %s for %d damage!"
-                      [(:glyph target) damage])
+                      [(:name target) damage])
         (send-message target "The %s strikes you for %d damage!"
-                      [(:glyph target) damage]))))
+                      [(:name target) damage]))))
   (attack-value [this world]
     (get this :attack 1)))
 

src/caves/entities/bunny.clj

         [caves.world :only [find-empty-neighbor]]))
 
 
-(defrecord Bunny [id glyph color location hp max-hp])
+(defrecord Bunny [id glyph color location hp max-hp name])
 
 (defn make-bunny [location]
   (map->Bunny {:id (get-id)
+               :name "bunny"
                :glyph "v"
                :color :yellow
                :location location

src/caves/entities/lichen.clj

         [caves.world :only [find-empty-neighbor]]))
 
 
-(defrecord Lichen [id glyph color location hp max-hp])
+(defrecord Lichen [id glyph color location hp max-hp name])
 
 (defn make-lichen [location]
   (map->Lichen {:id (get-id)
+                :name "lichen"
                 :glyph "F"
                 :color :green
                 :location location

src/caves/entities/player.clj

         [caves.world :only [get-entity-at]]))
 
 
-(defrecord Player [id glyph color location hp max-hp attack])
+(defrecord Player [id glyph color location hp max-hp attack name])
 
 (extend-type Player Entity
   (tick [this world]
 
 (defn make-player [location]
   (map->Player {:id :player
+                :name "player"
                 :glyph "@"
                 :color :white
                 :location location

src/caves/entities/silverfish.clj

         [caves.coords :only [neighbors]]))
 
 
-(defrecord Silverfish [id glyph color location hp max-hp])
+(defrecord Silverfish [id glyph color location hp max-hp name])
 
 (defn make-silverfish [location]
   (map->Silverfish {:id (get-id)
+                    :name "silverfish"
                     :glyph "~"
                     :color :white
                     :location location
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.