(defun display-crew (player-ship-obj) (let ((crew-names (loop for member in (crew-members (crew player-ship-obj)) collect (progn (if (buff member) (list (name member) (slot-value (buff member) 'buff-type) (slot-value (buff member) 'buff-value)) (list (name member) NIL NIL)))))) (format T "~%CREW DETAILS~%~%") (format-table T (list (list (sanity-val (crew player-ship-obj)) (moral-val (crew player-ship-obj)))) :column-label '("Sanity" "Moral")) (format T "~%") (format-table T crew-names :column-label '("Name" "Buff" "Buff Amount")))) (defun display-inventory (player-ship-obj) (let* ((inventory (inventory player-ship-obj)) (inventory-list (loop for slot in (return-slots inventory) collect (list slot (slot-value inventory slot))))) (format T "~%INVENTORY~%") (format-table T inventory-list :column-label '("Resource" "Amount")))) (defparameter *buff-types* (list 'weapons-expert 'shields-expert 'chef 'machine-enchanter 'warp-shaman 'holy-see)) (defun make-buff (buff-type) "Given a buff-type symbol, return an instance of 'crew-buff that corresponds with the buff-type" (case buff-type (holy-see (make-instance 'crew-buff :name "Holy See" ; Moral cannot go below val while the ; Holy See lives :buff-type buff-type :buff-value (+ 1 (random 50)))) (warp-shaman (make-instance 'crew-buff :name "Warp Shaman" ; % change to ignore low power warp shield :buff-type buff-type :buff-value (+ 0.1 (random 0.6)))) (machine-enchanter (make-instance 'crew-buff :name "Machine Enchanter" ; Val is % chance to not consume ; ammo when firing weapon :buff-type buff-type :buff-value (+ 0.1 (random 0.6)))) (chef (make-instance 'crew-buff :name "Chef" ; Reduce gruel consumption / action by val :buff-type buff-type :buff-value (+ 1 (random 20)))) (shields-expert (make-instance 'crew-buff :name "Shields Expert" ; Increases shield str by val :buff-type buff-type :buff-value (+ 1 (random 3)))) (weapons-expert (make-instance 'crew-buff :name "Weapons Expert" ; Increases all weapon damage by val :buff-type buff-type :buff-value (+ 1 (random 3)))))) (defun get-random-buff () "Return a random 'crew-buff object" (make-buff (nth (+ 1 (random (length *buff-types*))) *buff-types*))) ;; Crew name generators (defvar *name-prefixes* (list "Precepitor" "Auriga" "Basileus" "Pontiff" "Palatine" "Centurion" "Conjugator" "Principus" "Executor" "Commonus" "Gothicus" "Augusta" "Calligraphus" "Imperator" "Consul" "Signifier" "Tribune" "Praetorian" "Prefect")) (defvar *name-values* (list "Atticus" "Aurelia" "Cassius" "Maximus" "Aurelius" "Magnus" "Lucius" "Augustus" "Caeser" "Remus" "Julius" "Octavius" "Cato" "Tiberius" "Nero" "Romulus" "Septimus" "Cicero" "Cyprian" "Justus" "Quintus" "Decimus")) (defun make-crew-mem-name (name-prefixes name-values) "Expects a list of strings to use as prefixes for a name, and a list of possible names" (let ((name (nth (random (length name-values)) name-values)) (prefix (nth (random (length name-prefixes)) name-prefixes))) (concatenate 'string prefix " " name)))