Przeglądaj źródła

WIP, does not compile

Starting to frame out combat, and it's dependencies like crew systems/etc
Simon Watson 1 rok temu
rodzic
commit
4c344347ba
4 zmienionych plików z 74 dodań i 29 usunięć
  1. 5 0
      README.md
  2. 21 0
      combat.lisp
  3. 35 29
      game.lisp
  4. 13 0
      structs.lisp

+ 5 - 0
README.md

@@ -65,11 +65,16 @@ NOTE: This 'game' is just a playground for me to play with Lisp. It is not a ref
       - Spice increases moral but can be destabilizing to sanity
     - [ ] Implementation of crew member buff charateristics
     - [ ] Sanity/Moral (impacted by availability of spice and/or horrors of the warp)
+      - [ ] What happens when these get low?
+    - [ ] Crew members can die (you lose their buff, no other consequence)
+    - [ ] Recruit new crew members at trading stations (cost?)
 - Hazard/Boon/Sector System
   - TODO:
     - [ ] Encapsulate sector attrs
     - [ ] Encapsulate boon/hazard attrs
     - [ ] Interface for interacting with boons/hazards
+    - [ ] Basic system to jump to new sector
+    - [ ] What happens if you jump with a low power warp shield?
   - Notes:
     - Each sector contains a hazard and a boon
       - A hazard is a combat encounter or some kind of negative event

+ 21 - 0
combat.lisp

@@ -3,5 +3,26 @@
 (defvar *combat-menu-options-display* NIL)
 (defvar *combat-opt-lookup NIL)
 
+;; Combat options:
+;; Attack (with specific weapon)
+;; Regen shields
+;; - (add value to rep-shield-val at cost of overcharing
+;; - (overcharing can cause warp field to go into low-power)
+;; Overcharge gun at cost of overcharing reactor
+;; Attempt to flee into the warp
+;; - (requires full power / overcharged
+;; - (can also cause reactor to go low power, which removes ability to regen/overcharge)
+
 (defun combat-loop (sector)
   "The main loop responsbile for resolving combat situations")
+
+(defun calculate-damage (attacker-obj target-obj attacker-weapon)
+  "Calculate damage attacker will do given attacker stats, target stats,
+   and weapon stats"
+  (let ((target-defense-value (+ (rep-shield-val target-obi) (armor-val target-obj))))))
+
+(defun ship-attack (attacker-obj target-obj attacker-weapon)
+  "Given a ship thats attacking, a target, and the attackers chosen weapon
+   resolve the combat by calculating shield/hull damage and resolving resources."
+  (let ((calculated-damage- ; This value needs to resolve all buffs and debuffs
+	  NIL))))

+ 35 - 29
game.lisp

@@ -9,35 +9,41 @@
 (defvar *sector* NIL)
 	
 (defun init-game-state ()
-  (setq *sector* (make-instance 'sector :market (make-instance 'market)
-					:player-ship-obj
-					(make-instance 'ship
-						       :weapons (list (make-instance 'weapon
-										     :name "Plamsa"
-										     :shield-dmg 3
-										     :hull-dmg 3
-										     :ammo-cost 5)
-								      (make-instance 'weapon
-										     :name "Mega Bolter"
-										     :shield-dmg 1
-										     :hull-dmg 2
-										     :ammo-cost 1)
-								      (make-instance 'weapon
-										     :name "Beam"
-										     :shield-dmg 1
-										     :hull-dmg 3
-										     :ammo-cost 3))
-						       :crew (make-instance 'crew
-									    :sanity-val 100
-									    :moral-val 100
-									    :crew-members (loop for x in '(1 2 3 4)
-												collect (make-instance 'uniq-crew-mem :name (make-crew-mem-name *name-prefixes* *name-values*))))
-						       :inventory (make-instance 'player-inventory
-										 :petrofuel 20
-										 :gruel 20
-										 :spice 0
-										 :ammo 20
-										 :archeotech 0)))))
+  (setq *sector*
+	(make-instance 'sector
+		       :market (make-instance 'market)
+		       :player-ship-obj
+		       (make-instance 'ship
+				      :weapons (list (make-instance 'weapon
+								    :name "Plamsa"
+								    :shield-dmg 3
+								    :hull-dmg 3
+								    :ammo-cost 5)
+						     (make-instance 'weapon
+								    :name "Mega Bolter"
+								    :shield-dmg 1
+								    :hull-dmg 2
+								    :ammo-cost 1)
+						     (make-instance 'weapon
+								    :name "Beam"
+								    :shield-dmg 1
+								    :hull-dmg 3
+								    :ammo-cost 3))
+				      :crew (make-instance 'crew
+							   :sanity-val 100
+							   :moral-val 100
+							   :crew-members
+							   (loop for x in '(1 2 3 4)
+								 collect (make-instance 'uniq-crew-mem :name (make-crew-mem-name *name-prefixes* *name-values*)
+												       :buff (lambda ()
+															     
+															     )))
+							   :inventory (make-instance 'player-inventory
+										     :petrofuel 20
+										     :gruel 20
+										     :spice 0
+										     :ammo 20
+										     :archeotech 0)))))
 
 
 (defun new-game ()

+ 13 - 0
structs.lisp

@@ -106,6 +106,19 @@
     :accessor buff
     :initform NIL)))
 
+(defclass crew-buff ()
+  ((name
+    :initarg :name
+    :accessor name)
+   (buff-type
+    :initarg :buff-type
+    :accessor buff-type
+    :initform NIL)
+   (buff-value
+    :initarg :buff-value
+    :accessor buff-value
+    :initform NIL)))
+
 ;; Crew name generators
 (defvar *name-prefixes*
   (list "Precepitor"