Skip to content

Commit

Permalink
Merge pull request #373 from datdamnzotz/new_ablity_skill_rolls
Browse files Browse the repository at this point in the history
Add ability and attack/damage rolls
  • Loading branch information
datdamnzotz authored May 5, 2020
2 parents d6aa7de + 40c7233 commit f43a858
Show file tree
Hide file tree
Showing 5 changed files with 168 additions and 88 deletions.
57 changes: 35 additions & 22 deletions src/clj/orcpub/styles/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,8 @@
:margin-left "-60px"
:background-color "black"
:font-family "Open Sans, sans-serif"
:font-size "14px"
:font-weight "normal"
:color "#fff"
:text-align "center"
:padding "10px 10px"
Expand Down Expand Up @@ -856,9 +858,7 @@

(def app
(concat
[

[:.character-builder-header
[[:.character-builder-header
{:margin-bottom "19px"}]

[:.senses
Expand All @@ -878,12 +878,12 @@
{:margin "10px 0"}]

#_["input::-webkit-outer-spin-button"
"input::-webkit-inner-spin-button"
{:-webkit-appearance :none
:margin 0}]
"input::-webkit-inner-spin-button"
{:-webkit-appearance :none
:margin 0}]

#_["input[type=number]"
{:-moz-appearance :textfield}]
{:-moz-appearance :textfield}]

[:a :a:visited
{:color orange}]
Expand Down Expand Up @@ -938,8 +938,8 @@
{:border-bottom "1px solid rgba(255,255,255,0.5)"}]

#_[:.header-tab:hover
[(garden.selectors/& (garden.selectors/not :.disabled))
{:background-color orange}]]
[(garden.selectors/& (garden.selectors/not :.disabled))
{:background-color orange}]]

[:.app-header-bar
{:min-height (px 81)
Expand All @@ -948,7 +948,7 @@
:background-color "rgba(0, 0, 0, 0.25)"}]

#_[:.options-column
{:width "300px"}]
{:width "300px"}]

[:.builder-column
{:display :none
Expand Down Expand Up @@ -985,7 +985,7 @@
:border-bottom "5px solid rgba(72,72,72,0.37)"}
[:.builder-tab-text
{:opacity 0.2}]]

[:.selected-builder-tab
{:border-bottom-color "#f1a20f"}
[:.builder-tab-text
Expand Down Expand Up @@ -1038,7 +1038,7 @@

[:.remove-item-button
{:color button-color
:font-size "16px"
:font-size "16px"
:margin-left "5px"
:cursor :pointer}]

Expand Down Expand Up @@ -1087,6 +1087,19 @@
:cursor :pointer
:background-image "linear-gradient(to bottom, #f1a20f, #dbab50)"}]

[:.roll-button
{:color :white
:font-weight 600
:font-size "9px"
:border :none
:border-radius "2px"
:text-transform :uppercase
:padding "8px 8px"
:margin-right "2px"
:margin-left "2px"
:cursor :pointer
:background-image "linear-gradient(to bottom, #f1a20f, #dbab50)"}]

[:.form-button:hover
{:box-shadow "0 2px 6px 0 rgba(0, 0, 0, 0.5)"}]

Expand Down Expand Up @@ -1213,16 +1226,16 @@
{:stroke "#363636"}]

[:.input
{:background-color :transparent
:color :black
:border "1px solid #282828"
:border-radius "5px"
:margin-top "5px"
:display :block
:padding "10px"
:width "100%"
:box-sizing :border-box
:font-size "14px"}]
{:background-color :transparent
:color :black
:border "1px solid #282828"
:border-radius "5px"
:margin-top "5px"
:display :block
:padding "10px"
:width "100%"
:box-sizing :border-box
:font-size "14px"}]

[:.form-button
{:background-image "linear-gradient(to bottom, #33658A, #33658A)"}]
Expand Down
6 changes: 3 additions & 3 deletions src/cljc/orcpub/common.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
(str (if (pos? val) "+") val))

(defn mod-str [val]
(cond (pos? val) (str " + " val)
(neg? val) (str " - " (int (Math/abs val)))
:else ""))
(cond (pos? val) (str "+" val)
(neg? val) (str "-" (int (Math/abs val)))
:else (str "+" val)))

(defn map-vals [val-fn m]
(reduce-kv
Expand Down
17 changes: 17 additions & 0 deletions src/cljc/orcpub/dice.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,23 @@
:raw-mod raw-mod
:plus-minus plus-minus})))

(defn dice-roll-text-2 [dice-text]
(if-let [[_ num-str sides-str plus-minus-str mod-str :as match]
(re-matches dice-regex dice-text)]
(let [num (or (parse-int num-str) 1)
sides (or (parse-int sides-str))
plus-minus (if (= "-" plus-minus-str)
-1
1)
raw-mod (or (parse-int mod-str) 0)
mod (* raw-mod plus-minus)
rolls (roll-n num sides)
total (apply + mod rolls)]
;(prn (str "total:" total " roll:" rolls " plus-minus:" plus-minus-str " raw-mod:" raw-mod " dice-text:" dice-text))
(if (boolean (re-find #"(20)" (str rolls)))
(str " *** NATURAL 20 *** " rolls " " plus-minus-str " " raw-mod " = " total)
(str rolls " " plus-minus-str " " raw-mod " = " total)))))

(spec/def ::num pos-int?)
(spec/def ::sides pos-int?)
(spec/def ::drop-num pos-int?)
Expand Down
10 changes: 10 additions & 0 deletions src/cljs/orcpub/dnd/e5/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -1750,6 +1750,16 @@
:message message
:message-type :success)))

(reg-event-db
:show-message-2
; Display msg with out auto closing the msg.
(fn [db [_ message]]
(prn message)
(assoc db
:message-shown? true
:message message
:message-type :success)))

(reg-event-db
:show-warning-message
(fn [db [_ message ttl]]
Expand Down
Loading

0 comments on commit f43a858

Please sign in to comment.