;;;; ;;;; Naledi ya Africa ("Star of Africa") is a rogue-like survival game ;;;; set in Africa. ;;;; ;;;; Biomes are habitat types, that provide default functions for patches. ;;;; This file defines the biome struct and the inbuilt biomes. ;;;; ;;;; (c) 2018 Daniel Vedder, MIT license ;;;; ;; Biome struct and register (defstruct biome (name "") (ground "") (features '()) ;an alist of possible features and their 1/p probabilities (char #\.) ;default map display character (col ':white)) ;default map display colour (let ((biome-list NIL)) (defun register-biome (symbol-name biome-object) (setf biome-list (cons (list symbol-name biome-object) biome-list))) (defun available-biomes () (keys biome-list)) (defun get-biome (symbol-name) (cassoc symbol-name biome-list))) (defmacro new-biome (name &body body) `(register-biome ',name (make-biome :name ,(symbol-to-string name) ,@body))) ;; Biome definitions (new-biome grassland :ground "tall elephant grass" :char #\; :col ':yellow :features '((acacia 40) (boulder 150))) ;TODO (new-biome forest :ground "leaf litter and small shrubs" :char #\. :col ':green :features '((miombo 10) (acacia 15))) ;TODO (new-biome stream :ground "shallow flowing water" :char #\~ :col ':blue :features '()) ;TODO (new-biome swamp :ground "short sedge grass growing on boggy black soil" :char #\w :col ':green :features '()) ;TODO (new-biome hill :ground "hard, stony soil" :char #\m :col ':cyan ;XXX white might be better :features '((boulder 10) (miombo 80))) ;TODO (new-biome desert :ground "deep, drifting sand" :char #\~ :col ':white ;XXX yellow would be better, but shows up brown :features '((cactus 100) (bolder 200))) ;;TODO desert