Skip to content

Commit ff1d876

Browse files
committed
Add roll button to HD
1 parent 463e3b9 commit ff1d876

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/cljs/orcpub/character_builder.cljs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,8 @@
12191219
[:th.p-5 "Base"]
12201220
[:th.p-5 "Con"]
12211221
[:th.p-5 "Misc"]
1222-
[:th.p-5 "Total"]])
1222+
[:th.p-5 "Total"]
1223+
[:th.p-5 ""]])
12231224

12241225
(defn hp-selection-name-level [selection]
12251226
(let [[_ class-kw _ level-kw _] (::entity/path selection)
@@ -1319,7 +1320,8 @@
13191320
[:td.p-5 first-class-hit-die]
13201321
[:td.p-5 con-bonus-str]
13211322
[:td.p-5 (common/bonus-str (+ misc-bonus cls-level-bonus))]
1322-
[:td.p-5 (+ (:hit-die first-class) level-bonus)]])
1323+
[:td.p-5 (+ (:hit-die first-class) level-bonus)]
1324+
[:td.p5]])
13231325
(doall
13241326
(map-indexed
13251327
(fn [j level-value]
@@ -1337,14 +1339,20 @@
13371339
:value (:value level-value)}]]
13381340
[:td.p-5 con-bonus-str]
13391341
[:td.p-5 (common/bonus-str (+ misc-bonus cls-level-bonus))]
1340-
[:td.p-5 (+ (:value level-value) level-bonus)]])
1342+
[:td.p-5 (+ (:value level-value) level-bonus)]
1343+
[:td.p-5 [:button.roll-button
1344+
{:on-click (fn [e]
1345+
(let [value (js/parseInt (dice/die-roll (-> levels cls :hit-die)))]
1346+
(dispatch [:set-level-hit-points built-template character level-value value])))}
1347+
"d" (-> levels cls :hit-die)]]])
13411348
level-values))
13421349
[:tr
13431350
[:td.p-5 "Total"]
13441351
[:td.p-5 total-base-hps]
13451352
[:td.p-5 (common/bonus-str total-con-bonus)]
13461353
[:td.p-5 (common/bonus-str total-misc-bonus)]
1347-
[:td.p-5 (+ total-base-hps total-con-bonus total-misc-bonus)]]]]]))
1354+
[:td.p-5 (+ total-base-hps total-con-bonus total-misc-bonus)]
1355+
[:td.p-5]]]]]))
13481356
classes))
13491357
(if (> (count classes) 1)
13501358
[:div.m-t-20
@@ -1357,7 +1365,8 @@
13571365
[:td.p-5 total-base-hps]
13581366
[:td.p-5 (common/bonus-str total-con-bonus)]
13591367
[:td.p-5 (common/bonus-str total-misc-bonus)]
1360-
[:td.p-5 total-hps]]]]])]))
1368+
[:td.p-5 total-hps]
1369+
[:td.p-5]]]]])]))
13611370

13621371
(defn remaining-adjustments-fn [built-template character]
13631372
#(Math/abs (entity/count-remaining built-template character %)))

0 commit comments

Comments
 (0)