summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author0xNul <57599792+0xNul@users.noreply.github.com>2023-07-22 14:09:34 -0700
committer0xNul <57599792+0xNul@users.noreply.github.com>2023-07-22 14:09:34 -0700
commit9f88b58d1a290d8ab81c86c798690d22ef3b77e5 (patch)
treeff7311e74f9cd7b66a3b77b8a87f20778c6cd77c
parent6bcbcd4d60f2032c7aa2cda2f5d831bb99a11f67 (diff)
set correct combat-phase
-rw-r--r--src/votann/event_handler.clj4
-rw-r--r--src/votann_battle_simulator/battle_round.clj10
2 files changed, 9 insertions, 5 deletions
diff --git a/src/votann/event_handler.clj b/src/votann/event_handler.clj
index aefabe3..6a9a735 100644
--- a/src/votann/event_handler.clj
+++ b/src/votann/event_handler.clj
@@ -172,7 +172,7 @@
(cond (= "Ranged" (get-in @*state [:battle-simulator :weapon-type]))
(do
(swap! *state assoc-in [:battle-simulator :data]
- (combat-phase "shooting"
+ (combat-phase :ranged-weapons
(Integer/parseInt (get-in @*state [:battle-simulator :rolls]))
(util/get-model (get-in @*state [:battle-simulator :model]))
(Integer/parseInt (get-in @*state [:battle-simulator :target-count]))
@@ -184,7 +184,7 @@
(= "Melee" (get-in @*state [:battle-simulator :weapon-type]))
(do
(swap! *state assoc-in [:battle-simulator :data]
- (combat-phase "fight"
+ (combat-phase :melee-weapons
(Integer/parseInt (get-in @*state [:battle-simulator :rolls]))
(util/get-model (get-in @*state [:battle-simulator :model]))
(Integer/parseInt (get-in @*state [:battle-simulator :target-count]))
diff --git a/src/votann_battle_simulator/battle_round.clj b/src/votann_battle_simulator/battle_round.clj
index 4ac95ee..b351faa 100644
--- a/src/votann_battle_simulator/battle_round.clj
+++ b/src/votann_battle_simulator/battle_round.clj
@@ -46,13 +46,17 @@
(defn movement-phase [])
-(defn combat-phase [^String phase ^Integer unit-size ^Model model ^Integer target-size ^Model target battle-modifiers]
- (println (str "\n----------\nStarting " phase "-phase"))
+(defn combat-phase [phase ^Integer unit-size ^Model model ^Integer target-size ^Model target battle-modifiers]
+ (cond
+ (= phase :ranged-weapons)
+ (println (str "\n----------\nStarting shooting-phase"))
+ (= phase :melee-weapons)
+ (println (str "\n----------\nStarting fight-phase")))
(println (str (:name model) " x" unit-size " target " (:name target)
" W: " (:w target)
" T: " (:t target)
" SV: " (:sv target)))
- (for [weapon (:ranged-weapons model)]
+ (for [weapon (phase model)]
(do
(println (str "\nUsing weapon: " (:name weapon)))
(let [damage (resolve-damage unit-size weapon target-size target battle-modifiers)]