structs.lisp 3.8 KB

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