diff options
| -rw-r--r-- | src/votann/event_handler.clj | 4 | ||||
| -rw-r--r-- | src/votann_battle_simulator/battle_round.clj | 10 |
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)] |