Skip to content
Merged
12 changes: 8 additions & 4 deletions src/cljc/orcpub/common.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
(defn map-by-id [values]
(map-by :db/id values))

(defmacro ptime [message body]
;; dead — zero callers
#_(defmacro ptime [message body]
`(do (prn ~message)
(time ~body)))

Expand Down Expand Up @@ -149,14 +150,17 @@

(def rounds-per-minute 10)
(def minutes-per-hour 60)
(def hours-per-day 24)
;; dead — redefined in views.cljs, never used from common
#_(def hours-per-day 24)

(def rounds-per-hour (* minutes-per-hour rounds-per-minute))

(defn rounds-to-hours [rounds]
;; dead — zero callers
#_(defn rounds-to-hours [rounds]
(int (/ rounds rounds-per-hour)))

(defn rounds-to-minutes [rounds]
;; dead — zero callers
#_(defn rounds-to-minutes [rounds]
(int (/ (rem rounds rounds-per-hour) rounds-per-minute)))

(def filter-true-xform
Expand Down
18 changes: 12 additions & 6 deletions src/cljc/orcpub/dnd/e5/character.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@
%))
raw-character))

(defn add-equipment-namespaces [raw-character]
;; dead — only caller was add-namespaces
#_(defn add-equipment-namespaces [raw-character]
(-> (reduce
add-equipment-namespace
raw-character
Expand All @@ -145,7 +146,8 @@
::wis (or n-wis wis)
::cha (or n-cha cha)})))

(defn add-namespaces-to-values [raw-character]
;; dead — only caller was add-namespaces
#_(defn add-namespaces-to-values [raw-character]
(if (seq (::entity/values raw-character))
(update raw-character
::entity/values
Expand All @@ -155,7 +157,8 @@
values)))
raw-character))

(defn add-namespaces [raw-character]
;; dead — zero live callers (cascade: add-equipment-namespaces, add-namespaces-to-values)
#_(defn add-namespaces [raw-character]
(-> raw-character
add-equipment-namespaces
add-ability-namespaces
Expand Down Expand Up @@ -396,7 +399,8 @@
(defn base-flying-speed [built-char]
(get-prop built-char :flying-speed))

(defn base-climbing-speed [built-char]
;; dead — zero callers
#_(defn base-climbing-speed [built-char]
(get-prop built-char :climbing-speed))

(defn land-speed-with-armor [built-char]
Expand Down Expand Up @@ -598,7 +602,8 @@
(defn save-bonuses [built-char]
(get-prop built-char :save-bonuses))

(defn saving-throw-advantages [built-char]
;; dead — zero callers
#_(defn saving-throw-advantages [built-char]
(get-prop built-char :saving-throw-advantage))

(defn best-weapon-attack-modifier-fn [built-char]
Expand Down Expand Up @@ -733,7 +738,8 @@
(defn dual-wield-weapon-fn [built-char]
(get-prop built-char :dual-wield-weapon?))

(defn max-armor-class [unarmored-armor-class
;; dead — zero callers
#_(defn max-armor-class [unarmored-armor-class
ac-with-armor-fn
all-armor-inventory
equipped-armor
Expand Down
14 changes: 9 additions & 5 deletions src/cljc/orcpub/dnd/e5/classes.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -371,15 +371,17 @@
:page 55
:summary "make a weapon attack when you use your action to cast a bard spell"})]}}}]}))

(defn blessings-of-knowledge-skill [skill-name]
;; dead — only called from #_ discarded block
#_(defn blessings-of-knowledge-skill [skill-name]
(let [skill-kw (common/name-to-kw skill-name)]
(t/option-cfg
{:name skill-name
:key skill-kw
:modifiers [(mod5e/skill-proficiency skill-kw)
(mod5e/skill-expertise skill-kw)]})))

(def spell-level-to-cleric-level
;; dead — zero callers
#_(def spell-level-to-cleric-level
{1 1
2 3
3 5
Expand Down Expand Up @@ -1466,7 +1468,7 @@
10 {:modifiers [(mod5e/dependent-trait
{:name "Aura of Courage"
:page 85
:summary (str (str "you and friendly creatures within " ?paladin-aura " ft. can't be frightened"))})]}
:summary (str "you and friendly creatures within " ?paladin-aura " ft. can't be frightened")})]}
14 {:modifiers [(mod5e/action
{:name "Cleansing Touch"
:page 85
Expand Down Expand Up @@ -2324,7 +2326,8 @@
:page page
:description (str "time and money to copy an " school " spell is halved")})

(defn spell-in-spells-known? [known level spell-key]
;; dead — only called from #_ discarded block
#_(defn spell-in-spells-known? [known level spell-key]
(and known (some #(= spell-key (:key %)) (known level))))

(defn spell-mastery-selection [level]
Expand Down Expand Up @@ -2613,7 +2616,8 @@
(t/option-cfg
{:name (or (:name weapon) (::weapon5e/name weapon))})))))

(defn pact-weapon-option [title weapons]
;; dead — zero callers
#_(defn pact-weapon-option [title weapons]
(t/option-cfg
{:name title
:selections [(t/selection-cfg
Expand Down
82 changes: 48 additions & 34 deletions src/cljc/orcpub/dnd/e5/options.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@

(def xps [0 300 900 2700 6500 14000 23000 34000 48000 64000 85000 100000 120000 140000 165000 195000 225000 265000 305000 355000])

(def levels
;; unreferenced — xps is used directly elsewhere
#_(def levels
(map-indexed
(fn [i xp] {:level (inc i) :min-xp xp})
xps))
Expand Down Expand Up @@ -392,7 +393,8 @@
"You already have this language"
(fn [c] (not (get @(subscribe [::character/languages nil c]) key))))]}))

(defn key-to-name [key]
;; unreferenced — common/name-to-kw is used instead
#_(defn key-to-name [key]
(s/join " " (map s/capitalize (s/split (name key) #"-"))))

(defn spell-field [name value]
Expand Down Expand Up @@ -816,7 +818,8 @@
(map language-map (keys lang-options)))]
(language-selection-aux languages lang-num)))

(defn any-language-selection [language-map & [num]]
;; unreferenced — language-selection and homebrew-language-selection used instead
#_(defn any-language-selection [language-map & [num]]
(language-selection-aux (vals language-map) num))

#_(defn maneuver-option [name & [desc]]
Expand Down Expand Up @@ -865,7 +868,8 @@
(not= k source))
(?tool-profs tool-kw))])])

(defn skill-or-expertise-selection [num skill-kws option-source]
;; dead — only called from deprecated ua_race_feats.cljc
#_(defn skill-or-expertise-selection [num skill-kws option-source]
(t/selection-cfg
{:name "Skill Proficiency"
:order 0
Expand Down Expand Up @@ -1061,9 +1065,11 @@
(mods/set-mod ?feats kw))
(not multiselect?) (update :prereqs conj (does-not-have-feat-prereq kw))))))

(def charge-summary "when you Dash, you can make 1 melee attack or shove as a bonus action; if you move 10 ft. before taking this bonus action you gain +5 damage to attack or shove 10 ft.")
;; dead — zero callers
#_(def charge-summary "when you Dash, you can make 1 melee attack or shove as a bonus action; if you move 10 ft. before taking this bonus action you gain +5 damage to attack or shove 10 ft.")

(def defensive-duelist-summary "when you are hit with a melee attack, you can add your prof bonus to AC for the attack if you are wielding a finesse weapon you are proficient with")
;; dead — zero callers
#_(def defensive-duelist-summary "when you are hit with a melee attack, you can add your prof bonus to AC for the attack if you are wielding a finesse weapon you are proficient with")

#_(defn homebrew-spell-selection [spell-lists spells-map]
(spell-selection
Expand Down Expand Up @@ -1146,14 +1152,14 @@
[(let [main-hand-weapon ?orcpub.dnd.e5.character/main-hand-weapon
off-hand-weapon ?orcpub.dnd.e5.character/off-hand-weapon
all-weapons-map @(subscribe [::mi/all-weapons-map])]
(and (and main-hand-weapon
(-> all-weapons-map
main-hand-weapon
::weapons/melee?))
(and off-hand-weapon
(-> all-weapons-map
off-hand-weapon
::weapons/melee?))))]))
(and main-hand-weapon
(-> all-weapons-map
main-hand-weapon
::weapons/melee?)
off-hand-weapon
(-> all-weapons-map
off-hand-weapon
::weapons/melee?)))]))

(def dual-wield-weapon-mod
(mods/modifier ?dual-wield-weapon? weapons/one-handed-weapon?))
Expand Down Expand Up @@ -1714,17 +1720,17 @@
[(let [main-hand-weapon ?orcpub.dnd.e5.character/main-hand-weapon
off-hand-weapon ?orcpub.dnd.e5.character/off-hand-weapon
all-weapons-map @(subscribe [::mi/all-weapons-map])]
(and (and main-hand-weapon
(-> all-weapons-map
(and main-hand-weapon
(-> all-weapons-map
main-hand-weapon
::weapons/melee?)
(not (-> all-weapons-map
main-hand-weapon
::weapons/melee?)
(not (-> all-weapons-map
main-hand-weapon
::weapons/two-handed?)))
(and off-hand-weapon
(not (-> all-weapons-map ;ensure no weapons in off hand
off-hand-weapon
::weapons/type)))))])
::weapons/two-handed?))
off-hand-weapon
(not (-> all-weapons-map ;ensure no weapons in off hand
off-hand-weapon
::weapons/type))))])
]})
(t/option-cfg
{:name "Great Weapon Fighting"
Expand Down Expand Up @@ -1861,7 +1867,8 @@

(def ua-al-illegal (modifiers/al-illegal "Unearthed Arcana options are not allowed"))

(defn subclass-plugin [class-base-cfg source subclasses ua-al-illegal?]
;; dead — all callers are in #_ discarded template blocks (dmg-classes, ua, scag)
#_(defn subclass-plugin [class-base-cfg source subclasses ua-al-illegal?]
(merge
class-base-cfg
{:source source
Expand Down Expand Up @@ -1899,7 +1906,8 @@
:num num
:prepend-level? true}))

(defn subclass-cantrip-selection [spell-lists spells-map class-key class-name ability spells num]
;; dead — only called from deprecated ua_sorcerer.cljc
#_(defn subclass-cantrip-selection [spell-lists spells-map class-key class-name ability spells num]
(spell-selection
spell-lists
spells-map
Expand Down Expand Up @@ -1997,7 +2005,8 @@
(traits-modifiers traits nil source)
(when source [(modifiers/used-resource source name)]))})))

(defn ability-modifiers [abilities]
;; unreferenced — inline (map modifiers/ability ...) used at call sites
#_(defn ability-modifiers [abilities]
(map
(fn [[k v]]
(modifiers/ability k v))
Expand Down Expand Up @@ -2188,7 +2197,6 @@
armor-proficiencies
weapon-proficiencies
profs
source
plugin?
edit-event]
:as race}]
Expand Down Expand Up @@ -2239,12 +2247,14 @@
(weapon-prof-modifiers weapon-proficiencies)
(when source [(modifiers/used-resource source name)]))})))

(defn add-sources [source background]
;; dead — only called from #_ discarded block in template.cljc
#_(defn add-sources [source background]
(-> background
(assoc :source source)
(update :traits (fn [traits] (map (fn [t] (assoc t :source source)) traits)))))

(def artisans-tools-choice-cfg
;; dead — only called from #_ discarded backgrounds in template.cljc and deprecated scag.cljc
#_(def artisans-tools-choice-cfg
{:name "Artisan's Tool"
:options (zipmap (map :key equipment/artisans-tools) (repeat 1))})

Expand Down Expand Up @@ -2597,7 +2607,8 @@
(defn level-name [index]
(str "Level " index))

(defn subclass-level-option [{:keys [name
;; unreferenced — subclass-option builds level options inline
#_(defn subclass-level-option [{:keys [name
levels] :as subcls}
kw
spellcasting-template
Expand Down Expand Up @@ -3030,7 +3041,8 @@
:yuan-ti-pureblood {:name "Yuan-Ti Pureblood"
:languages [:abyssal :draconic]}})

(defn druid-cantrip-selection [spell-lists spells-map class-nm]
;; dead — only called from deprecated ua_race_feats.cljc
#_(defn druid-cantrip-selection [spell-lists spells-map class-nm]
(t/selection-cfg
{:name "Druid Cantrip"
:tags #{:spells}
Expand Down Expand Up @@ -3070,7 +3082,8 @@
(get-in @(subscribe [::character/spells-known nil c])
[0 ["Warlock" :eldritch-blast]]))))

(defn deep-gnome-option-cfg [key source page]
;; dead — only called from #_ discarded blocks in template.cljc
#_(defn deep-gnome-option-cfg [key source page]
{:name "Gnome"
:plugin? true
:subraces
Expand All @@ -3085,7 +3098,8 @@
:page page
:summary "Advantage on hide checks in rocky terrain"}]}]})

(defmacro eldritch-invocation-option [{:keys [name summary source page prereqs modifiers trait-type frequency range]}]
;; dead — only called from deprecated ua_warlock_and_wizard.cljc / ua_revised_class_options.cljc
#_(defmacro eldritch-invocation-option [{:keys [name summary source page prereqs modifiers trait-type frequency range]}]
`(t/option-cfg
{:name ~name
:prereqs ~prereqs
Expand Down
Loading
Loading