;;;; ;;;; Terra Nostra is a Minecraft-like survival game for the commandline. ;;;; ;;;; This file defines animal and species structs and the various species ;;;; found in-game. ;;;; ;;;; (c) 2018 Daniel Vedder, MIT license ;;;; (defvar *animals* NIL) (let ((species-list NIL)) (defun register-species (symbol-name species-object) (setf species-list (cons (list symbol-name species-object) species-list))) (defun get-species (symbol-name) (cassoc symbol-name species-list))) (defmacro new-species (name &body body) `(register-species ,name (make-instance 'species ,@body))) (let ((max-id 0)) (defun add-animal (species position) "Create a new animal of the given species" (let ((a (make-animal :id max-id :pos position :species species :health (.max-health species)))) (incf max-id) (setf *animals* (append *animals* a))))) ;;; SPECIES DEFINITIONS ;;XXX Change to African species? ;;TODO bird species (new-species 'deer :name "deer" :strength 3 :max-health 10 :aggression 0 :group-size 10 :habitat '(forest grassland) :drops NIL) ;TODO (new-species 'boar :name "boar" :strength 7 :max-health 15 :aggression 5 :group-size 5 :habitat '(forest) :drops NIL) ;TODO (new-species 'wolf :name "wolf" :strength 10 :max-health 20 :aggression 20 :group-size 6 :habitat '(grassland) :drops NIL) ;TODO (new-species 'bear :name "bear" :strength 20 :max-health 30 :aggression 20 :group-size 1 :habitat '(forest) :drops NIL) ;TODO