;; This gets created when travelling to a
;; new sector
(defclass sector ()
((market
:initarg :market
:accessor market)
(hazards
:initarg :hazards
:accessor hazards
:initform NIL)
(boons
:initarg :boons
:accessor boons
:initform NIL)
(player-ship-obj
:initarg :player-ship-obj
:accessor player-ship-obj
:initform NIL)
(enemy-ships
:initarg :enemy-ships
:accessor enemy-ships
:initform NIL)))

(defclass player-ship ()
((armor-val
:initarg :armor-val
:accessor armor-val
:initform 10)
(rep-shield-val
:initarg :rep-shield-val
:accessor rep-shield-val
:initform 10)
(warp-drive-power ; 0 off, 1 on
:initarg :warp-drive-power
:accessor warp-drive-power
:initform 1)
(reactor-str ; 0 - low power, 1 - full power, 2 - overdrive
:initarg :reactor-str
:accessor reactor-str
:initform 1)
(warp-field ; 0 - low power, 1 - full power
:initarg :warp-field
:accessor warp-field
:initform 1)
(weapons
:initarg :weapons
:accessor weapons)
(credits
:initarg :credits
:accessor credits
:initform 1000)
(crew
:initarg :crew
:accessor crew)
(inventory
:initarg :inventory
:accessor inventory)))

(defclass player-inventory ()
((petrofuel
:initarg :petrofuel
:accessor petrofuel
:initform 20)
(gruel
:initarg :gruel
:accessor gruel
:initform 20)
(spice
:initarg :spice
:accessor spice
:initform 0)
(ammo
:initarg :ammo
:accessor ammo
:initform 20)
(archeotech
:initarg :archeotech
:accessor archeotech
:initform 0)))

(defclass crew ()
((sanity-val ; Max 100
:initarg :sanity-val
:accessor sanity-val
:initform 100)
(moral-val
:initarg :moral-val
:accessor moral-val
:initform 100)
(crew-members
:initarg :crew-members ; List of *uniq-crew-mem*
:accessor crew-members)))

;; "Given an object, return the names of it's slots"
(defun return-slots (obj)
(map 'list #'closer-mop:slot-definition-name (closer-mop:class-slots (class-of obj))))

;;; Unique crew member that can provide an abstract buff
;;; or nerf to some internal game system
(defclass uniq-crew-mem ()
((name
:initarg :name
:accessor name)
(buff
:initarg :buff
:accessor buff
:initform NIL)))

;; Crew name generators
(defvar *name-prefixes*
(list "Precepitor"
"Auriga"
"Basileus"
"Pontiff"
"Palatine"
"Centurion"
"Conjugator"
"Principus"
"Executor"
"Commonus"
"Gothicus"
"Augusta"
"Calligraphus"
"Imperator"
"Consul"
"Signifier"
"Tribune"
"Praetorian"
"Prefect"))

(defvar *name-values*
(list "Atticus"
"Aurelia"
"Cassius"
"Maximus"
"Aurelius"
"Magnus"
"Lucius"
"Augustus"
"Caeser"
"Remus"
"Julius"
"Octavius"
"Cato"
"Tiberius"
"Nero"
"Romulus"
"Septimus"
"Cicero"
"Cyprian"
"Justus"
"Quintus"
"Decimus"))

(defun make-crew-mem-name (name-prefixes name-values)
"Expects a list of strings to use as prefixes for a name, and a list
of possible names"
(let ((name (nth (random (length name-values)) name-values))
(prefix (nth (random (length name-prefixes)) name-prefixes)))
(concatenate 'string prefix " " name)))

(defclass weapon ()
((name
:initarg :name
:accessor name)
(shield-dmg
:initarg :shield-dmg
:accessor sheild-dmg)
(hull-dmg
:initarg :hull-dmg
:accessor hull-dmg)
(ammo-cost
:initarg :ammo-cost
:accessor ammo-cost)))

(defclass market ()
((price-of-petrofuel
:initarg :petrofuel
:accessor price-of-petrofuel
:initform 10)
(price-of-gruel
:initarg :gruel
:accessor price-of-gruel
:initform 5)
(price-of-spice
:initarg :spice
:accessor price-of-spice
:initform 100)
(price-of-ammo
:initarg :ammo
:accessor price-of-ammo
:initform 20)
(price-of-archeotech
:initarg :archeotech
:accessor price-of-archeotech
:initform 2000)))