crew.lisp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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-table T crew-names :column-label '("Name" "Buff" "Buff Amount"))))
  15. (defparameter *buff-types*
  16. (list 'weapons-expert
  17. 'shields-expert
  18. 'chef
  19. 'machine-enchanter
  20. 'warp-shaman
  21. 'holy-see))
  22. (defun make-buff (buff-type)
  23. "Given a buff-type symbol, return an instance of 'crew-buff
  24. that corresponds with the buff-type"
  25. (case buff-type
  26. (holy-see
  27. (make-instance 'crew-buff
  28. :name "Holy See" ; Moral cannot go below val while the
  29. ; Holy See lives
  30. :buff-type buff-type
  31. :buff-value (+ 1 (random 50))))
  32. (warp-shaman
  33. (make-instance 'crew-buff
  34. :name "Warp Shaman" ; % chance to ignore low power warp shield
  35. :buff-type buff-type
  36. :buff-value (+ 0.1 (random 0.6))))
  37. (machine-enchanter
  38. (make-instance 'crew-buff
  39. :name "Machine Enchanter" ; Val is % chance to not consume
  40. ; ammo when firing weapon
  41. :buff-type buff-type
  42. :buff-value (+ 0.1 (random 0.6))))
  43. (chef
  44. (make-instance 'crew-buff
  45. :name "Chef" ; Reduce gruel consumption / action by val
  46. :buff-type buff-type
  47. :buff-value (+ 1 (random 20))))
  48. (shields-expert
  49. (make-instance 'crew-buff
  50. :name "Shields Expert" ; Increases shield str by val
  51. :buff-type buff-type
  52. :buff-value (+ 1 (random 3))))
  53. (weapons-expert
  54. (make-instance 'crew-buff
  55. :name "Weapons Expert" ; Increases all weapon damage by val
  56. :buff-type buff-type
  57. :buff-value (+ 1 (random 3))))))
  58. (defun get-random-buff (buff-types)
  59. "Return a random 'crew-buff object"
  60. (make-buff (nth (+ 1 (random (length buff-types))) buff-types)))
  61. ;; Crew name generators
  62. (defvar *name-prefixes*
  63. (list "Precepitor"
  64. "Auriga"
  65. "Basileus"
  66. "Pontiff"
  67. "Palatine"
  68. "Centurion"
  69. "Conjugator"
  70. "Principus"
  71. "Executor"
  72. "Commonus"
  73. "Gothicus"
  74. "Augusta"
  75. "Calligraphus"
  76. "Imperator"
  77. "Consul"
  78. "Signifier"
  79. "Tribune"
  80. "Praetorian"
  81. "Prefect"))
  82. (defvar *name-values*
  83. (list "Atticus"
  84. "Aurelia"
  85. "Cassius"
  86. "Maximus"
  87. "Aurelius"
  88. "Magnus"
  89. "Lucius"
  90. "Augustus"
  91. "Caeser"
  92. "Remus"
  93. "Julius"
  94. "Octavius"
  95. "Cato"
  96. "Tiberius"
  97. "Nero"
  98. "Romulus"
  99. "Septimus"
  100. "Cicero"
  101. "Cyprian"
  102. "Justus"
  103. "Quintus"
  104. "Decimus"))