|
@@ -19,6 +19,7 @@ Actions:
|
|
;; - (requires full power / overcharged reactor)
|
|
;; - (requires full power / overcharged reactor)
|
|
;; - (can also cause reactor to go low power, which removes ability to regen/overcharge)
|
|
;; - (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)
|
|
(defun combat-loop (sector)
|
|
"The main loop responsbile for resolving combat situations"
|
|
"The main loop responsbile for resolving combat situations"
|
|
(let ((combat-state T))
|
|
(let ((combat-state T))
|
|
@@ -39,7 +40,19 @@ Actions:
|
|
(progn
|
|
(progn
|
|
(setf (enemy-ships sector) (delete attack-result (enemy-ships sector)))
|
|
(setf (enemy-ships sector) (delete attack-result (enemy-ships sector)))
|
|
(format T "Your opponent has been vanquished!~%")
|
|
(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
|
|
;; Select weapon
|
|
@@ -97,9 +110,11 @@ Actions:
|
|
(let ((calculated-shield-damage (calculate-shield-damage player-ship-obj target-obj attacker-weapon))
|
|
(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)))
|
|
(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
|
|
(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)
|
|
(if (= 0 calculated-shield-damage)
|
|
(progn
|
|
(progn
|
|
|
|
+ (format T "Their shields are down!~%")
|
|
(setf (armor-val target-obj) calculated-hull-damage)
|
|
(setf (armor-val target-obj) calculated-hull-damage)
|
|
(format T "You hit their hull for ~A !~%" (hull-dmg attacker-weapon))))
|
|
(format T "You hit their hull for ~A !~%" (hull-dmg attacker-weapon))))
|
|
(if (= 0 calculated-hull-damage)
|
|
(if (= 0 calculated-hull-damage)
|