|
1794 | 1794 | (let [spell-map @(subscribe [::spells/spells-map]) |
1795 | 1795 | spell (spell-map key) |
1796 | 1796 | cls-mods (get spell-modifiers class) |
| 1797 | + spell-dc (get cls-mods :spell-save-dc) |
1797 | 1798 | remaining-preps (- prepare-spell-count |
1798 | 1799 | prepared-spell-count)] |
1799 | | - [[:tr.pointer |
1800 | | - {:on-click on-click} |
| 1800 | + [[:tr.spell |
1801 | 1801 | [:td.p-l-10.p-b-10.p-t-10.f-w-b |
1802 | 1802 | (if (and (pos? lvl) |
1803 | 1803 | (get prepares-spells class)) |
|
1820 | 1820 | [:td.p-l-10.p-b-10.p-t-10 (if ability (s/upper-case (common/safe-name ability)))] |
1821 | 1821 | [:td.p-l-10.p-b-10.p-t-10 (get cls-mods :spell-save-dc)] |
1822 | 1822 | [:td.p-l-10.p-b-10.p-t-10 (common/bonus-str (get cls-mods :spell-attack-modifier))] |
1823 | | - [:td.p-r-10.orange |
| 1823 | + [:td.p-l-10.p-b-10.p-t-10 [:button.form-button-checks |
| 1824 | + {:on-click #(dispatch [:show-message-2 (str (:name spell) " attack " (dice/dice-roll-text-2 (str "1d20" (common/bonus-str (get cls-mods :spell-attack-modifier)))))])} |
| 1825 | + "Roll"]] |
| 1826 | + [:td.p-l-10.p-b-10.p-t-10.pointer.orange |
| 1827 | + {:on-click on-click} |
1824 | 1828 | [:i.fa |
1825 | 1829 | {:class-name (if expanded? "fa-caret-up" "fa-caret-down")}]]] |
1826 | 1830 | (if expanded? |
|
1853 | 1857 | (if (pos? lvl) |
1854 | 1858 | [:span.f-w-b (str @(subscribe [::char/spell-slots-remaining id lvl]) " remaining")])] |
1855 | 1859 | [:table.w-100-p.t-a-l.striped |
1856 | | - [:tbody |
| 1860 | + [:tbody.spells |
1857 | 1861 | [:tr.f-w-b.f-s-12 |
1858 | 1862 | [:th.p-l-10.p-b-10.p-t-10 (if (and (not (zero? lvl)) |
1859 | 1863 | (seq prepares-spells)) |
|
1862 | 1866 | [:th.p-l-10.p-b-10.p-t-10 (if mobile? "Src" "Source")] |
1863 | 1867 | [:th.p-l-10.p-b-10.p-t-10 (if mobile? "Aby" "Ability")] |
1864 | 1868 | [:th.p-l-10.p-b-10.p-t-10 "DC"] |
1865 | | - [:th.p-l-10 |
| 1869 | + [:th |
1866 | 1870 | {:class-name (if (not mobile?) "p-b-10 p-t-10")} |
1867 | | - "Mod."]] |
| 1871 | + "Mod."] |
| 1872 | + [:th.p-l-10.p-b-10.p-t-10 "Attack"] |
| 1873 | + [:th.p-l-10.p-b-10.p-t-10]] |
1868 | 1874 | (doall |
1869 | 1875 | (map-indexed |
1870 | 1876 | (fn [i r] |
|
2161 | 2167 | v]] |
2162 | 2168 | (if (boolean show-button) |
2163 | 2169 | [:div.f-s-24.f-w-b [:button.form-button-checks |
2164 | | - {:on-click #(dispatch [:show-message-2 (str title " check " (dice/dice-roll-text-2 (str "1d20" v))) 10000])} |
| 2170 | + {:on-click #(dispatch [:show-message-2 (str title " check " (dice/dice-roll-text-2 (str "1d20" v)))])} |
2165 | 2171 | "Roll"]])]) |
2166 | 2172 |
|
2167 | 2173 | (def current-hit-points-editor-style |
|
2284 | 2290 | [:span.m-l-5.saving-throw-name (s/upper-case (name k))]]] |
2285 | 2291 | [:td [:div.p-5.saving-throw-bonus (common/bonus-str (save-bonuses k))]] |
2286 | 2292 | [:td [:button.form-button-checks |
2287 | | - {:on-click #(dispatch [:show-message-2 (str (s/upper-case (name k)) " check " (dice/dice-roll-text-2 (str "1d20" (common/mod-str (save-bonuses k))))) 10000])} |
| 2293 | + {:on-click #(dispatch [:show-message-2 (str (s/upper-case (name k)) " check " (dice/dice-roll-text-2 (str "1d20" (common/mod-str (save-bonuses k)))))])} |
2288 | 2294 | "Roll"]]]) |
2289 | 2295 | char/ability-keys))]]])) |
2290 | 2296 |
|
|
2626 | 2632 | [:span.m-l-5.f-w-b.f-s-18 "Armor"]] |
2627 | 2633 | [:div |
2628 | 2634 | [:table.w-100-p.t-a-l.striped |
2629 | | - [:tbody |
| 2635 | + [:tbody.armor |
2630 | 2636 | [:tr.f-w-b |
2631 | 2637 | {:class-name (if mobile? "f-s-12")} |
2632 | 2638 | [:th.p-10 "Name"] |
2633 | 2639 | (if (not mobile?) [:th.p-10 "Proficient?"]) |
2634 | 2640 | [:th.p-10 "Details"] |
2635 | | - [:th] |
2636 | | - [:th.p-10 "AC"]] |
| 2641 | + [:th.p-10 "AC"] |
| 2642 | + [:th.p-10]] |
2637 | 2643 | (doall |
2638 | 2644 | (for [{:keys [name description type key] :as armor} (conj armor-details nil) |
2639 | 2645 | shield (conj shield-details nil)] |
|
2648 | 2654 | (armor-profs type))) |
2649 | 2655 | expanded? (@expanded-details k)] |
2650 | 2656 | ^{:key (str key (:key shield))} |
2651 | | - [:tr.pointer |
2652 | | - {:on-click (toggle-details-expanded-handler expanded-details k)} |
| 2657 | + [:tr.item |
2653 | 2658 | [:td.p-10.f-w-b (str (or (::mi/name armor) (:name armor) "unarmored") |
2654 | 2659 | (if shield (str " + " (:name shield))))] |
2655 | 2660 | (if (not mobile?) |
2656 | 2661 | [:td.p-10 (boolean-icon proficient?)]) |
2657 | 2662 | [:td.p-10.w-100-p |
2658 | 2663 | [:div |
2659 | 2664 | (armor-details-section armor shield expanded?)]] |
| 2665 | + [:td.p-10.f-w-b.f-s-18 ac] |
2660 | 2666 | [:td |
2661 | 2667 | [:div.orange |
2662 | | - (if (not mobile?) |
2663 | | - [:span.underline (if expanded? "less" "more")]) |
| 2668 | + {:on-click (toggle-details-expanded-handler expanded-details k)} |
| 2669 | + #_(if (not mobile?) |
| 2670 | + [:span.underline (if expanded? "less" "more")]) |
2664 | 2671 | [:i.fa.m-l-5 |
2665 | | - {:class-name (if expanded? "fa-caret-up" "fa-caret-down")}]]] |
2666 | | - [:td.p-10.f-w-b.f-s-18 ac]])))]]]])))) |
| 2672 | + {:class-name (if expanded? "fa-caret-up" "fa-caret-down")}]]]])))]]]])))) |
2667 | 2673 |
|
2668 | 2674 | (defn section-header [icon title] |
2669 | 2675 | [:div.flex.align-items-c |
|
2686 | 2692 | [section-header "crossed-swords" "Weapons"] |
2687 | 2693 | [:div |
2688 | 2694 | [:table.w-100-p.t-a-l.striped |
2689 | | - [:tbody |
| 2695 | + [:tbody.weapons |
2690 | 2696 | [:tr.f-w-b |
2691 | 2697 | {:class-name (if mobile? "f-s-12")} |
2692 | 2698 | [:th.p-10 "Name"] |
2693 | 2699 | (if (not mobile?) [:th.p-10 "Proficient?"]) |
2694 | 2700 | [:th "Details"] |
2695 | | - [:th] |
2696 | | - [:th (if mobile? "Atk" [:div.w-40 "Attack Bonus"])]] |
| 2701 | + |
| 2702 | + [:th (if mobile? "Atk" [:div.w-40 "Attack Bonus"])] |
| 2703 | + [:th.p-10]] |
2697 | 2704 | (doall |
2698 | 2705 | (map |
2699 | 2706 | (fn [[weapon-key {:keys [equipped?]}]] |
|
2704 | 2711 | droll (str damage-die-count "d" damage-die)] |
2705 | 2712 | (if (not= type :ammunition) |
2706 | 2713 | ^{:key weapon-key} |
2707 | | - [:tr |
| 2714 | + [:tr.weapon |
2708 | 2715 | [:td.p-10.f-w-b (or (:name weapon) |
2709 | 2716 | (::mi/name weapon))] |
2710 | 2717 | (if (not mobile?) |
|
2714 | 2721 | (weapon-attack-description weapon damage-modifier nil)] |
2715 | 2722 | (if expanded? |
2716 | 2723 | (weapon-details weapon weapon-damage-modifier))] |
2717 | | - [:td.pointer |
2718 | | - {:on-click (toggle-details-expanded-handler expanded-details weapon-key)} |
2719 | | - [:div.orange |
2720 | | - (if (not mobile?) |
2721 | | - [:span.underline (if expanded? "less" "more")]) |
2722 | | - [:i.fa.m-l-5 |
2723 | | - {:class-name (if expanded? "fa-caret-up" "fa-caret-down")}]]] |
| 2724 | + |
2724 | 2725 | [:td.p-10.f-w-b.f-s-18 (common/bonus-str (weapon-attack-modifier weapon))] |
2725 | 2726 | [:td [:button.form-button-checks |
2726 | 2727 | {:on-click #(dispatch [:show-message-2 (str name " attack " (dice/dice-roll-text-2 (str "1d20" (common/mod-str (weapon-attack-modifier weapon)))))])} |
2727 | 2728 | "Attack"]] |
2728 | 2729 | [:td [:button.form-button-checks |
2729 | 2730 | {:on-click #(dispatch [:show-message-2 (str name " damage " (dice/dice-roll-text-2 (str droll (common/mod-str (weapon-attack-modifier weapon)))))])} |
2730 | | - "Damage"]]]))) |
| 2731 | + "Damage"]] |
| 2732 | + [:td.pointer |
| 2733 | + {:on-click (toggle-details-expanded-handler expanded-details weapon-key)} |
| 2734 | + [:div.orange |
| 2735 | + #_(if (not mobile?) |
| 2736 | + [:span.underline (if expanded? "less" "more")]) |
| 2737 | + [:i.fa.m-l-5 |
| 2738 | + {:class-name (if expanded? "fa-caret-up" "fa-caret-down")}]]]]))) |
2731 | 2739 | all-weapons))]]]])))) |
2732 | 2740 |
|
2733 | 2741 | (defn magic-item-rows [expanded-details magic-item-cfgs magic-weapon-cfgs magic-armor-cfgs] |
|
2737 | 2745 | (fn [[item-kw item-cfg]] |
2738 | 2746 | (let [{:keys [::mi/name ::mi/type ::mi/item-subtype ::mi/rarity ::mi/attunement ::mi/description ::mi/summary] :as item} (magic-item-map item-kw) |
2739 | 2747 | expanded? (@expanded-details item-kw)] |
2740 | | - [[:tr.pointer |
2741 | | - {:on-click (toggle-details-expanded-handler expanded-details item-kw)} |
| 2748 | + [[:tr |
2742 | 2749 | [:td.p-10.f-w-b (or (:name item) name)] |
2743 | 2750 | [:td.p-10 (str (common/kw-to-name type) |
2744 | 2751 | ", " |
2745 | 2752 | (common/kw-to-name rarity))] |
2746 | | - [:td.p-r-5 |
| 2753 | + [:td.p-r-5.pointer |
| 2754 | + {:on-click (toggle-details-expanded-handler expanded-details item-kw)} |
2747 | 2755 | [:div.orange |
2748 | | - (if (not mobile?) |
2749 | | - [:span.underline (if expanded? "less" "more")]) |
| 2756 | + #_(if (not mobile?) |
| 2757 | + [:span.underline (if expanded? "less" "more")]) |
2750 | 2758 | [:i.fa.m-l-5 |
2751 | 2759 | {:class-name (if expanded? "fa-caret-up" "fa-caret-down")}]]]] |
2752 | 2760 | (if expanded? |
|
2772 | 2780 | [:span.m-l-5.f-w-b.f-s-18 "Other Magic Items"]] |
2773 | 2781 | [:div.f-s-14 |
2774 | 2782 | [:table.w-100-p.t-a-l.striped |
2775 | | - [:tbody |
| 2783 | + [:tbody.other-magic-items |
2776 | 2784 | [:tr.f-w-b |
2777 | 2785 | {:class-name (if mobile? "f-s-12")} |
2778 | 2786 | [:th.p-10 "Name"] |
|
2802 | 2810 | [:span.m-l-5.f-w-b.f-s-18 "Other Equipment"]] |
2803 | 2811 | [:div |
2804 | 2812 | [:table.w-100-p.t-a-l.striped |
2805 | | - [:tbody |
| 2813 | + [:tbody.equipment |
2806 | 2814 | [:tr.f-w-b |
2807 | 2815 | {:class-name (if mobile? "f-s-12")} |
2808 | 2816 | [:th.p-10 "Name"] |
|
2817 | 2825 | ;;expanded? (@expanded-details item-kw) |
2818 | 2826 | ] |
2819 | 2827 | ^{:key item-kw} |
2820 | | - [:tr |
| 2828 | + [:tr.item |
2821 | 2829 | [:td.p-10.f-w-b (or (:name item) item-name)] |
2822 | 2830 | [:td.p-10 (::char-equip/quantity item-cfg)] |
2823 | 2831 | [:td.p-10 |
|
0 commit comments