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