From f9015b1a7b43aca393624877107067e55f013ac4 Mon Sep 17 00:00:00 2001 From: DatDamnZotz Date: Wed, 8 Apr 2026 23:05:02 -0500 Subject: [PATCH] Fix for multiclass and Human subraces --- src/cljs/orcpub/character_builder.cljs | 27 ++++++++++--------- .../orcpub/dnd/e5/content_reconciliation.cljs | 24 ++++++++++++++--- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/cljs/orcpub/character_builder.cljs b/src/cljs/orcpub/character_builder.cljs index 26db04d31..42f7b790e 100644 --- a/src/cljs/orcpub/character_builder.cljs +++ b/src/cljs/orcpub/character_builder.cljs @@ -150,16 +150,17 @@ (defn character-textarea [entity-values prop-name & [cls-str]] [character-field-50000 entity-values prop-name :textarea cls-str]) -(defn prereq-failures [option] - (remove - nil? - (map - (fn [{:keys [::t/prereq-fn ::t/label] :as prereq}] - (if prereq-fn - (when (not (prereq-fn)) - label) - (js/console.warn "NO PREREQ_FN" (::t/name option) prereq))) - (::t/prereqs option)))) +(defn prereq-failures [option built-char] + (when built-char + (remove + nil? + (map + (fn [{:keys [::t/prereq-fn ::t/label] :as prereq}] + (if prereq-fn + (when (not (prereq-fn built-char)) + label) + (js/console.warn "NO PREREQ_FN" (::t/name option) prereq))) + (::t/prereqs option))))) (defn set-class-fn [i options-map] (fn [e] (let [new-key (keyword (.. e -target -value))] @@ -195,7 +196,7 @@ (defn class-level-selector [] (let [expanded? (r/atom false)] - (fn [i key selected-class options unselected-classes-set] + (fn [i key selected-class options unselected-classes-set built-char] (let [options-map (make-options-map options) class-template-option (options-map key) path [:class-levels key]] @@ -208,7 +209,7 @@ (doall (map (fn [{:keys [::t/key ::t/name] :as option}] - (let [failed-prereqs (when (pos? i) (prereq-failures option))] + (let [failed-prereqs (when (pos? i) (prereq-failures option built-char))] ^{:key key} [:option.builder-dropdown-item {:value key @@ -285,7 +286,7 @@ (map-indexed (fn [i [key selected-class]] ^{:key key} - [class-level-selector i key selected-class (map class-level-data options) unselected-classes-set]) + [class-level-selector i key selected-class (map class-level-data options) unselected-classes-set built-char]) selected-classes))] (when (seq remaining-classes) [:div.orange.p-5.underline.pointer diff --git a/src/cljs/orcpub/dnd/e5/content_reconciliation.cljs b/src/cljs/orcpub/dnd/e5/content_reconciliation.cljs index a798a8e5c..c42b64da0 100644 --- a/src/cljs/orcpub/dnd/e5/content_reconciliation.cljs +++ b/src/cljs/orcpub/dnd/e5/content_reconciliation.cljs @@ -166,9 +166,25 @@ (def ^:private builtin-races #{:dwarf :elf :halfling :human :dragonborn :gnome - :half-elf :half-orc :tiefling :hill-dwarf :mountain-dwarf - :high-elf :wood-elf :drow :lightfoot :stout :forest-gnome - :rock-gnome}) + :half-elf :half-orc :tiefling}) + +;; Built-in subraces: PHB subrace keys auto-generated from their names via +;; common/name-to-kw. Human cultural variants (Calishite etc.) are defined +;; in spell_subs.cljs with only :name, so their keys are derived from the name. +(def ^:private builtin-subraces + #{;; Dwarf + :hill-dwarf :mountain-dwarf + ;; Elf + :high-elf :wood-elf :drow + ;; Halfling + :lightfoot :stout + ;; Gnome + :forest-gnome :rock-gnome + ;; Human cultural variants (spell_subs.cljs human-option-cfg :subraces) + :calishite :chondathan :damaran :illuskan + :mulan :rashemi :shou :tethyrian :turami + ;; Human variant selection options + :standard-human :variant-human}) ;; Only Acolyte is hardcoded (spell_subs.cljs:538). (def ^:private builtin-backgrounds #{:acolyte}) @@ -188,7 +204,7 @@ :class (contains? builtin-classes k) :subclass (contains? builtin-subclasses k) :race (contains? builtin-races k) - :subrace (contains? builtin-races k) + :subrace (contains? builtin-subraces k) :background (contains? builtin-backgrounds k) :feat (contains? builtin-feats k) false))