Kaynağa Gözat

Barebones Combat Commit #2

The last commit was a lie, there is _not_ yet a barebones combat
system because there is still no enemy AI. This is a nothing commit,
but pushing up so I can change computers :D
Simon Watson 1 yıl önce
ebeveyn
işleme
7cee6c8ca1
1 değiştirilmiş dosya ile 17 ekleme ve 2 silme
  1. 17 2
      combat.lisp

+ 17 - 2
combat.lisp

@@ -19,6 +19,7 @@ Actions:
 ;; - (requires full power / overcharged reactor)
 ;; - (can also cause reactor to go low power, which removes ability to regen/overcharge)
 
+;; TODO - Combat always pops off first enemy from the enemy-ships list
 (defun combat-loop (sector)
   "The main loop responsbile for resolving combat situations"
   (let ((combat-state T))
@@ -39,7 +40,19 @@ Actions:
 			  (progn
 			    (setf (enemy-ships sector) (delete attack-result (enemy-ships sector)))
 			    (format T "Your opponent has been vanquished!~%")
-			    (top-level-game-menu))))))))))))
+			    (top-level-game-menu))))
+		    (enemy-turn sector)))))))))
+
+(defun enemy-turn (sector)
+  "Perform AI actions based on AI-type associated with enemy ship"
+  (case (ai-type (first (enemy-ships sector)))
+    (aggressive (progn
+		  ;; This AI will just stupidly attack until it's out of ammo
+		  ;; If it runs out of ammo, it will try and flee
+		  
+		  ))
+    (fearful ())
+    (unpredicatable ())))
 		
 
 ;; Select weapon
@@ -97,9 +110,11 @@ Actions:
   (let ((calculated-shield-damage (calculate-shield-damage player-ship-obj target-obj attacker-weapon))
 	(calculated-hull-damage (calculate-hull-damage player-ship-obj target-obj attacker-weapon)))
     (setf (rep-shield-val target-obj) calculated-shield-damage) ;; Resolve shield hit
-    (format T "You hit their repulsor shields for ~A !~%" (shield-dmg attacker-weapon))
+    (if (> (rep-shield-val target-obj) 0)
+	(format T "You hit their repulsor shields for ~A !~%" (shield-dmg attacker-weapon)))
     (if (= 0 calculated-shield-damage)
 	(progn
+	  (format T "Their shields are down!~%")
 	  (setf (armor-val target-obj) calculated-hull-damage)
 	  (format T "You hit their hull for ~A !~%" (hull-dmg attacker-weapon))))
     (if (= 0 calculated-hull-damage)