Skip to content

Commit

Permalink
Add versatile roll button
Browse files Browse the repository at this point in the history
  • Loading branch information
datdamnzotz committed Nov 25, 2020
1 parent e28d037 commit 003fc85
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/clj/orcpub/styles/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1092,14 +1092,16 @@

[:.roll-button
{:color :white
:min-width "35px"
:min-width "68px"
:font-weight 600
:font-size "14px"
:border :none
:border-radius "2px"
:padding "6px 6px"
:margin-right "2px"
:margin-left "2px"
:margin-bottom "2px"
:margin-top "2px"
:cursor :pointer
:background-image "linear-gradient(to bottom, #f1a20f, #dbab50)"}]

Expand Down
13 changes: 10 additions & 3 deletions src/cljs/orcpub/dnd/e5/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2787,10 +2787,12 @@
(doall
(map
(fn [[weapon-key {:keys [equipped?]}]]
(let [{:keys [name description ranged? ::weapon/type ::weapon/damage-die-count ::weapon/damage-die] :as weapon} (all-weapons-map weapon-key)
(let [{:keys [name description ranged? ::weapon/type ::weapon/damage-die-count ::weapon/damage-die ::weapon/versatile] :as weapon} (all-weapons-map weapon-key)
proficient? (if has-weapon-prof (has-weapon-prof weapon))
expanded? (@expanded-details weapon-key)
damage-modifier (weapon-damage-modifier weapon)
versatile-damage-die-count (:orcpub.dnd.e5.weapons/damage-die-count versatile)
versatile-damage-die (:orcpub.dnd.e5.weapons/damage-die versatile)
droll (str damage-die-count "d" damage-die)]
(when (not= type :ammunition)
^{:key weapon-key}
Expand All @@ -2804,7 +2806,6 @@
[:div
(weapon-attack-description-short weapon)]
(when expanded?
(prn weapon)
(weapon-details weapon weapon-damage-modifier))]
[:td (roll-button
(str name " attack: ")
Expand All @@ -2814,7 +2815,13 @@
(str name " damage: ")
(str damage-die-count "d" damage-die (common/mod-str (weapon-damage-modifier weapon)))
:text (str damage-die-count "d" damage-die (common/mod-str (weapon-damage-modifier weapon)))
:style {:width "100%"})]
:style {:width "100%"})
(when versatile
(roll-button
(str name " versatile damage: ")
(str versatile-damage-die-count "d" versatile-damage-die (common/mod-str (weapon-damage-modifier weapon)))
:text (str "v " versatile-damage-die-count "d" versatile-damage-die (common/mod-str (weapon-damage-modifier weapon)))
:style {:width "100%"}))]
[:td.pointer
[:div.orange
#_(if (not mobile?)
Expand Down

0 comments on commit 003fc85

Please sign in to comment.