structs.lisp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. ;; This gets created when travelling to a
  2. ;; new sector
  3. (defclass sector ()
  4. ((market
  5. :initarg :market
  6. :accessor market)
  7. (hazards
  8. :initarg :hazards
  9. :accessor hazards
  10. :initform NIL)
  11. (boons
  12. :initarg :boons
  13. :accessor boons
  14. :initform NIL)
  15. (player-ship-obj
  16. :initarg :player-ship-obj
  17. :accessor player-ship-obj
  18. :initform NIL)
  19. (enemy-ships
  20. :initarg :enemy-ships
  21. :accessor enemy-ships
  22. :initform NIL)))
  23. (defclass ship ()
  24. ((armor-val
  25. :initarg :armor-val
  26. :accessor armor-val
  27. :initform 10)
  28. (rep-shield-val
  29. :initarg :rep-shield-val
  30. :accessor rep-shield-val
  31. :initform 10)
  32. (warp-drive-power ; 0 off, 1 on
  33. :initarg :warp-drive-power
  34. :accessor warp-drive-power
  35. :initform 1)
  36. (reactor-str ; 0 - low power, 1 - full power, 2 - overdrive
  37. :initarg :reactor-str
  38. :accessor reactor-str
  39. :initform 1)
  40. (warp-field ; 0 - low power, 1 - full power
  41. :initarg :warp-field
  42. :accessor warp-field
  43. :initform 1)
  44. (weapons
  45. :initarg :weapons
  46. :accessor weapons)
  47. (credits
  48. :initarg :credits
  49. :accessor credits
  50. :initform 1000)
  51. (crew
  52. :initarg :crew
  53. :accessor crew)
  54. (inventory
  55. :initarg :inventory
  56. :accessor inventory)))
  57. (defclass player-inventory ()
  58. ((petrofuel
  59. :initarg :petrofuel
  60. :accessor petrofuel
  61. :initform 20)
  62. (gruel
  63. :initarg :gruel
  64. :accessor gruel
  65. :initform 20)
  66. (spice
  67. :initarg :spice
  68. :accessor spice
  69. :initform 0)
  70. (ammo
  71. :initarg :ammo
  72. :accessor ammo
  73. :initform 20)
  74. (archeotech
  75. :initarg :archeotech
  76. :accessor archeotech
  77. :initform 0)))
  78. (defclass crew ()
  79. ((sanity-val ; Max 100
  80. :initarg :sanity-val
  81. :accessor sanity-val
  82. :initform 100)
  83. (moral-val
  84. :initarg :moral-val
  85. :accessor moral-val
  86. :initform 100)
  87. (crew-members
  88. :initarg :crew-members ; List of *uniq-crew-mem*
  89. :accessor crew-members)))
  90. ;; "Given an object, return the names of it's slots"
  91. (defun return-slots (obj)
  92. (map 'list #'closer-mop:slot-definition-name (closer-mop:class-slots (class-of obj))))
  93. ;;; Unique crew member that can provide an abstract buff
  94. ;;; or nerf to some internal game system
  95. (defclass uniq-crew-mem ()
  96. ((name
  97. :initarg :name
  98. :accessor name)
  99. (buff
  100. :initarg :buff
  101. :accessor buff
  102. :initform NIL)))
  103. (defclass crew-buff ()
  104. ((name
  105. :initarg :name
  106. :accessor name)
  107. (buff-type
  108. :initarg :buff-type
  109. :accessor buff-type
  110. :initform NIL)
  111. (buff-value
  112. :initarg :buff-value
  113. :accessor buff-value
  114. :initform NIL)))
  115. ;; Crew name generators
  116. (defvar *name-prefixes*
  117. (list "Precepitor"
  118. "Auriga"
  119. "Basileus"
  120. "Pontiff"
  121. "Palatine"
  122. "Centurion"
  123. "Conjugator"
  124. "Principus"
  125. "Executor"
  126. "Commonus"
  127. "Gothicus"
  128. "Augusta"
  129. "Calligraphus"
  130. "Imperator"
  131. "Consul"
  132. "Signifier"
  133. "Tribune"
  134. "Praetorian"
  135. "Prefect"))
  136. (defvar *name-values*
  137. (list "Atticus"
  138. "Aurelia"
  139. "Cassius"
  140. "Maximus"
  141. "Aurelius"
  142. "Magnus"
  143. "Lucius"
  144. "Augustus"
  145. "Caeser"
  146. "Remus"
  147. "Julius"
  148. "Octavius"
  149. "Cato"
  150. "Tiberius"
  151. "Nero"
  152. "Romulus"
  153. "Septimus"
  154. "Cicero"
  155. "Cyprian"
  156. "Justus"
  157. "Quintus"
  158. "Decimus"))
  159. (defun make-crew-mem-name (name-prefixes name-values)
  160. "Expects a list of strings to use as prefixes for a name, and a list
  161. of possible names"
  162. (let ((name (nth (random (length name-values)) name-values))
  163. (prefix (nth (random (length name-prefixes)) name-prefixes)))
  164. (concatenate 'string prefix " " name)))
  165. (defclass weapon ()
  166. ((name
  167. :initarg :name
  168. :accessor name)
  169. (shield-dmg
  170. :initarg :shield-dmg
  171. :accessor sheild-dmg)
  172. (hull-dmg
  173. :initarg :hull-dmg
  174. :accessor hull-dmg)
  175. (ammo-cost
  176. :initarg :ammo-cost
  177. :accessor ammo-cost)))
  178. (defclass market ()
  179. ((price-of-petrofuel
  180. :initarg :petrofuel
  181. :accessor price-of-petrofuel
  182. :initform 10)
  183. (price-of-gruel
  184. :initarg :gruel
  185. :accessor price-of-gruel
  186. :initform 5)
  187. (price-of-spice
  188. :initarg :spice
  189. :accessor price-of-spice
  190. :initform 100)
  191. (price-of-ammo
  192. :initarg :ammo
  193. :accessor price-of-ammo
  194. :initform 20)
  195. (price-of-archeotech
  196. :initarg :archeotech
  197. :accessor price-of-archeotech
  198. :initform 2000)))