structs.lisp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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 player-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. ;; Crew name generators
  104. (defvar *name-prefixes*
  105. (list "Precepitor"
  106. "Auriga"
  107. "Basileus"
  108. "Pontiff"
  109. "Palatine"
  110. "Centurion"
  111. "Conjugator"
  112. "Principus"
  113. "Executor"
  114. "Commonus"
  115. "Gothicus"
  116. "Augusta"
  117. "Calligraphus"
  118. "Imperator"
  119. "Consul"
  120. "Signifier"
  121. "Tribune"
  122. "Praetorian"
  123. "Prefect"))
  124. (defvar *name-values*
  125. (list "Atticus"
  126. "Aurelia"
  127. "Cassius"
  128. "Maximus"
  129. "Aurelius"
  130. "Magnus"
  131. "Lucius"
  132. "Augustus"
  133. "Caeser"
  134. "Remus"
  135. "Julius"
  136. "Octavius"
  137. "Cato"
  138. "Tiberius"
  139. "Nero"
  140. "Romulus"
  141. "Septimus"
  142. "Cicero"
  143. "Cyprian"
  144. "Justus"
  145. "Quintus"
  146. "Decimus"))
  147. (defun make-crew-mem-name (name-prefixes name-values)
  148. "Expects a list of strings to use as prefixes for a name, and a list
  149. of possible names"
  150. (let ((name (nth (random (length name-values)) name-values))
  151. (prefix (nth (random (length name-prefixes)) name-prefixes)))
  152. (concatenate 'string prefix " " name)))
  153. (defclass weapon ()
  154. ((name
  155. :initarg :name
  156. :accessor name)
  157. (shield-dmg
  158. :initarg :shield-dmg
  159. :accessor sheild-dmg)
  160. (hull-dmg
  161. :initarg :hull-dmg
  162. :accessor hull-dmg)
  163. (ammo-cost
  164. :initarg :ammo-cost
  165. :accessor ammo-cost)))
  166. (defclass market ()
  167. ((price-of-petrofuel
  168. :initarg :petrofuel
  169. :accessor price-of-petrofuel
  170. :initform 10)
  171. (price-of-gruel
  172. :initarg :gruel
  173. :accessor price-of-gruel
  174. :initform 5)
  175. (price-of-spice
  176. :initarg :spice
  177. :accessor price-of-spice
  178. :initform 100)
  179. (price-of-ammo
  180. :initarg :ammo
  181. :accessor price-of-ammo
  182. :initform 20)
  183. (price-of-archeotech
  184. :initarg :archeotech
  185. :accessor price-of-archeotech
  186. :initform 2000)))