structs.lisp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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. (defgeneric return-slots (obj))
  70. (defmethod return-slots ((market market))
  71. (map 'list #'closer-mop:slot-definition-name (closer-mop:class-slots (class-of market))))
  72. ;;; Unique crew member that can provide an abstract buff
  73. ;;; or nerf to some internal game system
  74. (defclass uniq-crew-mem ()
  75. ((name
  76. :initarg :name
  77. :accessor name)
  78. (buff
  79. :initarg :buff
  80. :accessor buff
  81. :initform NIL)))
  82. ;; Crew name generators
  83. (defvar *name-prefixes*
  84. (list "Precepitor"
  85. "Auriga"
  86. "Basileus"
  87. "Pontiff"
  88. "Palatine"
  89. "Centurion"
  90. "Conjugator"
  91. "Principus"
  92. "Executor"
  93. "Commonus"
  94. "Gothicus"
  95. "Augusta"
  96. "Calligraphus"
  97. "Imperator"
  98. "Consul"
  99. "Signifier"
  100. "Tribune"
  101. "Praetorian"
  102. "Prefect"))
  103. (defvar *name-values*
  104. (list "Atticus"
  105. "Aurelia"
  106. "Cassius"
  107. "Maximus"
  108. "Aurelius"
  109. "Magnus"
  110. "Lucius"
  111. "Augustus"
  112. "Caeser"
  113. "Remus"
  114. "Julius"
  115. "Octavius"
  116. "Cato"
  117. "Tiberius"
  118. "Nero"
  119. "Romulus"
  120. "Septimus"
  121. "Cicero"
  122. "Cyprian"
  123. "Justus"
  124. "Quintus"
  125. "Decimus"))
  126. (defun make-crew-mem-name (name-prefixes name-values)
  127. "Expects a list of strings to use as prefixes for a name, and a list
  128. of possible names"
  129. (let ((name (nth (random (length *name-values*)) *name-values*))
  130. (prefix (nth (random (length *name-prefixes*)) *name-prefixes*)))
  131. (concatenate 'string prefix " " name)))
  132. (defclass weapon ()
  133. ((name
  134. :initarg :name
  135. :accessor name)
  136. (shield-dmg
  137. :initarg :shield-dmg
  138. :accessor sheild-dmg)
  139. (hull-dmg
  140. :initarg :hull-dmg
  141. :accessor hull-dmg)
  142. (ammo-cost
  143. :initarg :ammo-cost
  144. :accessor ammo-cost)))
  145. (defclass market ()
  146. ((price-of-petrofuel
  147. :initarg :price-of-petrofuel
  148. :accessor price-of-petrofuel
  149. :initform 10)
  150. (price-of-gruel
  151. :initarg :gruel
  152. :accessor price-of-gruel
  153. :initform 5)
  154. (price-of-spice
  155. :initarg :spice
  156. :accessor price-of-spice
  157. :initform 100)
  158. (price-of-ammo
  159. :initarg :ammo
  160. :accessor price-of-ammo
  161. :initform 20)
  162. (price-of-archeotech
  163. :initarg :archeotech
  164. :accessor price-of-archeotech
  165. :initform 2000)))
  166. ;; This gets created when travelling to a
  167. ;; new sector
  168. (defclass sector ()
  169. ((market
  170. :initarg :market
  171. :accessor market)
  172. (hazards
  173. :initarg :hazards
  174. :accessor hazards
  175. :initform NIL)
  176. (boons
  177. :initarg :boons
  178. :accessor boons
  179. :initform NIL)))