crew.lisp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. (defun display-crew (player-ship-obj)
  2. (let ((crew-names
  3. (loop for member in (crew-members (crew player-ship-obj))
  4. collect (progn
  5. (if (buff member)
  6. (list (name member) (slot-value (buff member) 'buff-type) (slot-value (buff member) 'buff-value))
  7. (list (name member) NIL NIL))))))
  8. (format T "~%CREW DETAILS~%~%")
  9. (format-table T
  10. (list
  11. (list
  12. (sanity-val (crew player-ship-obj))
  13. (moral-val (crew player-ship-obj)))) :column-label '("Sanity" "Moral"))
  14. (format T "~%")
  15. (format-table T crew-names :column-label '("Name" "Buff" "Buff Amount"))))
  16. (defun display-inventory (player-ship-obj)
  17. (let* ((inventory (inventory player-ship-obj))
  18. (inventory-list (loop for slot in (return-slots inventory)
  19. collect (list
  20. slot (slot-value inventory slot)))))
  21. (format T "~%INVENTORY~%")
  22. (format-table T inventory-list :column-label '("Resource" "Amount"))))
  23. (defparameter *buff-types*
  24. (list 'weapons-expert
  25. 'shields-expert
  26. 'chef
  27. 'machine-enchanter
  28. 'warp-shaman
  29. 'holy-see))
  30. (defun make-buff (buff-type)
  31. "Given a buff-type symbol, return an instance of 'crew-buff
  32. that corresponds with the buff-type"
  33. (case buff-type
  34. (holy-see
  35. (make-instance 'crew-buff
  36. :name "Holy See" ; Moral cannot go below val while the
  37. ; Holy See lives
  38. :buff-type buff-type
  39. :buff-value (+ 1 (random 50))))
  40. (warp-shaman
  41. (make-instance 'crew-buff
  42. :name "Warp Shaman" ; % change to ignore low power warp shield
  43. :buff-type buff-type
  44. :buff-value (+ 0.1 (random 0.6))))
  45. (machine-enchanter
  46. (make-instance 'crew-buff
  47. :name "Machine Enchanter" ; Val is % chance to not consume
  48. ; ammo when firing weapon
  49. :buff-type buff-type
  50. :buff-value (+ 0.1 (random 0.6))))
  51. (chef
  52. (make-instance 'crew-buff
  53. :name "Chef" ; Reduce gruel consumption / action by val
  54. :buff-type buff-type
  55. :buff-value (+ 1 (random 20))))
  56. (shields-expert
  57. (make-instance 'crew-buff
  58. :name "Shields Expert" ; Increases shield str by val
  59. :buff-type buff-type
  60. :buff-value (+ 1 (random 3))))
  61. (weapons-expert
  62. (make-instance 'crew-buff
  63. :name "Weapons Expert" ; Increases all weapon damage by val
  64. :buff-type buff-type
  65. :buff-value (+ 1 (random 3))))))
  66. (defun get-random-buff ()
  67. "Return a random 'crew-buff object"
  68. (make-buff (nth (+ 1 (random (length *buff-types*))) *buff-types*)))
  69. ;; Crew name generators
  70. (defvar *name-prefixes*
  71. (list "Precepitor"
  72. "Auriga"
  73. "Basileus"
  74. "Pontiff"
  75. "Palatine"
  76. "Centurion"
  77. "Conjugator"
  78. "Principus"
  79. "Executor"
  80. "Commonus"
  81. "Gothicus"
  82. "Augusta"
  83. "Calligraphus"
  84. "Imperator"
  85. "Consul"
  86. "Signifier"
  87. "Tribune"
  88. "Praetorian"
  89. "Prefect"))
  90. (defvar *name-values*
  91. (list "Atticus"
  92. "Aurelia"
  93. "Cassius"
  94. "Maximus"
  95. "Aurelius"
  96. "Magnus"
  97. "Lucius"
  98. "Augustus"
  99. "Caeser"
  100. "Remus"
  101. "Julius"
  102. "Octavius"
  103. "Cato"
  104. "Tiberius"
  105. "Nero"
  106. "Romulus"
  107. "Septimus"
  108. "Cicero"
  109. "Cyprian"
  110. "Justus"
  111. "Quintus"
  112. "Decimus"))
  113. (defun make-crew-mem-name (name-prefixes name-values)
  114. "Expects a list of strings to use as prefixes for a name, and a list
  115. of possible names"
  116. (let ((name (nth (random (length name-values)) name-values))
  117. (prefix (nth (random (length name-prefixes)) name-prefixes)))
  118. (concatenate 'string prefix " " name)))